Re: Inheritance error in python 2.3.4???

Discussion in 'Python' started by Jack Diederich, Feb 15, 2005.

  1. On Tue, Feb 15, 2005 at 10:56:23AM +1100, Delaney, Timothy C (Timothy) wrote:
    > wrote:
    >
    > > I guess I could just use one underscore.... but that means it is
    > > easier for other people to get at my implementation details (which,
    > > coming from a C++ background really bothers me).

    >
    > This is the correct solution, and getting over being bothered about it
    > is the correct thing to do.
    >
    > Getting at private members is simple in C++ too if anyone wants to do
    > that.


    As a long time C++ guy that switched over to python (via a perl detour) my
    advice is to do things the python way even if they feel strange at first.
    In this case forget about "private" and "protected." If it helps you can
    consider them conventions that have some compiler support. The 20th
    commandment of python is "we're all adults here." To see the first 19, type
    "import this" at the python prompt.

    I also discovered - to my shock and horror - that many of the GoF's "Design
    Patterns" were actually C++ centric and not universals. The sting of seeing
    canon reduced to a HOWTO fades quickly, just jump in with both feet.

    -Jack
     
    Jack Diederich, Feb 15, 2005
    #1
    1. Advertising

  2. Jack Diederich

    Guest

    Thanks guys for all your input! I really appreciate the prompt
    replies!

    As you can tell I'm having a bit of trouble throwing out old habits...
    I'm not new to loosely typed languages (I'm a big PHP fan) but learning
    a new object model has been a little tough... I'm trying to make my old
    ideas fit a new language (which is a bad idea in general).

    So thanks for setting me straight. I hadn't yet heard of "properties"
    it looks like it does what I want... so I will check them out further.
    But if they don't do what I want I will probably just use a single
    underscore and ummmm trust my users ;-) (In general, C++ people
    aren't a trusting bunch.... Auto Garbage collection!!?!???!
    What!?!???! ;-)

    Thanks again for the replies,
    Friedmud
     
    , Feb 15, 2005
    #2
    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. maxw_cc
    Replies:
    1
    Views:
    3,197
    Martijn van Steenbergen
    Dec 21, 2003
  2. cppsks
    Replies:
    0
    Views:
    853
    cppsks
    Oct 27, 2004
  3. karthikbalaguru
    Replies:
    9
    Views:
    1,068
  4. Daniel Pitts
    Replies:
    27
    Views:
    1,956
    Mike Schilling
    Feb 27, 2008
  5. johnsonlau
    Replies:
    1
    Views:
    795
    Kai-Uwe Bux
    Jul 21, 2008
Loading...

Share This Page