The Voidspace Techie Blog

Gravatar 8.3: What is a class instance variable?
http://faq.rubygarden.org/entry/...r_prefix=faq% 2F


Gravatar As a python programmer who has only dabbled in perl and ruby I have to say I would *love* to have the ||= (or-equals) operator. It looks funny but once you learn what it does it makes :

if not hasattr(o, 'foo') or not o.foo:
o.foo = "the first value"

... much easier! :

o.foo ||= "the first value"



I also agree about ! and ? suffixes, way more readable.


Name:

Email:

URL:

Comment:  ? 

 

Commenting by HaloScan