"D'Arcy J.M. Cain" :
> On Fri, 07 Oct 2016 16:09:19 +0200
> jmp wrote:
>> What about
>>
>> def test():
>>if not hasattr(test, '_store'): test._store={'x':0}
>>test._store['x'] += 1
>
> Why is everyone working so hard to avoid creating a class?
Hear, hear!
Marko
--
https://mail.python
"jmp" a écrit dans le message de
news:mailman.213.1475849391.30834.python-l...@python.org...
On 10/07/2016 03:45 PM, ast wrote:
"jmp" a écrit dans le message de
news:mailman.210.1475844513.30834.python-l...@python.org...
On 10/07/2016 02:07 PM, ast wrote:
"jmp" a écrit dans le message d
On Fri, 07 Oct 2016 16:09:19 +0200
jmp wrote:
> What about
>
> def test():
>if not hasattr(test, '_store'): test._store={'x':0}
>test._store['x'] += 1
Why is everyone working so hard to avoid creating a class?
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da.
On 10/07/2016 03:45 PM, ast wrote:
"jmp" a écrit dans le message de
news:mailman.210.1475844513.30834.python-l...@python.org...
On 10/07/2016 02:07 PM, ast wrote:
"jmp" a écrit dans le message de
news:mailman.209.1475841371.30834.python-l...@python.org...
On 10/07/2016 01:38 PM, Daiyue Wen
"jmp" a écrit dans le message de
news:mailman.210.1475844513.30834.python-l...@python.org...
On 10/07/2016 02:07 PM, ast wrote:
"jmp" a écrit dans le message de
news:mailman.209.1475841371.30834.python-l...@python.org...
On 10/07/2016 01:38 PM, Daiyue Weng wrote:
So the rule of thumb f
On Fri, 7 Oct 2016 11:48 pm, jmp wrote:
> On 10/07/2016 02:07 PM, ast wrote:
>> It can be used to store some variables from one call of
>> a function to an other one.
>>
>> def test( _store={'x':0}):
>>
>> x = _store['x']
>> . do some stuff
>>_store['x'] = x
>
> For personal dirt
On Fri, 7 Oct 2016 10:38 pm, Daiyue Weng wrote:
> Hi, I declare two parameters for a function with default values [],
>
> def one_function(arg, arg1=[], arg2=[]):
>
> PyCharm warns me:
>
> Default argument value is mutable,
>
> what does it mean? and how to fix it?
The usual way to avoid tha
On 10/07/2016 02:07 PM, ast wrote:
"jmp" a écrit dans le message de
news:mailman.209.1475841371.30834.python-l...@python.org...
On 10/07/2016 01:38 PM, Daiyue Weng wrote:
So the rule of thumb for default argument value is "No mutable"
Cheers,
It can be used to store some variables from
"jmp" a écrit dans le message de
news:mailman.209.1475841371.30834.python-l...@python.org...
On 10/07/2016 01:38 PM, Daiyue Weng wrote:
So the rule of thumb for default argument value is "No mutable"
Cheers,
It can be used to store some variables from one call of
a function to an other
"Daiyue Weng" a écrit dans le message de
news:mailman.208.1475840291.30834.python-l...@python.org...
Hi, I declare two parameters for a function with default values [],
def one_function(arg, arg1=[], arg2=[]):
PyCharm warns me:
Default argument value is mutable,
what does it mean? and how
On 10/07/2016 01:38 PM, Daiyue Weng wrote:
Hi, I declare two parameters for a function with default values [],
def one_function(arg, arg1=[], arg2=[]):
PyCharm warns me:
Default argument value is mutable,
what does it mean? and how to fix it?
cheers
You'll run into this bug
def foo(a=[])
11 matches
Mail list logo