how to convert string to list or tuple

Ruud de Jong look.at.signature at somewhere
Wed Jun 1 16:06:35 EDT 2005


Steven Bethard schreef:
> But unless the person eval-ing your code *only* writes immaculate code I 
> can see that you can probably screw them. ;)  I wonder why 
> __subclasses__ isn't a restricted attribute...  Is it ever used for 
> something that isn't evil? ;)
> 
> STeVe

Completely off topic, but I just cannot resist showing off.
Some time ago I used __subclasses__ in a way that is not evil. I think.

The details are described in the following thread:
http://groups.google.nl/group/comp.lang.python/browse_thread/thread/5c1ccb986c66cdc1/

A summary: I used __subclasses__ to apply the Chain-of-Responsibility
pattern to object creation. The code would appear to instantiate
an object of the root of a class hierarchy, but the actual object
that was created would be an instance of a subclass.

So to get back to your question: yes, there are non-evil
uses for __subclasses__. Weird perhaps, but non-evil.
Non-standard, sure . Too clever for my own good, very likely.

Regards,

Ruud

-- 
Ruud de Jong

'@'.join('.'.join(s) for s in (['ruud','de','jong'],['tiscali','nl']))



More information about the Python-list mailing list