Re: How to make command history persistent?

2005-10-18 Thread pclinch

If using unix, you should have readline available.
See the tutotial appendix:-

http://www.python.org/doc/current/tut/node15.html

Regards, Paul Clinch

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Doc Error: os.makedirs

2005-10-19 Thread pclinch
if os.access( path, os.F_OK):
  print 'path exists'

See also os.stat(path) for further info. about a file or dir.

regards, Paul Clinch

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: path

2005-10-19 Thread pclinch

The python help function does not use python23.chm, which is a windows
only help file. You must open it from a menu item or the desktop
explorer. It does contain an entry for "and".

Other platforms usually have documentation in html format, which is why
you get a confusing error message.

Regards, Paul Clinch

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Class attributes newbie question (before I join a cargocult)

2006-03-12 Thread pclinch

EP wrote:
> Hi,
>
> This is likely a stupid question, but I am confused about what is going
> on with class attributes as far as whether they "stick".  I ran across
> this in a program I am writing, but have reproduced the behavoir below
> - can someone point me in the right direction (thanks):
>
> class AttStickiness(object):
> def __init__(self, myname="", mysex=""):
> self.name=myname
> self.sex=mysex
>
> def changeSex(self, newsex=""):
> self.mysex=newsex
> return self.mysex
>

You might want self.sex = newsex and return self.sex here.

See __slots__ and PyChecker for possible ways to avoid misspelled
instance variables.

> def changeName(self, newname=""):
> self.name=newname
> return self.name
>
> def whoAmI(self):
> return self.name, self. sex
>
> >>> me=AttStickiness("Eric","Male")
>
> >>> me.whoAmI()
> ('Eric', 'Male')
>
> >>> me.changeName("Jimbo")
> 'Jimbo'
>
> >>> me.whoAmI()
> ('Jimbo', 'Male')
>
> >>> me.changeSex("female")
> 'female'
>
> >>> me.whoAmI()
> ('Jimbo', 'Male')
>
>
> [while it is comforting to know my sex isn't so easily changed, this
> has confounded me in real code]
> 
> thx,
> 
> Eric

Regards, Paul

-- 
http://mail.python.org/mailman/listinfo/python-list