Announcement

Collapse
No announcement yet.

Python 3.4 Steps Closer With New Features

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    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, 10:05 AM.

    Comment


    • #12
      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

      Comment


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

        Comment


        • #14
          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.

          Comment


          • #15
            Private functions in Python

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

            Comment


            • #16
              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

              Comment


              • #17
                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.

                Comment


                • #18
                  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.

                  Comment


                  • #19
                    Python=Hipster Language

                    Comment


                    • #20
                      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.

                      Comment

                      Working...
                      X