At 05:06 PM 2/19/04 +0000, Michael Hudson wrote: >Bob Ippolito <bob at redivi.com> writes: > > > Also note that the patch also adds the same sugar to classes, so you > > could use it in lieu of metaclasses for some cases (like transforming > > some members that follow a naming convention into properties): > > > > >>> class Foo(object) [type]: > > ... pass > > ... > > >>> Foo > > <type 'type'> > >FWIW, I'm rather less convinced this is useful. class Foo(object) [instancesProvide(IFoo)]: ... is actually somewhat more useful. Right now, the packages that do this sort of thing (Zope and PyProtocols) use a pseudometaclass in order to spell it more like this: class Foo(object): protocols.advise(instancesProvide=[IFoo]) Being able to spell it the other way would allow a less "magical" implementation for various types of class metadata.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4