S
Steven Bethard
Felipe said:> Em Sex, 2006-04-14 às 09:31 -0600, Steven Bethard escreveu:>>> [1] Here's the code I used to test it.
>>>> ... try:>> >>> def make(callable, name, args, block_string):
>> ... 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.
Depends what you're copying and pasting to. In PythonWin, you have to
have the "... ", so I include it.
If you have an editor with block-select, you should just be able to
select the appropriate section (ignoring the first four characters).
TextPad is one such editor (on Windows), but I'm sure there are many
others and hopefully if you're on Unix someone here can let you know
what works there.
STeVe