Ben Finney wrote:
> Peter Otten <__pete...@web.de> writes:
>
>> Ben Finney wrote:
>>
>> > Peter Otten <__pete...@web.de> writes:
>> >
>> > That's an unexpected inconsistency between list comprehensions
>> > versus generator expressions, then. Is that documented explicitly in
>> > the Python 2 do
Peter Otten <__pete...@web.de> writes:
> Ben Finney wrote:
>
> > Peter Otten <__pete...@web.de> writes:
> >
> > That's an unexpected inconsistency between list comprehensions
> > versus generator expressions, then. Is that documented explicitly in
> > the Python 2 documentation?
>
> https://docs.
Ben Finney wrote:
> Peter Otten <__pete...@web.de> writes:
>
>> I would probably use a generator expression. These don't leak names:
>
> That's an unexpected inconsistency between list comprehensions versus
> generator expressions, then. Is that documented explicitly in the Python
> 2 documentat
MRAB writes:
> Have you thought about catching the NameError?
I had not, but that is obvious now you say it. Thanks.
Where there isn't a more elegant solution, I'll use that. It might not
be elegant, but it's at least clear and expressive of the intent.
Jussi Piitulainen writes:
> Make them
Peter Otten <__pete...@web.de> writes:
> I would probably use a generator expression. These don't leak names:
That's an unexpected inconsistency between list comprehensions versus
generator expressions, then. Is that documented explicitly in the Python
2 documentation?
> Python 2.7.6 (default, J
Ben Finney writes:
> How can I ensure incidental names don't end up in the class
> definition, with code that works on both Python 2 and Python 3?
>
> With the following class definition, the incidental names `foo` and
> `bar`, only needed for the list comprehension, remain in the `Parrot`
> names
On Thu, Aug 13, 2015 at 1:39 AM, Peter Otten <__pete...@web.de> wrote:
> But I would probably use a generator expression. These don't leak names:
>
> Python 2.7.6 (default, Jun 22 2015, 17:58:13)
> [GCC 4.8.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
c
Ben Finney wrote:
> How can I ensure incidental names don't end up in the class definition,
> with code that works on both Python 2 and Python 3?
>
> With the following class definition, the incidental names `foo` and
> `bar`, only needed for the list comprehension, remain in the `Parrot`
> names
On 2015-08-12 10:01, Ben Finney wrote:
How can I ensure incidental names don't end up in the class definition,
with code that works on both Python 2 and Python 3?
With the following class definition, the incidental names `foo` and
`bar`, only needed for the list comprehension, remain in the `Par
On Wed, Aug 12, 2015 at 7:01 PM, Ben Finney wrote:
> class Parrot:
> """ A parrot with beautiful plumage. """
>
> plumage = [
> (foo, bar) for (foo, bar) in feathers.items()
> if bar == "beautiful"]
> del foo, bar # ← FAILS, “NameError:
10 matches
Mail list logo