Re: Feature request: subclassing FunctionType [Was: Some languageproposals]
From: Terry Reedy (tjreedy_at_udel.edu)
Date: 03/02/04
- Next message: Tim Peters: "RE: python.exe vs pythonw.exe difference?"
- Previous message: Terry Reedy: "Re: Escape problem"
- In reply to: Michele Simionato: "Re: Feature request: subclassing FunctionType [Was: Some language proposals]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 2 Mar 2004 10:29:53 -0500 To: python-list@python.org
"Michele Simionato" <michele.simionato@poste.it> wrote in message
news:95aa1afa.0403012224.506dd07c@posting.google.com...
> 1. Assuming all "for" loops and list comprehensions are replaced
> with Haskell bindings rules, what about backward compatibility
> problems? For instance: is there enough code relying on the loop
> variable being available outside the loop?
Guido has given things like the following as an intentional reason for the
current rule (and for for...else):
for item in seq:
if acceptable(item): break
else:
item = None
# item is now either the first acceptible item in seq or None
If you do not like the iteration var remaining bound, you can explicitly
delete it. If it is automatically deleted, constructions like the above
are rendered more difficult.
A list comp encapulates a specialized for loop whose specific job is to
produce a list. It makes more sense to delete the binding automatically
there since a) there is no way, when seq is empty, to force a binding to
*something*, with else and b) the last item of the list is readily
available anyway as result[-1].
Terry J. Reedy
- Next message: Tim Peters: "RE: python.exe vs pythonw.exe difference?"
- Previous message: Terry Reedy: "Re: Escape problem"
- In reply to: Michele Simionato: "Re: Feature request: subclassing FunctionType [Was: Some language proposals]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|