How does Python's OOP feel?

Discussion in 'Python' started by Ikon, May 24, 2009.

  1. Ikon

    Ikon Guest

    I'm rather new to Python. I have PHP for my main language and I do
    some Java. They all have a very strict OO schema. As I red through
    Python's tutorial it seams it has nothing of those rules. No statical,
    abstract classes, functions, or variables.

    I wish someone, who has experience in both Java/PHP/C# and Python
    would tell me how mush better/worse is it to program in a language
    that misses most of the OO parts!
     
    Ikon, May 24, 2009
    #1
    1. Advertising

  2. On May 24, 5:54 am, Ikon <> wrote:
    Be prepared for a slight wave of depression as you remember all the
    pointless interfaces, abstract classes, and getters/setters you
    created. I keep reminding myself that Java pays the bills.

    Having said that, the dynamic nature of Python lets you experiment
    with some more advanced OO concepts that Java doesn't have, like
    mixins (like multiple inheritance) and multimethods (dispatching on
    parameter types). Then there are metaclasses..
     
    Dutch Masters, May 24, 2009
    #2
    1. Advertising

  3. Ikon a écrit :
    > I'm rather new to Python. I have PHP for my main language and I do
    > some Java. They all have a very strict OO schema.


    I would describe PHP's "OO schema" as "very strict" (FWIW, I wouldn't
    qualify anything PHP as "strict" in any way...)

    > As I red through
    > Python's tutorial it seams it has nothing of those rules. No statical,
    > abstract classes, functions, or variables.


    Why so ?

    > I wish someone, who has experience in both Java/PHP/C# and Python
    > would tell me how mush better/worse is it to program in a language
    > that misses most of the OO parts!


    Where did you read that these were "most of the OO parts" ? All those
    dumb qualifiers are C++/Java's very peculiar (mis)understanding of OO.
    All you need to do proper OO are objects (defined by a unique id, a
    state and a behaviour) and messages.

    As far as I'm concerned, what I don't understand is how one can do OO in
    a language that has non-object "objects" (ie: primitive types etc).

    Anyway... Python's object model is indeed quite different from what
    you've "learned" with Java and PHP, and you'll have to first unlearn
    most of what you think you know about OO. OTHO, once you do understand
    Python's object model and it's incredible flexibility and power, you
    won't want to hear about Java anymore. Not to say Python is the "more
    pure" OOPL ever (if that's what you're after, Smalltalk is your friend -
    but it's not really used that much nowadays...), it's firstly a very
    *practical* language, but still it's OO all the way down (everything -
    including functions and classes and modules - is an object), and it
    really makes OO easy and usefull.

    My 2 cents...
     
    Bruno Desthuilliers, May 27, 2009
    #3
  4. Ikon

    Lie Ryan Guest

    Ikon wrote:
    > I'm rather new to Python. I have PHP for my main language and I do
    > some Java. They all have a very strict OO schema. As I red through
    > Python's tutorial it seams it has nothing of those rules. No statical,
    > abstract classes, functions, or variables.
    >
    > I wish someone, who has experience in both Java/PHP/C# and Python
    > would tell me how mush better/worse is it to program in a language
    > that misses most of the OO parts!


    import antigravity
     
    Lie Ryan, May 30, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven D'Aprano

    Do you feel bad because of the Python docs?

    Steven D'Aprano, Feb 26, 2013, in forum: Python
    Replies:
    84
    Views:
    768
    Terry Reedy
    Mar 9, 2013
  2. Jean-Michel Pichavant

    Re: Do you feel bad because of the Python docs?

    Jean-Michel Pichavant, Mar 1, 2013, in forum: Python
    Replies:
    0
    Views:
    104
    Jean-Michel Pichavant
    Mar 1, 2013
  3. Ned Batchelder
    Replies:
    2
    Views:
    1,009
    Neil Cerutti
    May 20, 2013
  4. Chris Angelico
    Replies:
    0
    Views:
    1,039
    Chris Angelico
    May 19, 2013
  5. Demian Brecht
    Replies:
    0
    Views:
    116
    Demian Brecht
    May 20, 2013
Loading...

Share This Page