Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 45

Thread: Python 3.4 Steps Closer With New Features

  1. #11
    Join Date
    Feb 2011
    Posts
    1,299

    Default

    Quote Originally Posted by uid313 View Post
    Prefixing method names with underscore isn't OOP and doesn't make it private.
    It is just you pretending that it is private.
    First, again, just because the syntax is different than you are used to does not make it wrong.

    Second, supporting private methods is not a requirement for a language to be object-oriented, nor is it necessary to do any of the things you claim (falsely) that Python is bad at.

    Third, I notice you completely ignored the rest of my reply.
    Last edited by TheBlackCat; 09-10-2013 at 11:05 AM.

  2. #12
    Join Date
    Apr 2012
    Posts
    119

    Default

    Quote Originally Posted by uid313 View Post
    Prefixing method names with underscore isn't OOP and doesn't make it private.
    It is just you pretending that it is private.
    https://mail.python.org/pipermail/tu...er/025932.html

    https://plus.google.com/115212051037...ts/7wpbQTPRWft

  3. #13
    Join Date
    Apr 2012
    Posts
    119

    Default

    Besides, everything in Python is an object -- whether you like it or not.

  4. #14
    Join Date
    Sep 2011
    Posts
    40

    Default

    Quote Originally Posted by uid313 View Post
    Python still doesn't have;
    * public/private/protected access modifiers.
    * Class interfaces, abstract classes, etc
    It's by design - it will never have those.
    You can actually do public/private and abstract classes if you want; however you can also chose to fuck it if you want.
    As a developer, this is why I love Python. It doesn't assume I'm a baby.

  5. #15
    Join Date
    Jan 2013
    Posts
    1,462

    Default

    Private functions in Python

    Code:
    # the following function is private, do NOT touch it
    def _foo()

  6. #16
    Join Date
    Jul 2009
    Location
    Germany
    Posts
    528

    Default

    Personally I don't like Python that much, but you can't say it's different than any of these so called "real" OOP languages with respect to private methods. You can call private methods in PHP, Java and C# via reflection. Works like a charm

  7. #17
    Join Date
    Sep 2011
    Posts
    76

    Default

    Quote Originally Posted by uid313 View Post
    Prefixing method names with underscore isn't OOP and doesn't make it private.
    It is just you pretending that it is private.
    You presumably use Linux. Making things private should make your blood boil. Python has an "We're all adults here" philosophy just like Linux (and probably why so many of its users develop on Linux). It's not "pretending" that it is private. That is a convention in Python that indicates private. If a user chooses to ignore documentation or needs to get at the variable anyway, they've been warned and are responsible for what happens next. That's the Linux way, the Python way, and arguably the one true free way.

    Python doesn't force things on people. Someone once said that some languages put up barbed wire and land mines to prevent developers from doing certain bad things. Python employs rainbows and sunshine on the good path instead so users are never tempted to go down the bad paths.

  8. #18
    Join Date
    Feb 2011
    Posts
    1,299

    Default

    Hehe, I like this idea:

    The real solution is to create super-private attributes prefixed with three underscores, and have __getattribute__() terminate the program and format the user's hard drive if they try to access them directly. That'll show 'em.

  9. #19
    Join Date
    Dec 2008
    Posts
    1,002

    Default

    Python=Hipster Language

  10. #20
    Join Date
    Nov 2012
    Posts
    210

    Default

    Quote Originally Posted by monraaf View Post
    Python=Hipster Language
    If that graph defines "popular" as "what I like to use most" then I think it is probably true. If it is popular as in "most used" I would doubt that the sampling was done in a very good way.
    That said, I use Python for everything if possible. I very seldom have to look for another tool.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •