confused if i should be doing type checking in the code ( a confused java programmer)

Jason Orendorff jason at jorendorff.com
Sun Jan 6 12:04:33 EST 2002


> So in python code i needed a singleton and then the immutable constants.
> Then came across this recipie in Cookbook and Well it's brillaint!
> i had'nt even imagined such things could be done.
> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65207

Yes, but the best thing is to write:

  REGULAR = 1
  NEW = 2
  CHILDREN = 3

and leave it at that.  Realistically, no one is going to
mess with your constants.  It just isn't a problem, in real
life.

Python doesn't have "private" or "final", or static type-checking.
Don't try to fake these features; it's not really possible.


> even after a couple of months of python..i think i have not
> been able to understand the differences in the way
> you code in java and python!  :-(

The main difference is that it takes 1/5 the time.  :-)
Just relax, and don't try to do everything "the Java way".

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list