"Steven D'Aprano" <[EMAIL PROTECTED]> wrote:
> It would be nice to be able to do this:
>
> defaults = dict(a=5, b=7)
> f(**defaults, a=8) # override the value of a in defaults
>
> but unfortunately that gives a syntax error. Reversing the order would
> override the wrong value. So as Python ex
On Sat, Jun 28, 2008 at 1:30 AM, tomer filiba <[EMAIL PROTECTED]> wrote:
> On Jun 28, 12:56 am, "Guido van Rossum" <[EMAIL PROTECTED]> wrote:
>> No, it could just be a harmless typo in a long argument list.
>
> to elaborate on this point a little, i came across this error when i
> ported my code to
> Perhaps they should be backported to the maintenance as warnings? Then
> users can decide on a case-by-case basis if they want to make that
> particularly warning trigger an exception.
No. There will likely be one more 2.5 release. This entire issue never
came up in the lifetime of 2.5, so it ca
> i'd be in favor of fixing this in 2.5, just to eliminate possibly hard-
> to-debug runtime errors. since it's a syntax error, it would be early-
> noticed when the code is first run/imported, and it wouldn't require
> the original author of the code to fix.
As release manager for Python 2.5, I'd
Guido van Rossum wrote:
In such cases I think it's better not to introduce new exceptions in
point-point releases.
Perhaps they should be backported to the maintenance as warnings? Then
users can decide on a case-by-case basis if they want to make that
particularly warning trigger an exceptio
On Jun 28, 12:56 am, "Guido van Rossum" <[EMAIL PROTECTED]> wrote:
> No, it could just be a harmless typo in a long argument list.
to elaborate on this point a little, i came across this error when i
ported my code to 2.4. i used the optparse class which takes 10's of
kwargs, and it turned out i'd
Jeff Hall wrote:
> That's all fine and good but in this case there may be "stealth errors".
That is fully understood, in all of its consequences.
Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/p
Steven D'Aprano wrote:
It would be nice to be able to do this:
defaults = dict(a=5, b=7)
f(**defaults, a=8) # override the value of a in defaults
I can't help but think that would be difficult coding convention to use.
However, I'm considerably less bothered by:
def f_with_defaults(**kw):
On Sat, 28 Jun 2008 11:17:10 am Greg Ewing wrote:
> tomer filiba wrote:
> > >>> def f(**kwargs):
> >
> > ... print kwargs
> > ...
> >
> > >>> f(a=5,b=7,a=8)
> >
> > {'a': 8, 'b': 7}
>
> I can't think of any reason why one would need to be
> able to write such code, or even want to.
It would
tomer filiba wrote:
>>> def f(**kwargs):
... print kwargs
...
>>> f(a=5,b=7,a=8)
{'a': 8, 'b': 7}
>>>
I can't think of any reason why one would need to be
able to write such code, or even want to.
--
Greg
___
Python-Dev mailing list
Python-De
oops... baby jumped in my lap... i pretty much said it all though... I think
the error of the software functioning incorrectly may necessitate the
patch... I certainly understand Guido's concern, however.
___
Python-Dev mailing list
Python-Dev@python.org
That's all fine and good but in this case there may be "stealth errors". If
the user/programmer is expecting the first value to hold but instead
On Fri, Jun 27, 2008 at 7:03 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> On Fri, Jun 27, 2008 at 2:54 PM, Fred Drake <[EMAIL PROTECTED]> wrote:
>
On Fri, Jun 27, 2008 at 2:54 PM, Fred Drake <[EMAIL PROTECTED]> wrote:
> On Jun 27, 2008, at 5:23 PM, Benjamin Peterson wrote:
>>
>> I think code that uses this is probably already quite broken in some
>> fundamental way and putting the fix in 2.5 isn't much of a risk.
>
> I suspect the risk has mo
Yes.
On Fri, Jun 27, 2008 at 2:18 PM, Steve Holden <[EMAIL PROTECTED]> wrote:
> So we wait until they port their code to 2.6 to break it?
>
> regards
> Steve
>
> Guido van Rossum wrote:
>>
>> Sounds like a regression in 2.5 (and in 2.6, and in 3.0). Probably due
>> to the switch to the new AST-b
On Fri, Jun 27, 2008 at 2:23 PM, Benjamin Peterson
<[EMAIL PROTECTED]> wrote:
> On Fri, Jun 27, 2008 at 2:11 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote:
>> Sounds like a regression in 2.5 (and in 2.6, and in 3.0). Probably due
>> to the switch to the new AST-based compiler. Can you file a bug?
On Fri, Jun 27, 2008 at 5:00 PM, Scott Dial
<[EMAIL PROTECTED]> wrote:
>
> The old compiler checked for this, but the AST-based compiler just blindly
> compiles the entire keyword argument sequence.
The new compiler will check for it when my patch on the issue 3219 is applied.
--
Cheers,
Benjam
Scott Dial wrote:
The regression is purely in the way an argument list is reduced to a
dictionary.
To further elaborate:
Python 2.4:
>>> import dis
>>> dis.dis(compile('f(a=3, b=1, a=4)', '', 'eval'))
Traceback (most recent call last):
File "", line 1, in ?
SyntaxError: duplicate keyword arg
On Jun 27, 2008, at 5:23 PM, Benjamin Peterson wrote:
I think code that uses this is probably already quite broken in some
fundamental way and putting the fix in 2.5 isn't much of a risk.
I suspect the risk has more to do with breaking something else in
Python than in breaking 3rd-party code
David Wolever wrote:
I don't have 2.4 handy to test it, but it is more likely that a keyword
and dictionary are passed, both containing the same item:
>>> f(a=3, **{'a': 4})
Would that be a potential risk?
Python 2.4.3
>>> f(a=3, **{'a': 4})
Traceback (most recent call last):
File "", line
On 27-Jun-08, at 6:23 PM, Benjamin Peterson wrote:
On Fri, Jun 27, 2008 at 2:11 PM, Guido van Rossum
<[EMAIL PROTECTED]> wrote:
Sounds like a regression in 2.5 (and in 2.6, and in 3.0). Probably
due
to the switch to the new AST-based compiler. Can you file a bug? I
think we should leave 2.5
On Fri, Jun 27, 2008 at 2:11 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> Sounds like a regression in 2.5 (and in 2.6, and in 3.0). Probably due
> to the switch to the new AST-based compiler. Can you file a bug? I
> think we should leave 2.5 alone (too much risk of breaking code) but
> fix it
So we wait until they port their code to 2.6 to break it?
regards
Steve
Guido van Rossum wrote:
Sounds like a regression in 2.5 (and in 2.6, and in 3.0). Probably due
to the switch to the new AST-based compiler. Can you file a bug? I
think we should leave 2.5 alone (too much risk of breaking
Sounds like a regression in 2.5 (and in 2.6, and in 3.0). Probably due
to the switch to the new AST-based compiler. Can you file a bug? I
think we should leave 2.5 alone (too much risk of breaking code) but
fix it in 2.6 and 3.0 if we can.
--Guido
On Fri, Jun 27, 2008 at 12:07 PM, tomer filiba <
23 matches
Mail list logo