I need your opinion...

Stephen Hansen apt.shansen at gmail.com
Mon Dec 21 12:47:06 EST 2009


On Mon, Dec 21, 2009 at 8:23 AM, logan tag <logantag at gmail.com> wrote:

> It should be interesting to add new funcionality to "copytree" function
> into a "shutil.py" module?, I mean...I have developed a very silly function
> "copytree" with a different fourth argument. I have modified the "ignore"
> parameter to "target" parameter; this new one is used to copy the files wich
> matched with the given pattern.
> Basically, the opposite of the current "copytree".
>
> Maybe were a stupid idea but I throw it anyway.
>
> Thanks in advance.
>

I don't understand what you're actually asking. Are you asking if its
possible to 'add' new functionality into shutil yourself/manually? If so,
yes, you can just 'shutil.mynewfunction = myfunction'. But doing so is
highly discouraged, it's best to simply put this function into your own
module and import that module when needed.

Or are you asking if such a function would be useful as an addition to the
shutil in the standard library? If so, I'd say no: every "ignore" option can
trivially be turned into a "target" by simply inverting the test and
vice-versa. There's no reason to expand the stdlib's API and make people
choose between two functions which do the same thing in opposite directions.

Meaning, an argument which defines "ignore=" can serve the purpose of
"target=" by simply choosing to ignore everything which doesn't match what
you want to target.

Or you might be asking something else entirely, in which case I'm sorry, I'm
not sure what it is :)

HTH,

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091221/338975fe/attachment.html>


More information about the Python-list mailing list