Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-11 Thread Christian Tismer
On 12.04.14 01:55, Ethan Furman wrote: > On 04/11/2014 02:01 PM, Christian Tismer wrote: >> >> I have these style problems with several modules that I am reluctant to >> use, therefore. I know that I'm pretty alone with that. > > You are not alone in that. Funny not to be alone in being alone in t

Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-11 Thread Ethan Furman
On 04/11/2014 02:01 PM, Christian Tismer wrote: I have these style problems with several modules that I am reluctant to use, therefore. I know that I'm pretty alone with that. You are not alone in that. -- ~Ethan~ ___ Python-Dev mailing list Python-

Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-11 Thread Greg Ewing
On 11/04/14 21:50, Chris Barker wrote: On Thu, Apr 10, 2014 at 7:12 PM, Christian Tismer wrote: def __init__(self, **kwargs): first_arg = kwargs.pop('option_1', somedefault) ... nth_arg = kwargs.pop('option_n', somedefault') ... Is: def __init__(self, optio

Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-11 Thread Christian Tismer
Hi Chris, On 11/04/14 21:50, Chris Barker wrote: > On Thu, Apr 10, 2014 at 7:12 PM, Christian Tismer wrote: > >> Then I rather often see things like this: >> >> class someclass(object): >> # note that there is no comment about argument destruction... >> >> def __init__(self, **kwargs): >>

Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-11 Thread Chris Barker
On Thu, Apr 10, 2014 at 7:12 PM, Christian Tismer wrote: > Then I rather often see things like this: > > class someclass(object): > # note that there is no comment about argument destruction... > > def __init__(self, **kwargs): > first_arg = kwargs.pop('option_1', somedefault) >

Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-11 Thread Christian Tismer
Thank you too, Tres. Somehow I had a brain shortcut and forgot that the dict is locally generated, *because* of the stars. Good to become adjusted and restarted, sorry about the noise. ciao - Chris On 11/04/14 05:48, Tres Seaver wrote: > On 04/10/2014 10:12 PM, Christian Tismer wrote: > >> I a

Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-11 Thread Christian Tismer
Ah, now I see it. For some reason, I forgot that the dict is always newly created. That was really wrong thinking. Sorry! On 11/04/14 05:47, Guido van Rossum wrote: > I'm not sure what you're worried about here. Modifying kwds doesn't > actually modify the dict that was passed in. So are you just

Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-10 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/10/2014 10:12 PM, Christian Tismer wrote: > I always used the policy that arguments are never changed by a > function, unless explicitly stated. But since I see this pattern quite > frequently, I wanted to ask if I am right by thinking this way,

Re: [Python-Dev] arguments policy: **kwargs.pop()

2014-04-10 Thread Guido van Rossum
I'm not sure what you're worried about here. Modifying kwds doesn't actually modify the dict that was passed in. So are you just talking about the style issue? Or would you also object to this: def foo(x=1): x += 1 ? On Thu, Apr 10, 2014 at 10:12 PM, Christian Tismer wrote: > Hi guys, > >

[Python-Dev] arguments policy: **kwargs.pop()

2014-04-10 Thread Christian Tismer
Hi guys, I tried to find advice for hours, but failed so fer, so here is my question: Whenever I think to adopt a new module that does a good job, I always can't stand the temptation to look at the coding style and certain principles. Then I rather often see things like this: class someclass(ob