Do pythons like sugar?

Andrew Dalke adalke at mindspring.com
Thu Jan 9 13:15:03 EST 2003


Afanasiy:
 > You don't know what I am doing. My design is perfect.
 > In my situation, your way is wrong. I am not looking to
 > hide a poor implementation. That's a rude assumption.

I didn't say your design was imperfect, I said your
implementation was.  Though upon review, what I though
was an error in your code (regarding long word lengths)
is not.  That error of mine is not germane to the rest
of this thread.


> When someone like Dalke trolls I will always react.

Me? Trolling?  That's the first time in 12+ years of
newsgroups that I've been accused of that.  You're
pretty thin skinned or hot headed if you believe this
to be the case.

 > I just asked a question and the answer is apparently no,
 > except for the knowledge Dalke is withholding of course.
 > But I can find that one my own...

Unlikely that you can find it, but hey, it's little
skin off my nose and it's cute in an evil sort of way

But if you or anyone uses this in your code, you should
be rightly chastised by everyone else in a code review.

In other words "DO NOT USE IN REAL CODE - I WILL NOT BE
HELD RESPONSIBLE IF YOU DEPLOY WITH THIS.  FOR NOVELTY
USE ONLY."

 >>> class Foo:
...     eggs = 1
...     def doit(self):
...             self.spam = 5
...             self.tomato = 3
...             for x in dir(self): exec "%s = self.%s" % (x,x)
...             for k, v in locals().items():
...                     print k, "==", v
...             print
...             print "the calculation yields", tomato ** spam
...
 >>> Foo().doit()
doit == <bound method Foo.doit of <__main__.Foo instance at 0x815a284>>
tomato == 3
__module__ == __main__
spam == 5
x == tomato
self == <__main__.Foo instance at 0x815a284>
eggs == 1
__doc__ == None

the calculation yields 243
 >>>


					Andrew
					dalke at dalkescientific.com





More information about the Python-list mailing list