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
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
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
Bruno Desthuilliers wrote:
> meridian wrote:
> > Bruno Desthuilliers wrote:
> >
> >>def doIt(name=None):
> >> global gname
> >> if name is None:
> >>name = gname
> >> else:
> >>gname = name
> >>
> >
&
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 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