[Python-3000] PEP 3133: Introducing Roles (original) (raw)
Arvind Singh arvind1.singh at gmail.com
Mon May 14 12:06:32 CEST 2007
- Previous message: [Python-3000] PEP 3133: Introducing Roles
- Next message: [Python-3000] PEP 3133: Introducing Roles
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Asking Questions About Roles
Shouldn't there be some way to ``revoke'' roles?
How can we get a list of all roles played by an object?
Should there be a way to check ``loosely'' whether an object can potentially play a given role? (i.e., checking whether an object provides a give interface, atleast syntactically)
I understand that this can be achieved via:
try: now_performs(instance.class, [role.RoleToCheck]) except: print("can't play role") else: print("maybe plays role")
But such approach will be error prone (``revoking'' roles later, and such; destructive checks are bad idea, anyway). Better would be to have::
if performs(instance, [role.RoleToCheck], loose=True): print("maybe plays role")
Assigning Roles at Runtime
Maybe it should be suggested that dynamic role assignment should not be made without knowing the implementation (with a reminder about tree's bark() and dog's bark() ).
Regards, Arvind
- Previous message: [Python-3000] PEP 3133: Introducing Roles
- Next message: [Python-3000] PEP 3133: Introducing Roles
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]