On Sun, 23 Oct 2016 02:24 pm, Chris Angelico wrote:
> 1) Sometimes, all the iterables can be evaluated in advance.
>
> dice_2d6 = [a+b for a in range(1,7) for b in range(1,7)]
>
> 2) But sometimes, subsequent iterables depend on the outer loop.
>
> triangle = [a+b for a in range(1, 7) for b in
On Sun, 23 Oct 2016 01:15 pm, eryk sun wrote:
> I meant the behavior seems to have been copied to align with generator
> expressions, even though the cited rationale doesn't apply. I'm not
> saying this is wrong. It's useful that the expression for the outer
> iterator is evaluated in the defining
On Sun, Oct 23, 2016 at 4:08 PM, eryk sun wrote:
> For generator expressions, it's about early binding of the outer
> iterator. This makes the result of the expression for the outer
> iterator behave like a function parameter. Obviously it has to be
> evaluated in the defining scope. Comprehension
On 10/22/2016 11:24 PM, Chris Angelico wrote:
On Sun, Oct 23, 2016 at 2:14 PM, Steve D'Aprano
wrote:
But it seems that the first iterator (and only that one) is evaluated
in the parent context:
Because the first iterator *can* always be evaluated.
I don't understand what you mean by that. I
On Sun, Oct 23, 2016 at 3:44 AM, Steve D'Aprano
wrote:
>
> https://www.python.org/dev/peps/pep-0289/#early-binding-versus-late-binding
>
> But this isn't a question about early or late binding, it is asking why the
> variable y is treated as both global and local in the same comprehension.
> This
Hi everyone!
I am working on a new REST API library for Django.
You can see it on:
Github: https://github.com/FFX01/django-restup
PyPI:
https://pypi.python.org/pypi?name=django-restup&version=0.1.1&:action=display
I know there is already a couple great packages out there for REST API
developme
On Sun, 23 Oct 2016 11:51 am, eryk sun wrote:
> On Sat, Oct 22, 2016 at 11:57 PM, Chris Angelico wrote:
>>
>> Normally, a comprehension is described as being equivalent to an
>> unrolled loop, inside a nested function.
>> ...
>> But it seems that the first iterator (and only that one) is evaluate
On Sun, Oct 23, 2016 at 2:14 PM, Steve D'Aprano
wrote:
> There's definitely something strange going on. Compare the what happens when
> the semi-global variable is in the first loop iterable versus the second
> loop iterable. In this first example, y refers to both the global and the
> local, yet
On Sun, Oct 23, 2016 at 2:14 PM, Steve D'Aprano
wrote:
>>> But it seems that the first iterator (and only that one) is evaluated
>>> in the parent context:
>>
>> Because the first iterator *can* always be evaluated.
>
> I don't understand what you mean by that. If I take you literally, it is
> obv
On Sun, 23 Oct 2016 11:43 am, Terry Reedy wrote:
> On 10/22/2016 7:57 PM, Chris Angelico wrote:
>> This surprised me.
>>
>> Python 3.4.2 (default, Oct 8 2014, 10:45:20)
>> [GCC 4.9.1] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
> y=6
> [(x,y) for x i
On Sun, 23 Oct 2016 10:57 am, Chris Angelico wrote:
> This surprised me.
>
> Python 3.4.2 (default, Oct 8 2014, 10:45:20)
> [GCC 4.9.1] on linux
> Type "help", "copyright", "credits" or "license" for more information.
y=6
[(x,y) for x in range(y) for y in range(3)]
> [(0, 0), (0, 1), (
On Sun, Oct 23, 2016 at 1:28 AM, Chris Angelico wrote:
>
> Fair enough, except that a generator expression is syntactic sugar for
> a generator function, and the return value of a generator function is
> a generator object that hasn't yet been started. So where the boundary
> is, then, is a bit of
On Sun, Oct 23, 2016 at 11:51 AM, eryk sun wrote:
> It matches the behavior of generator expressions, for which Guido
> gives the following example, as quoted in PEP 289:
>
> Consider sum(x for x in foo()). Now suppose there's a bug in foo()
> that raises an exception, and a bug in sum() t
On Sun, Oct 23, 2016 at 11:43 AM, Terry Reedy wrote:
>> Normally, a comprehension is described as being equivalent to an
>> unrolled loop, inside a nested function. That would be like this:
>>
>> def temp():
>> ret = []
>> for x in range(y):
>> for y in range(3):
>> ret
On Sat, Oct 22, 2016 at 11:57 PM, Chris Angelico wrote:
>
> Normally, a comprehension is described as being equivalent to an
> unrolled loop, inside a nested function.
> ...
> But it seems that the first iterator (and only that one) is evaluated
> in the parent context:
>
> Why is this? It seems r
On 10/22/2016 7:57 PM, Chris Angelico wrote:
This surprised me.
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
y=6
[(x,y) for x in range(y) for y in range(3)]
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1,
This surprised me.
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> y=6
>>> [(x,y) for x in range(y) for y in range(3)]
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2,
2), (3, 0), (3,
On 10/21/2016 11:22 PM, MRAB wrote:
> The docs say that it's subclass of the email.message module's Message.
>
> You can get the email's header fields like it's a dict, except that the
> field names are case-insensitive. The author(s) of the module couldn't
> use a true dict because of the need fo
On 10/22/2016 03:24 AM, dieter wrote:
> In addition to the previous (excellent) responses:
>
> A "message" models a MIME (RFC1521 Multipurpose Internet Mail Extensions)
> message (the international standard for the structure of emails).
> The standard tells you that a message consists essentially
On 10/22/2016 05:47 AM, andy wrote:
> I would type: help(mailbox) after importing it.
I guess the output of that might be more meaningful once I understand
the underlying structures and conventions.
--
https://mail.python.org/mailman/listinfo/python-list
On 10/21/2016 11:45 PM, Ben Finney wrote:
> So each instance you're getting has (a superset of) the API of
> ``email.message.Message``, which is a lot of behaviour
> https://docs.python.org/2.7/library/email.message.html#email.message.Message>
> including being able to interrogate the message heade
On Sat, 22 Oct 2016 15:01:46 +, John Gordon wrote:
> In Wildman
> writes:
>
>> > Another serious problem with using env in the hash-bang line is that you
>> > cannot pass commandline options to the Python executable.
>
>> Not true. I made a test script with this code:
>
>> #!/usr/bin/en
I was rereading the 2.7 docs about abstract base classes the other day. I
found this line in the usage section of the abc.abstractproperty function:
"This defines a read-only property; you can also define a read-write
abstract property using the ‘long’ form of property declaration:"
along with
In Wildman
writes:
> > Another serious problem with using env in the hash-bang line is that you
> > cannot pass commandline options to the Python executable.
> Not true. I made a test script with this code:
> #!/usr/bin/env python
> import sys
> print sys.argv
> Then I ran it:
> ~$ python
wrote in message
news:9c91a4cf-1f3e-43b3-b75c-afc96b0b4...@googlegroups.com...
I have read Anssi's post already before I sent the post. To be frankly, I
can't understand why he got the right answer. I'm sorry for my silly. "So
when we assign to r again, it's the empty dict inside t (the one acc
在 2016年10月22日星期六 UTC+8下午5:06:22,Frank Millman写道:
> wrote in message
> news:2853d778-857e-46fc-96a0-8d164c098...@googlegroups.com...
>
> 在 2016年10月20日星期四 UTC+8下午11:04:38,Frank Millman写道:
> > wrote in message
> > news:01cfd810-0561-40b1-a834-95a73dad6...@googlegroups.com...
> >
> > Hi Frank,
> >
>
On Oct 22, 2016 12:45 AM, wrote:
>
> Many Thanks to everybody.
You're welcome. It's fun to help in a challenging problem. Please let us
know what solution(s), if any, you have adopted, what problems, if any,
you've encountered, what Python version and operating system.
--
https://mail.python.org
Fri, 21 Oct 2016 22:43:55 -0400 wrote Adam Jensen:
> The mailbox library documentation seems to be a little weak. In this
> example:
>
> https://docs.python.org/2.7/library/mailbox.html#examples
>
> import mailbox for message in mailbox.mbox('~/mbox'):
> subject = message['subject'] #
wrote in message
news:2853d778-857e-46fc-96a0-8d164c098...@googlegroups.com...
在 2016年10月20日星期四 UTC+8下午11:04:38,Frank Millman写道:
wrote in message
news:01cfd810-0561-40b1-a834-95a73dad6...@googlegroups.com...
Hi Frank,
thanks for your kind help. What confused me is at this line:
>>> r = r.set
在 2016年10月20日星期四 UTC+8下午11:04:38,Frank Millman写道:
> wrote in message
> news:01cfd810-0561-40b1-a834-95a73dad6...@googlegroups.com...
>
> 在 2016年10月20日星期四 UTC+8下午1:32:18,Frank Millman写道:
> > wrote in message
> > news:5506e4d8-bd1d-4e56-8d1b-f71fa8293...@googlegroups.com...
> >
> > > Let's see if I
Adam Jensen writes:
> ...
> https://docs.python.org/2.7/library/mailbox.html#examples
>
> import mailbox
> for message in mailbox.mbox('~/mbox'):
> subject = message['subject'] # Could possibly be None.
> if subject and 'python' in subject.lower():
> print subject
>
> What is
31 matches
Mail list logo