slices - handy summary

2006-12-13 Thread meridian
If, like me, you're always forgetting which way around your list/seq slices need to go then worry no more. Just put my handy "slice lookupper" (TM) ) on a (large!) PostIt beside your screen and, Hey Presto! no more tediously typing a 1-9 seq into your interpreter and then getting a slice just to ch

Re: I thought I'd 'got' globals but...

2006-07-07 Thread meridian
Thanks Bruno. Not only do you give solutions to my problem but also throw in great MVC tutorials too. You're a gent. I'm using controller -> A CherryPy app views -> Cheetah Templating for the html & data model -> mostly SQLite DB using pysqlite also Config It's only a desk-web app for single-user

Re: I thought I'd 'got' globals but...

2006-07-06 Thread meridian
You mentioned earlier that "Modifying globals from within a function is usually a very bad idea." Most of my app consists of functions or class/object functions, that's all I do in OOP. Did you mean that modifying globals from anywhere is bad? or globals are bad? or don't code using methods/funct

Re: I thought I'd 'got' globals but...

2006-07-06 Thread meridian
Bruno Desthuilliers wrote: > meridian wrote: > > Bruno Desthuilliers wrote: > > > >>def doIt(name=None): > >> global gname > >> if name is None: > >>name = gname > >> else: > >>gname = name > >> > > &

Re: I thought I'd 'got' globals but...

2006-07-06 Thread meridian
Bruno Desthuilliers wrote: > def doIt(name=None): > global gname > if name is None: > name = gname > else: > gname = name > Thanks Bruno, works a treat... -- http://mail.python.org/mailman/listinfo/python-list

I thought I'd 'got' globals but...

2006-07-06 Thread meridian
I thought I had 'got' globals but this one seems strange. I want my example function 'doIt' to use and optionally modify a module variable 'gname', so I declare 'global gname' in the function, but when modified it doesn't stay modified. gname = 'Sue' def doIt(name = gname): global gname gn