Re: Design principles: no bool arguments

2011-08-26 Thread Thomas 'PointedEars' Lahn
Ian Kelly wrote: > Thomas 'PointedEars' Lahn wrote: >> Both variants work (even in Py3) if you only define [a named argument]. >> You have to define [a keyword argument, e.g. `kwargs']. >> >> so that >> >> data1.merge_with(data2, True); >> >> is a syntax error ("TypeError: merge_with() takes exact

Re: [OT-ish] Design principles: no bool arguments

2011-08-25 Thread Roy Smith
In article <4e55f604$0$29973$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > [1] This is the Internet. There's *always* a certain amount of disagreement. No there's not. -- http://mail.python.org/mailman/listinfo/python-list

Re: Design principles: no bool arguments

2011-08-25 Thread Ian Kelly
On Thu, Aug 25, 2011 at 3:29 AM, Thomas 'PointedEars' Lahn wrote: > Both variants work (even in Py3) if you only define > > class Data(object): >  def merge_with(self, bar, overwrite_duplicates): >    pass > > data1 = Data() > data2 = Data() > > You have to define > > class Data(object): >  def me

Re: Design principles: no bool arguments

2011-08-25 Thread Thomas 'PointedEars' Lahn
Stefan Behnel wrote: > Thomas 'PointedEars' Lahn, 25.08.2011 11:29: >> Stefan Behnel wrote: >>> It's totally unreadable to find this in the code: >>> >>> data1.merge_with(data2, true); >>> >>> Requires you to either a) know the underlying signature by heart, or b) >>> look it up before under

Re: Design principles: no bool arguments

2011-08-25 Thread Stefan Behnel
Thomas 'PointedEars' Lahn, 25.08.2011 11:29: Stefan Behnel wrote: It's totally unreadable to find this in the code: data1.merge_with(data2, true); Requires you to either a) know the underlying signature by heart, or b) look it up before understanding the code. It's a lot harder to argue

Re: [OT-ish] Design principles: no bool arguments

2011-08-25 Thread Terry Reedy
On 8/25/2011 3:13 AM, Steven D'Aprano wrote: One design principle often mentioned here (with a certain degree of disagreement[1]) is the idea that as a general rule, you shouldn't write functions that take a bool argument to switch between two slightly different behaviours. This is a principle o

Re: Design principles: no bool arguments

2011-08-25 Thread Thomas 'PointedEars' Lahn
Stefan Behnel wrote: > Maarten, 25.08.2011 09:52: >> On Aug 25, 9:13 am, Steven D'Aprano wrote: >>> One design principle often mentioned here (with a certain degree of >>> disagreement[1]) is the idea that as a general rule, you shouldn't write >>> functions that take a bool argument to switch bet

Re: Design principles: no bool arguments

2011-08-25 Thread Stefan Behnel
Maarten, 25.08.2011 09:52: On Aug 25, 9:13 am, Steven D'Aprano wrote: One design principle often mentioned here (with a certain degree of disagreement[1]) is the idea that as a general rule, you shouldn't write functions that take a bool argument to switch between two slightly different behaviou

Re: Design principles: no bool arguments

2011-08-25 Thread Maarten
On Aug 25, 9:13 am, Steven D'Aprano wrote: > One design principle often mentioned here (with a certain degree of > disagreement[1]) is the idea that as a general rule, you shouldn't write > functions that take a bool argument to switch between two slightly > different behaviours. > > This is a pri

[OT-ish] Design principles: no bool arguments

2011-08-25 Thread Steven D'Aprano
One design principle often mentioned here (with a certain degree of disagreement[1]) is the idea that as a general rule, you shouldn't write functions that take a bool argument to switch between two slightly different behaviours. This is a principle often championed by the BDFL, Guido van Rossum.