[Python-ideas] Allow isinstance second argument to be a set of types
Michael Foord
fuzzyman at gmail.com
Fri Jul 8 00:12:48 CEST 2011
More information about the Python-ideas mailing list
Fri Jul 8 00:12:48 CEST 2011
- Previous message: [Python-ideas] Allow isinstance second argument to be a set of types
- Next message: [Python-ideas] Allow isinstance second argument to be a set of types
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 7 July 2011 20:12, Antoine Pitrou <solipsis at pitrou.net> wrote: > On Thu, 7 Jul 2011 15:08:54 -0400 > Mike Graham <mikegraham at gmail.com> wrote: > > On Thu, Jul 7, 2011 at 1:43 PM, Antoine Pitrou < > solipsis-xNDA5Wrcr86sTnJN9+BGXg at public.gmane.org> wrote: > > > On Thu, 7 Jul 2011 13:22:33 -0400 > > > Jim Jewett <jimjjewett at gmail.com> wrote: > > >> On Wed, Jul 6, 2011 at 7:35 PM, Benjamin Peterson < > benjamin-+ZN9ApsXKcEdnm+yROfE0A at public.gmane.org> wrote: > > >> > > >> > class Evil(type): > > >> > def __iter__(self): > > >> > return range(42) > > >> > > >> > class Accomplice(metaclass=Evil): > > >> > pass > > >> > > >> ... leading to isinstance(x, 42) rather than isinstance(x, Evil) if > > >> the iterable check is done too soon. > > > > > > In what way is that a problem? > > > That you can trigger exceptions by writing malicious code doesn't sound > > > like a particularly novel event ;) > > > > I think people are assuming that an iterable metaclass isn't > > fundamentally wrong. > > Well, it does sound fundamentally useless! > I've used indexable types before. I've never created an iterable one, but it isn't unthinkable. :-) Michael > > Regards > > Antoine. > > > _______________________________________________ > Python-ideas mailing list > Python-ideas at python.org > http://mail.python.org/mailman/listinfo/python-ideas > -- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110707/23bc4954/attachment.html>
- Previous message: [Python-ideas] Allow isinstance second argument to be a set of types
- Next message: [Python-ideas] Allow isinstance second argument to be a set of types
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list