On 3/14/2011 10:21 AM, Gerald Britton wrote:
Any idea why Python works this way? I see that, in 3.2, an
optimization was done for sets (See "Optimizations" at
http://docs.python.org/py3k/whatsnew/3.2.html) though I do not see
anything similar for dictionaries.
1/ because no one would ever s
Jean-Michel Pichavan wrote:
>> Today I noticed that an expression like this:
>>
>> "one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
>> "can be as bad as one"}
>>
>> could be evaluated at compile time, but is not:
>>
>>
[snip]
>> Any idea why Python works this way? I see that,
Gerald Britton wrote:
Today I noticed that an expression like this:
"one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
"can be as bad as one"}
could be evaluated at compile time, but is not:
dis(compile(
... '"one:%(one)s two:%(two)s" % {"one": "is the lonelies
On Thu, 10 Mar 2011 11:23:32 -0500, Gerald Britton wrote:
> Today I noticed that an expression like this:
>
> "one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
> "can be as bad as one"}
>
> could be evaluated at compile time, but is not:
[...]
> Any idea why Python works this
On 3/10/2011 8:23 AM, Gerald Britton wrote:
Today I noticed that an expression like this:
"one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
"can be as bad as one"}
could be evaluated at compile time, but is not:
CPython barely evaluates anything at compile time.
On Thu, 10 Mar 2011 16:27:17 -0800, Chris Rebert wrote:
> 3. %-formatting is "obsolete and may go away in future versions of
> Python." (See
> http://docs.python.org/py3k/library/stdtypes.html#old-string-formatting-
operations
> )
There is an awful lot of opposition to that. If it ever happens,
On Thu, Mar 10, 2011 at 4:15 PM, Steven D'Aprano
wrote:
> On Thu, 10 Mar 2011 17:40:40 -0500, Terry Reedy wrote:
>> On 3/10/2011 11:23 AM, Gerald Britton wrote:
>>> Today I noticed that an expression like this:
>>>
>>> "one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
>>> "can
On Thu, 10 Mar 2011 17:40:40 -0500, Terry Reedy wrote:
> On 3/10/2011 11:23 AM, Gerald Britton wrote:
>> Today I noticed that an expression like this:
>>
>> "one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
>> "can be as bad as one"}
>>
>> could be evaluated at compile time, bu
On 3/10/2011 11:23 AM, Gerald Britton wrote:
Today I noticed that an expression like this:
"one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
"can be as bad as one"}
could be evaluated at compile time, but is not:
In fact, it could be evaluated at writing time ;-).
This wou
Today I noticed that an expression like this:
"one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
"can be as bad as one"}
could be evaluated at compile time, but is not:
>>> dis(compile(
... '"one:%(one)s two:%(two)s" % {"one": "is the loneliest number",
"two": "can be as bad a
10 matches
Mail list logo