On Nov 9, 9:54 am, Boris Borcic <[EMAIL PROTECTED]> wrote:
> Yes this is the expected behavior. Both your getpath() functions return the
> current value of the single path variable at the time of invocation. Perhaps
> this would be the slightest bit clearer if subdir.iteritems() did not provide
>
On Nov 9, 9:49 am, Paul Hankin <[EMAIL PROTECTED]> wrote:
> It's behaving as defined though, and the usual work-around is to add a
> variable with a default value.
>
> class path(object):
> def __init__(self, **subdirs):
> for name, path in subdirs.iteritems():
> def getpat
[EMAIL PROTECTED] wrote:
> If I run the following code:
>
> class path(object):
> def __init__(self, **subdirs):
> for name, path in subdirs.iteritems():
> def getpath():
> return path
> setattr(self, name, getpath)
>
> export = path(
> one
On Nov 9, 2:32 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> If I run the following code:
>
> class path(object):
> def __init__(self, **subdirs):
> for name, path in subdirs.iteritems():
> def getpath():
> return path
> setattr(self, name,
If I run the following code:
class path(object):
def __init__(self, **subdirs):
for name, path in subdirs.iteritems():
def getpath():
return path
setattr(self, name, getpath)
export = path(
one = 'this is one',
two = 'this is two',
)
pr