[Python-Dev] mkdir -p in python

Ron Adam rrr at ronadam.com
Tue Jul 20 20:38:27 CEST 2010



On 07/20/2010 12:00 PM, Fred Drake wrote:
> On Tue, Jul 20, 2010 at 12:47 PM, Ron Adam<rrr at ronadam.com>  wrote:
>> It doesn't fall under the single constant rule if done this way.
>
> If the value for 'allow' were almost always given as a constant, this
> would be an argument for three functions instead of one.
>
> The guideline has little to do with the type of the value, but the
> number of possible values ("small") and whether they're normally given
> as constants in the code.
>
> If there's more than one, and combinations then to vary, then keeping
> them as args makes sense.
>
> Also, if we don't know what we want the functionality to be, as you
> suggest, then worry about that is premature.  :-)  Let's decide on the
> required functionality first.

That makes sense. :-)

Another things that comes to mind, is it may make sense to choose either 
strict, and have args to *allow* different cases, or to choose lenient, and 
have args to *restrict* different cases.

That keeps it somewhat less confusing, and doesn't require memorization to 
remember what the mixed mode default might be.  (Unless we use a single 
combination 99% of the time, then that probably *should* be the default.)

Ron



More information about the Python-Dev mailing list