Re: [Python-Dev] Adding functools.decorator

2006-04-30 Thread Simon Belak
Nick Coghlan wrote:
 Some details that are up for discussion:

   - which of a function's special attributes should be copied/updated?
   - should the __decorates__ and __decorator__ attributes be added?

 If people are happy with this idea, I can make sure it happens before  alpha 
 3.

What about preserving decorated function's signature, like we do in
TurboGears [1]?

Cheers,
Simon

[1] http://trac.turbogears.org/turbogears/browser/trunk/turbogears/decorator.py
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] A solution to the evils of static typing and interfaces?

2005-10-20 Thread Simon Belak
Hi,

I was thinking why not have a separate file for all the proposed 
optional meta-information (in particular interfaces, static types)? 
Something along the lines of IDLs in CORBA (with pythonic syntax, of 
curse). This way most of the benefits are retained without 
contaminating the actual syntax (dare I be so pretentious to even hope 
making both sides happy?).

For the sole purpose of illustration, let meta-files have extension .pym 
and linking to source-files be name based:

parrot.py
parrot.pym
(parrot.pyc)

With some utilities like a prototype generator (to and from meta-files) 
and a synchronization tool, time penalty on development for having two 
separate files could be kept within reason.

We could even go as far as introducing a syntax allowing custom 
meta-information to be added.

For example something akin to decorators.

parrot.pym:

@sharedinstance
class Parrot:

# Methods
# note this are only prototypes so no semicolon or suite is needed

@cache
def playDead(a : int, b : int) - None

# Attributes

@const
name : str

where sharedinstance, cache and const are custom meta-information.

This opens up countless possibilities for third-party interpreter 
enchantments and/or optimisations by providing a fully portable (as all 
meta-information are optional) language extensions.


P.S. my sincerest apologies if I am reopening a can of worms here
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com