PEP 359: The "make" Statement

Felipe Almeida Lessa felipe.lessa at gmail.com
Fri Apr 14 11:40:23 EDT 2006


Em Sex, 2006-04-14 às 09:31 -0600, Steven Bethard escreveu:
> [1] Here's the code I used to test it.
> 
>  >>> def make(callable, name, args, block_string):
> ...     try:
> ...         make_dict = callable.__make_dict__
> ...     except AttributeError:
> ...         make_dict = dict
> ...     block_dict = make_dict()
> ...     exec block_string in block_dict
> ...     return callable(name, args, block_dict)
> ...
>  >>> (snip)

I think it would be nice not to put those ">>>" and "..." to make copy
and paste easier. Okay, I know we can do "".join(line[4:] for line in
text), but that's just my humble opinion.

-- 
Felipe.




More information about the Python-list mailing list