Suggested amendment to PEP 255

Roman Suzi rnd at onego.ru
Wed Jun 20 11:25:54 EDT 2001


On 20 Jun 2001, damien  morton wrote:


Could't there be some reuse of << and >>
operators, but in unary notation, for "yield"?

Like:

...
  >> x

and then somewhere else:

<< g()

-- this will be more natural than thinking of some new keywords!

every func will be a generator, but most will produce []


>Simon Brunning <SBrunning at trisystems.co.uk> wrote in message news:<mailman.993023610.1418.python-list at python.org>...
>> > From:	Greg Ewing [SMTP:greg at cosc.canterbury.ac.nz]
>> > I suggest dropping the "def" altogether and using:
>> >
>> >   generator foo(args):
>> >     ...
>> >     yield x
>> >     ...
>>
>> This gets my vote. Or it would. If I had a vote. Which I don't.
>>
>> *Excellent* PEP, BTW!
>>
>> Cheers,
>> Simon Brunning
>> TriSystems Ltd.
>> sbrunning at trisystems.co.uk
>
>Im 100% with this too. doubleplusgood would be my vote, if I had one.
>Generators do seem different enough from functions to warrant a different syntax.
>
>some other syntax possibilities:
>
>gen foo(args):
>   yield x
>
>def foo(args) generator:
>   yield x
>
>def foo(args) as generator:
>   yield x
>
>def generator foo(args):
>   yield x
>

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Wednesday, June 20, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Is it possible to feel gruntled?" _/





More information about the Python-list mailing list