[Python-Dev] Keyword-only arguments in 2.x
Hi all, what's the status of backporting PEP 3102 ? It was supposed to go into 2.6 and it seems it won't be in 2.7 either. There is an updated patch in the tracker [1] that applies cleanly on the latest trunk and passes all relevant tests, so unless there has been a decision against backporting it, would it be possible to push it for 2.7 ? I think this is a very useful PEP and it would be great to have it in 2.x too. George [1] http://bugs.python.org/issue1745 ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] dict(keys, values)
Perhaps this has been brought up in the past but I couldn't find it in the archives: far too often I use the idiom dict(zip(keys,values)), or the same with izip. How does letting dict take two positional arguments sound ? Pros: - Pretty obvious semantics, no mental overhead to learn and remember it. - More concise (especially if one imports itertools just to use izip). - At least as efficient as the current alternatives. - Backwards compatible. Cons: - ?? George ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] dict(keys, values)
On 2/1/07, Brian Quinlan <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > Perhaps this has been brought up in the past but I couldn't find it in > > the archives: far too often I use the idiom dict(zip(keys,values)), or > > the same with izip. How does letting dict take two positional > > arguments sound ? > > > > Pros: > > - Pretty obvious semantics, no mental overhead to learn and remember it. > > - More concise (especially if one imports itertools just to use izip). > > - At least as efficient as the current alternatives. > > - Backwards compatible. > > > > Cons: > - Yet Another Way To Do It > - Marginal benefit > > Also note that the keyword variant is longer than the zip variant e.g. > >dict(zip(keys, values)) >dict(keys=keys, values=values) > > and the relationship between the keys and values seems far less obvious > to me in the keyword variant. > > Cheers, > Brian > Um, you do realize that dict(keys=keys, values=values) is already valid and quite different from dict(zip(keys, values)), don't you ? :) George ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] SyntaxError: 'import *' not allowed with 'from .'
I posted this on c.l.py but I didn't get a definite answer so I am asking again here: is it documented anywhere that "from .relative.module import *' is syntax error? Unless I missed it, PEP 328 doesn't mention anything about it. Also, while I understand the general caveats and warnings against "import *", at first glance it seems inconsistent to disallow it for relative imports while it is valid for absolute. Are there any particular reasons that allowing relative '*' imports is harder to implement, more fragile or generally worse in some way ? George ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com