class constructors: class vs. instance defaults

Steve Holden steve at holdenweb.com
Thu Oct 7 12:24:00 EDT 2004


Erik Johnson wrote:

> "Erik Johnson wellkeeper com>" <ej <atdot> wrote in message
> news:416472df at nntp.zianet.com...
> 
>>    I am rather new to Python and still learning the finer points....
> 
> 
> 
> Thanks to all of you who took the time to respond to my post!  I do like the
> 
>  foo_d or {}
> 
> paradigm - that's considerably cleaner.
> Michael Hoffman's comments about explicitly testing against None duly noted!
> :)

Of course that means that

	(foo_d is None) or {}

works, giving you the best of both worlds.

> 
>     And thanks to Mr. Holden for the words of encouragement - I have your
> book by the way. :)

Purchase is the sincerest form of flattery :-) so I should thank you, too.

> I am currently swamped with "stuff", but I browsed through enough of it to
> know that Python was a viable option for us. I came into this job with PHP
> already well underway. Though it has some smartly handy functions, I have
> not been very impressed with it as a language overall. I am thankful I have
> a cool boss who listens to what I think and so I think PHP, at this "shop"
> anyway, is on its way out.  :)  I hope to spend some more time digging into
> it (them - both the book and Python itself) soon!
> 

Good for you! PHP was originally intended to make it easy to build
relatively simple programmed web sites, but now it has been pushed
beyond all reasonable limits to a perversion of its former self.

People have done many amazing things with it, but many of them would
have been easier in a "proper" programming language.

regards
  Steve
-- 
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119




More information about the Python-list mailing list