On 07/20/2010 10:43 AM, Fred Drake wrote:
On Tue, Jul 20, 2010 at 9:09 AM, Steven D'Aprano<st...@pearwood.info>  wrote:
It refers to the guideline that you shouldn't have a single function
with two (or more) different behaviour and an argument that does
nothing but select between them.

In particular, when that argument is almost never given a variable
value, but is specified using a constant at the call site.

I was thinking it should have been two functions, but I realized there is more subtleties involved than simply just reusing a directory that already exists.


One possibility might be...

    mkdir(path [, allow=None, mode=0777])

Where None can be replaced with one or more of the following.

    'exists'     dir can already exist      (with same permissions as mode)
    'case'       dir case can be different. (Windows)
    'files'      dir can have files in it.

    ... or a string containing the initials.


It doesn't fall under the single constant rule if done this way.


Ron







_______________________________________________
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

Reply via email to