[Python-3000] Metaclasses in Python 3000: Draft 2 (original) (raw)
Phillip J. Eby pje at telecommunity.com
Wed Mar 14 21:23:22 CET 2007
- Previous message: [Python-3000] Metaclasses in Python 3000: Draft 2
- Next message: [Python-3000] New I/O PEP to Subversion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 11:15 AM 3/14/2007 -0700, Guido van Rossum wrote:
I think this rebuttal isn't strong enough; I'm sure there will be use cases where a custom prepare method can solve a problem that a standard ordered dict couldn't.
For example, a custom prepare could provide access to special method names to do things in the body, ala Ruby on Rails' ActiveRecord DSL. e.g.:
class SomeRecord(Record, table_name="foo")
x = many(OtherRecord)
Where 'many' is actually an object returned by the special dictionary's getitem. In addition, it might be the case that "OtherRecord" is a class that doesn't exist yet, and the special dictionary returns a placeholder object that will serve until a record type with that name is defined.
This use case doesn't even need ordering, but it does need prepare.
- Previous message: [Python-3000] Metaclasses in Python 3000: Draft 2
- Next message: [Python-3000] New I/O PEP to Subversion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]