Is this unpythonic?
Frank Millman
frank at chagford.com
Fri May 8 09:12:11 EDT 2015
"Dave Angel" <davea at davea.name> wrote in message
news:554CA652.1000607 at davea.name...
> On 05/08/2015 06:53 AM, Frank Millman wrote:
>>
>
> It might be appropriate to define the list at top-level, as
>
> EMPTY_LIST=[]
>
> and in your default argument as
> def x(y, z=EMPTY_LIST):
>
> and with the all-caps, you're thereby promising that nobody will modify
> that list.
>
> (I'd tend to do the None trick, but I think this alternative would be
> acceptable)
>
Thanks, Dave, I like that idea.
However, as you can see from my other replies, I have decided to go with the
flow, and use the None trick.
Frank
More information about the Python-list
mailing list