How much is set in stone?

Andreas Kostyrka andreas at mtg.co.at
Wed Nov 7 11:46:06 EST 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Mittwoch, 7. November 2001 00:29 schrieben Sie:
> I expected better from this group.
Well, normally, when I'm a newbie, and this happens everytime I try a new 
language community, I not only try to learn the rules, but also the useful 
idioms. Basically while it's usually quite easy to learn a language, it's 
more complicated to get a feeling for the language.

I've also got the impression that you ignore the fact that Python is quite a 
mature language (I personally have been maintaining a commercial solution 
written in Python since 1996 ;) ), and that is not a wise thing to do.

And lastly your proposition is quite popular only with newbies that don't 
know Python. Actually it is already implementable with Python now:

UnknownName="UnknownName"

class ProtectedValues:
  def __init__(self):
    self.a=1
    self.b=2
    self.classsetup=1

  def __setattr__(self,k,v):
    if self.__dict__.has_key("classsetup"):
      if not self.__dict__.has_key(k):
        raise UnknownName
    self.__dict__ [k]=v

x=ProtectedValues()
x.c=100 # -> UnknownName

# Warning: I've typed this in my Mailer, and didn't test it. So the
# indentation is propably wrong ;)

But then, You said You were a newbie. ;) You just didn't behave like a 
newbie, by proposing obviously a very non-Pythonish change. But then, perhaps 
I should tell the guys at Audi, that my A6 should have 6 tires instead of the 
4. As a newbie in car design I know it better than them.

Andreas
- -- 
Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zwölfaxing
Tel: +43/676/4091256; Fax: +43/1/7065299
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE76WVSHJdudm4KnO0RAgM/AKCOMyzQmXApy8rNUlNvkA5BUdaPuwCfa/Kh
AZehM280nUQ9hmNu6xB9Xoc=
=iMk5
-----END PGP SIGNATURE-----




More information about the Python-list mailing list