Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Why is the shutil module called shutil?

Reply
Thread Tools

Why is the shutil module called shutil?

 
 
Fletcher Johnson
Guest
Posts: n/a
 
      09-24-2011
The topic says it all:
Why is shutil named shutil? What does it stand for? This is just a
mild curiosity of mine.
The shutil module for reference: http://docs.python.org/library/shuti...#module-shutil
 
Reply With Quote
 
 
 
 
Chris Rebert
Guest
Posts: n/a
 
      09-24-2011
On Fri, Sep 23, 2011 at 8:36 PM, Fletcher Johnson <(E-Mail Removed)> wrote:
> The topic says it all:
> Why is shutil named shutil? What does it stand for? This is just a
> mild curiosity of mine.


"sh" is short for "shell", in line with Unix convention, where the
default shell is located at /bin/sh.
http://en.wikipedia.org/wiki/Shell_(computing)
http://en.wikipedia.org/wiki/Unix_shell

"util" is short for "utilities".

shutil is a utility module used to accomplish tasks which one often
does when in the shell, such as copying, moving, or removing directory
trees. But shutil (to my knowledge) is not implemented using shell
commands or by running external programs, so it thus avoids a whole
host of shell-related issues.

It's not the best name, but what with backwards compatibility and all,
it's unlikely to change any time soon.

Cheers,
Chris
--
http://rebertia.com
 
Reply With Quote
 
 
 
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      09-24-2011
On Fri, 23 Sep 2011 20:36:05 -0700 (PDT), Fletcher Johnson
<(E-Mail Removed)> declaimed the following in
gmane.comp.python.general:

> The topic says it all:
> Why is shutil named shutil? What does it stand for? This is just a
> mild curiosity of mine.
> The shutil module for reference: http://docs.python.org/library/shuti...#module-shutil


SHell UTILities -- ie; Python internal methods for doing things that
the typical UNIX/LINUX shell commands would do. Gives somewhat more
control than doing os.system("shellcommand"), and doesn't require
starting/stopping a shell process for each command.


--
Wulfraed Dennis Lee Bieber AF6VN
http://www.velocityreviews.com/forums/(E-Mail Removed) HTTP://wlfraed.home.netcom.com/

 
Reply With Quote
 
Fletcher Johnson
Guest
Posts: n/a
 
      09-24-2011
On Sep 23, 11:58*pm, Chris Rebert <(E-Mail Removed)> wrote:
> On Fri, Sep 23, 2011 at 8:36 PM, Fletcher Johnson <(E-Mail Removed)>wrote:
> > The topic says it all:
> > Why is shutil named shutil? What does it stand for? This is just a
> > mild curiosity of mine.

>
> "sh" is short for "shell", in line with Unix convention, where the
> default shell is located at /bin/sh.http://en.wikipedia.org/wiki/Shell_(...iki/Unix_shell
>
> "util" is short for "utilities".
>
> shutil is a utility module used to accomplish tasks which one often
> does when in the shell, such as copying, moving, or removing directory
> trees. But shutil (to my knowledge) is not implemented using shell
> commands or by running external programs, so it thus avoids a whole
> host of shell-related issues.
>
> It's not the best name, but what with backwards compatibility and all,
> it's unlikely to change any time soon.
>
> Cheers,
> Chris
> --http://rebertia.com


I had a hunch it might have been that.
 
Reply With Quote
 
rantingrick
Guest
Posts: n/a
 
      09-24-2011
On Sep 23, 10:36*pm, Fletcher Johnson <(E-Mail Removed)> wrote:
> The topic says it all:
> Why is shutil named shutil? What does it stand for? This is just a
> mild curiosity of mine.
> The shutil module for reference:http://docs.python.org/library/shuti...#module-shutil


Because even after 20 freaking years of evolution Python "heads of
state" (or states of head) cannot be bi-partisan enough to agree on a
freaking File and/or path object; remind you of any "body" we know?
 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      09-25-2011
On 9/23/2011 11:36 PM, Fletcher Johnson wrote:
> The topic says it all:
> Why is shutil named shutil? What does it stand for? This is just a
> mild curiosity of mine.
> The shutil module for reference: http://docs.python.org/library/shuti...#module-shutil


I think it would be nice if the doc explained. Feel free to open a doc
issue to add '(sh-ell util-ities)' or something after "The shutil " and
add me, terry.reedy, as nosy.

--
Terry Jan Reedy

 
Reply With Quote
 
Matt Joiner
Guest
Posts: n/a
 
      09-25-2011
Please continue

On Sun, Sep 25, 2011 at 8:36 AM, rantingrick <(E-Mail Removed)> wrote:
> On Sep 23, 10:36┬*pm, Fletcher Johnson <(E-Mail Removed)> wrote:
>> The topic says it all:
>> Why is shutil named shutil? What does it stand for? This is just a
>> mild curiosity of mine.
>> The shutil module for reference:http://docs.python.org/library/shuti...#module-shutil

>
> Because even after 20 freaking years of evolution Python "heads of
> state" (or states of head) cannot be bi-partisan enough to agree on a
> freaking File and/or path object; remind you of any "body" we know?
> --
> http://mail.python.org/mailman/listinfo/python-list
>

 
Reply With Quote
 
rantingrick
Guest
Posts: n/a
 
      09-25-2011
On Sep 24, 11:56*pm, Matt Joiner <(E-Mail Removed)> wrote:
> Please continue


Well specifically we should have a look over the Ruby API's of "File",
"Dir", and "IO". I don't believe we should copy them verbatim --as the
Ruby API is not Pythonic-- however, it may be a good starting point
for something that has been decades overdue within this community.

There was the rejected Path object from PEP 355:
http://www.python.org/dev/peps/pep-0355/

But it seems the "Anointed One" tossed the idea due to it's
"versatility" and it being a subclass of string... is he joking? o_O

First of all, what the hell is wrong with versatility Mr Van Rossum?
Where else would you put these methods? True it may be a large
collection, however, can YOU offer any suggestions as to where else we
would put them or are YOU just going to latch on to your prejudices of
path objects like your irrational fears of functional programming? Do
you remember the map and lambda fiasco?

We need you to get on board and push something through. When you hide
your head in the sand and imagine everything is "peachy cream" you
expose your backside for a swift kicking.

[References:]

Ruby File Object:
http://www.ruby-doc.org/core/classes/File.html

Ruby Dir Object:
http://ruby-doc.org/core/classes/Dir.html

Ruby IO Object:
http://www.ruby-doc.org/core/classes/IO.html
 
Reply With Quote
 
Devin Jeanpierre
Guest
Posts: n/a
 
      09-25-2011
> Well specifically we should have a look over the Ruby API's of "File",
> "Dir", and "IO". I don't believe we should copy them verbatim --as the
> Ruby API is not Pythonic-- however, it may be a good starting point
> for something that has been decades overdue within this community.


Perhaps you would be interested in one of the recent threads on Python-Ideas.

http://mail.python.org/pipermail/pyt...er/011559.html

Also please stop being abrasive and personally attacking other members
of the Python community.

Devin

On Sun, Sep 25, 2011 at 4:30 PM, rantingrick <(E-Mail Removed)> wrote:
> On Sep 24, 11:56┬*pm, Matt Joiner <(E-Mail Removed)> wrote:
>> Please continue

>
> Well specifically we should have a look over the Ruby API's of "File",
> "Dir", and "IO". I don't believe we should copy them verbatim --as the
> Ruby API is not Pythonic-- however, it may be a good starting point
> for something that has been decades overdue within this community.
>
> There was the rejected Path object from PEP 355:
> ┬* ┬*http://www.python.org/dev/peps/pep-0355/
>
> But it seems the "Anointed One" tossed the idea due to it's
> "versatility" and it being a subclass of string... is he joking? o_O
>
> First of all, what the hell is wrong with versatility Mr Van Rossum?
> Where else would you put these methods? True it may be a large
> collection, however, can YOU offer any suggestions as to where else we
> would put them or are YOU just going to latch on to your prejudices of
> path objects like your irrational fears of functional programming? Do
> you remember the map and lambda fiasco?
>
> We need you to get on board and push something through. When you hide
> your head in the sand and imagine everything is "peachy cream" you
> expose your backside for a swift kicking.
>
> [References:]
>
> Ruby File Object:
> ┬* ┬* http://www.ruby-doc.org/core/classes/File.html
>
> Ruby Dir Object:
> ┬* ┬*http://ruby-doc.org/core/classes/Dir.html
>
> Ruby IO Object:
> ┬* ┬*http://www.ruby-doc.org/core/classes/IO.html
> --
> http://mail.python.org/mailman/listinfo/python-list
>

 
Reply With Quote
 
rantingrick
Guest
Posts: n/a
 
      09-25-2011
Here is a *very* rough outline of my ideas. There are probably a few
mistakes in there. I've decided on three main main objects. A File
object, a Path object, and a Dir object.


## START ENLIGHTENMENT ##

class Path:
def __init__(self, path):
#
# Properties about the path:
drive => str
directory => str
filename => str
extension => str
uncshare[1]=> ???
#
# Mutations.
def coerce(self) => File or Dir
def normalize(self): => ip or Path? #normcase/normpath
def expand_user(self): => ip or Path?
def expand_vars(self): => ip or Path?
def absolute(self) => ip or Path? #realpath/abspath
def strip(self) => ip => remove one extension.
def chmod(self, mode) => None
def chown(self, uid, gid) => None [1]
def rename(self, newname) => None
def access(self, mode): => None #access
def chroot(self) => None
#
# Introspection.
def is_valid(self): # exists
def is_absolute(self): #isabs
def is_directory(self): #isdir
def is_file(self): #isfile
def is_link(self): #islnk
def is_mount(self): #ismount
def is_identical(self, other): #issamefile
def time_accessed(self): #atime
def time_modified(self): #mtime
def time_changed(self): #ctime
## def utime(self, times) => None
#
# Inspection.
def info_stat(self): #stat
def info_lstat(self): #lstat
def info_statvfs(self): #statvfs
#
# Extraction.
def basename(self): => str
#Do we need basename when properties exist?
def partition(self) => (drive, path, filename, extension)
#Do we need partition when properties exist?
def splitunc(self): ???
def splitall(self): ???
def relpathto(self, dest): => ???
def pathconf(self, name): #pathconfig
#
# Modifying operations on links
def link(self, newpath): ...
def symlink(self, newlink): ...
def readlink(self): ...
def readlinkabs(self): ...

class File:
def new(path)
(...All existing file methods here...)
#
# Mutate, Clone, Destroy.
def rename(self, newname) => ip or File?
def delete(self, overwrites=3) => None
def copy(self, dst) => File
def unlink(self) => None #
#
# Attribute mutation.
def update(self) => None #touch
def copy_mode(src) => None #copymode
def copy_stat(src) => None #copystat
def update_mode(dst) => None
def update_stat(dst) => None
#
# Other
def bytes(self): => int => 1292894
def size(self, fmtstr="{0:0.2f}") => str => "1.23 MB"
def backup(self) => filename.bak{count}


class Dir:
def new(path)
def open(path)
#
# Mutate, Clone, Destroy.
def delete(self, onerror=None): => None
def copy(self, dst, symlinks=True): => Dir
#
# Introspection.
def get_paths(self, pattern=None): [Path, Path, ...]
def get_dirs(self, pattern=None): => [Dir, Dir, ...]
def get_files(self, pattern=None): => [File, File, ...]
#
def walk_paths(self, pattern=None): itereach->PathObj
def walk_dirs(self, pattern=None): itereach->DirObj
def walk_files(self, pattern=None): itereach->FileObj
#
def match(self, pattern) => bool
def glob(self, pattern): => [Path, Path, ...]

#######################################
# Not sure what to do with these yet.
#######################################
def startfile(self)
# startfile should part of os anyway.

## END ENLIGHTENMENT ##

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why Error is derived from EnvironmentError in shutil.py? Peng Yu Python 4 11-12-2009 03:37 PM
shutil module (directory input) klia Python 0 01-27-2009 03:48 AM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
three times copy ctor called, one ctor called, why? Apricot C++ 4 04-16-2004 07:55 AM
shutil.move, permission denied, why ? StÚphane Ninin Python 8 04-08-2004 10:05 AM



Advertisments