function argument dependent on another function argument?
I would like to do: def foo(self,x,y=self.a) where the default value for y=self.a. Since this is not possible, I wind up doing def foo(self,x,y=None) if not y: y=self.a but that seems kind of clumsy. Is there a better way to do this? Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
self-aware list of objects able to sense constituent member alterations?
I'm not sure this is possible, but I would like to have a list of objects A=[a,b,c,d,...,z] where, in the midst of a lot of processing I might do something like, A[0].do_something_which_changes_the_properties() which alter the properties of the object 'a'. The trick is that I would like A to be mysteriously aware that something about the object 'a' has changed so that when I revisit A, I will know that the other items in the list need to be refreshed to reflect the changes in A as a result of changing 'a'. Even better would be to automatically percolate the subsequent changes that resulted from altering 'a' for the rest of the items in the list. Naturally, all of these items are related in some parent-child fashion. that might be a lot to ask, however. Any advice appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Re: self-aware list of objects able to sense constituent member alterations?
On Jan 28, 9:16 am, koranthala wrote: > On Jan 28, 5:42 pm, koranthala wrote: > > > > > On Jan 28, 2:16 am, Reckoner wrote: > > > > I'm not sure this is possible, but I would like to have > > > a list of objects > > > > A=[a,b,c,d,...,z] > > > > where, in the midst of a lot of processing I might do something like, > > > > A[0].do_something_which_changes_the_properties() > > > > which alter the properties of the object 'a'. > > > > The trick is that I would like A to be mysteriously aware that > > > something about the object 'a' has changed so that when I revisit A, > > > I will know that the other items in the list need to be refreshed to > > > reflect the changes in A as a result of changing 'a'. > > > > Even better would be to automatically percolate the subsequent changes > > > that resulted from altering 'a' for the rest of the items in the list. > > > Naturally, all of these items are related in some parent-child > > > fashion. > > > > that might be a lot to ask, however. > > > > Any advice appreciated. > > > I think Python Cookbook has a recipe which deals with this. > > - 6.12 Checking an Instance for Any State Change. > > Were you able to get this? If not, let me know. I will try to type it > in here - (it is a big recipe, so not doing it now) Actually, I have the python cookbook, but cannot find the recipe you mention. maybe I have an older version? thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: self-aware list of objects able to sense constituent member alterations?
On Jan 27, 9:46 pm, Steven D'Aprano wrote: > On Tue, 27 Jan 2009 13:16:36 -0800, Reckoner wrote: > > I'm not sure this is possible, but I would like to have a list of > > objects > > > A=[a,b,c,d,...,z] > > > where, in the midst of a lot of processing I might do something like, > > > A[0].do_something_which_changes_the_properties() > > > which alter the properties of the object 'a'. > > > The trick is that I would like A to be mysteriously aware that something > > about the object 'a' has changed so that when I revisit A, I will know > > that the other items in the list need to be refreshed to reflect the > > changes in A as a result of changing 'a'. > > Can't be done if A is a built-in list, probably can't be done entirely > generically, but you can probably do it in a cooperative manner. > > class TaintList(list): > tainted = False > def taint(self): > self.tainted = True > def untaint(self): > self.tainted = False > > A = TaintList() > > import functools > def taint(parent): > def decorator(func): > @functools.wraps(func) > def f(*args, **kwargs): > parent.taint() > return func(*args, **kwargs) > return f > return decorator > > class TaintAwareThing(object): > def __init__(self): > self.attr = 0 > @taint(A) > def change_attribute(self, x): > self.attr = x > > >>> x = TaintAwareThing() > >>> y = TaintAwareThing() > >>> z = TaintAwareThing() > > >>> A.extend([x, y, z]) > >>> A.tainted > False > >>> x.change_attribute(5) > >>> A.tainted > > True > > Here is a second approach: create a proxy class TaintThing that wraps > whatever object you want, using delegation: > > class TaintThing(object): > parent = A > def __init__(self, obj): > self.__dict__['_proxy'] = obj > def __getattr__(self, attr): > return getattr(self._proxy, attr) > def __setattr__(self, attr, value): > setattr(self._proxy, attr, value) > self.parent.taint() > > Now change TaintList to automatically wrap anything stored in it: > > # untested > class TaintList(list): > def append(self, obj): > list.append(self, TaintThing(obj)) > # similar for __setitem__, extend, insert > > -- > Steven thanks for your reply. For the second case where > class TaintThing(object): > parent = A > def __init__(self, obj): > self.__dict__['_proxy'] = obj > def __getattr__(self, attr): > return getattr(self._proxy, attr) > def __setattr__(self, attr, value): > setattr(self._proxy, attr, value) > self.parent.taint() you have told it that parent is 'A'. Shouldn't that be passed to it somehow in the following: > # untested > class TaintList(list): > def append(self, obj): > list.append(self, TaintThing(obj)) > # similar for __setitem__, extend, insert I apologize. I am probably missing something. This is getting pretty advanced for me. Thanks again. -- http://mail.python.org/mailman/listinfo/python-list
Re: self-aware list of objects able to sense constituent member alterations?
On Jan 28, 10:17 pm, Peter Wang wrote:
> On Jan 27, 3:16 pm,Reckoner wrote:
>
>
>
> > I'm not sure this is possible, but I would like to have
> > a list of objects
>
> > A=[a,b,c,d,...,z]
>
> > where, in the midst of a lot of processing I might do something like,
>
> > A[0].do_something_which_changes_the_properties()
>
> > which alter the properties of the object 'a'.
>
> > The trick is that I would like A to be mysteriously aware that
> > something about the object 'a' has changed so that when I revisit A,
> > I will know that the other items in the list need to be refreshed to
> > reflect the changes in A as a result of changing 'a'.
>
> > Even better would be to automatically percolate the subsequent changes
> > that resulted from altering 'a' for the rest of the items in the list.
> > Naturally, all of these items are related in some parent-child
> > fashion.
>
> > that might be a lot to ask, however.
>
> > Any advice appreciated.
>
> You should really look at Enthought's Traits package. It does exactly
> what you are asking for, and much, much more. See:
>
> http://code.enthought.com/projects/traits/documentation.phphttp://code.enthought.com/projects/traits/examples.php
>
> Using Traits, you could do the following:
>
> from enthought.traits.api import *
> class Child(HasTraits):
> state = Enum("happy", "sad", "bawling")
>
> class Parent(HasTraits):
> child = Instance(Child)
>
> @on_trait_change('child.state')
> def handler(self):
> print "new child state:", self.child.state
>
> bob_jr = Child()
> bob = Parent(child = bob_jr)
>
> bob_jr.state = "sad"
> # This would result in bob.handler() being called
>
> (Disclosure: I work at Enthought and have been using Traits heavily
> for the last 4+ years.)
>
> -Peter
I haven't looked at Enthought in awhile. I want to avoid having to
installing the entire Enthought toolsuite, however. Would I have to
do that for Traits?
Thanks again.
--
http://mail.python.org/mailman/listinfo/python-list
Re: self-aware list of objects able to sense constituent member alterations?
On Jan 28, 9:49 am, koranthala wrote:
> On Jan 28, 10:39 pm,Reckoner wrote:
>
>
>
> > On Jan 28, 9:16 am, koranthala wrote:
>
> > > On Jan 28, 5:42 pm, koranthala wrote:
>
> > > > On Jan 28, 2:16 am,Reckoner wrote:
>
> > > > > I'm not sure this is possible, but I would like to have
> > > > > a list of objects
>
> > > > > A=[a,b,c,d,...,z]
>
> > > > > where, in the midst of a lot of processing I might do something like,
>
> > > > > A[0].do_something_which_changes_the_properties()
>
> > > > > which alter the properties of the object 'a'.
>
> > > > > The trick is that I would like A to be mysteriously aware that
> > > > > something about the object 'a' has changed so that when I revisit A,
> > > > > I will know that the other items in the list need to be refreshed to
> > > > > reflect the changes in A as a result of changing 'a'.
>
> > > > > Even better would be to automatically percolate the subsequent changes
> > > > > that resulted from altering 'a' for the rest of the items in the list.
> > > > > Naturally, all of these items are related in some parent-child
> > > > > fashion.
>
> > > > > that might be a lot to ask, however.
>
> > > > > Any advice appreciated.
>
> > > > I think Python Cookbook has a recipe which deals with this.
> > > > - 6.12 Checking an Instance for Any State Change.
>
> > > Were you able to get this? If not, let me know. I will try to type it
> > > in here - (it is a big recipe, so not doing it now)
>
> > Actually, I have the python cookbook, but cannot find the recipe you
> > mention. maybe I have an older version?
>
> > thanks.
>
> Mine is 2nd Edition.
for posterity's sake, here's the recipe in question:
import copy
class ChangeCheckerMixin(object):
containerItems = {dict: dict.iteritems, list: enumerate}
immutable = False
def snapshot(self):
''' create a "snapshot" of self's state -- like a shallow
copy, but
recursing over container types (not over general
instances:
instances must keep track of their own changes if
needed). '''
if self.immutable:
return
self._snapshot = self._copy_container(self.__dict__)
def makeImmutable(self):
''' the instance state can't change any more, set .immutable
'''
self.immutable = True
try:
del self._snapshot
except AttributeError:
pass
def _copy_container(self, container):
''' semi-shallow copy, recursing on container types only '''
new_container = copy.copy(container)
for k, v in self.containerItems[type(new_container)]
(new_container):
if type(v) in self.containerItems:
new_container[k] = self._copy_container(v)
elif hasattr(v, 'snapshot'):
v.snapshot( )
return new_container
def isChanged(self):
''' True if self's state is changed since the last snapshot
'''
if self.immutable:
return False
# remove snapshot from self.__dict__, put it back at the end
snap = self.__dict__.pop('_snapshot', None)
if snap is None:
return True
try:
return self._checkContainer(self.__dict__, snap)
finally:
self._snapshot = snap
def _checkContainer(self, container, snapshot):
''' return True if the container and its snapshot differ '''
if len(container) != len(snapshot):
return True
for k, v in self.containerItems[type(container)](container):
try:
ov = snapshot[k]
except LookupError:
return True
if self._checkItem(v, ov):
return True
return False
def _checkItem(self, newitem, olditem):
''' compare newitem and olditem. If they are containers, call
self._checkContainer recursively. If they're an instance
with
an 'isChanged' method, delegate to that method.
Otherwise,
return True if the items differ. '''
if type(newitem) != type(olditem):
return True
if type(newitem) in self.containerItems:
return self._checkContainer(newitem, olditem)
if newitem is olditem:
method_isChanged = getattr(newitem, 'isChanged', None)
tricky nested list unpacking problem
Hi, I have lists of the following type: [1,2,3,[5,6]] and I want to produce the following strings from this as '0-1-2-3-5' '0-1-2-3-6' That was easy enough. The problem is that these can be nested. For example: [1,2,3,[5,6],[7,8,9]] which should produce '0-1-2-3-5-7' '0-1-2-3-5-8' '0-1-2-3-5-9' '0-1-2-3-6-7' '0-1-2-3-6-8' '0-1-2-3-6-9' also, [1,2,3,[5,6],7,[9]] should produce '0-1-2-3-5-7-9' '0-1-2-3-6-7-9' obviously, these are nested loops over the lists. The problem is that I don't know ahead of time how many lists there are or how deep they go. In other words, you could have: [1,2,3,[5,6,[10, 11]],7,[9,[1, 2, 3, 4, 5 ]]] Any help appreciated. I've really been having trouble with this. I hope that made sense. -- http://mail.python.org/mailman/listinfo/python-list
Re: tricky nested list unpacking problem
On Dec 15, 1:28 pm, Arnaud Delobelle wrote:
> Reckoner writes:
> > Hi,
>
> > I have lists of the following type:
>
> > [1,2,3,[5,6]]
>
> > and I want to produce the following strings from this as
>
> > '0-1-2-3-5'
> > '0-1-2-3-6'
>
> > That was easy enough. The problem is that these can be nested. For
> > example:
>
> > [1,2,3,[5,6],[7,8,9]]
>
> > which should produce
>
> > '0-1-2-3-5-7'
> > '0-1-2-3-5-8'
> > '0-1-2-3-5-9'
> > '0-1-2-3-6-7'
> > '0-1-2-3-6-8'
> > '0-1-2-3-6-9'
>
> > also,
>
> > [1,2,3,[5,6],7,[9]]
>
> > should produce
>
> > '0-1-2-3-5-7-9'
> > '0-1-2-3-6-7-9'
>
> > obviously, these are nested loops over the lists. The problem is that
> > I don't know ahead of time how many lists there are or how deep they
> > go. In other words, you could have:
>
> > [1,2,3,[5,6,[10, 11]],7,[9,[1, 2, 3, 4, 5 ]]]
>
> IMHO the second level of nested lists is unnecessary as the same can be
> achieved with just one sublevel of list (unless they are to be
> interpreted in a way you have not explained). If you avoid this double
> nesting then the 'flatten()' function below is not necessary anymore.
>
>
>
> > Any help appreciated. I've really been having trouble with this.
>
> > I hope that made sense.
>
> Here is a not thought out solution:
>
> def flatten(lst):
> for x in lst:
> if isinstance(x, list):
> for y in flatten(x):
> yield y
> else:
> yield x
>
> def unpack(lst):
> stack, strings = [], []
> def rec():
> i = len(stack)
> if i == len(lst):
> strings.append('-'.join(map(str, stack)))
> elif isinstance(lst[i], list):
> for x in flatten(lst[i]):
> stack.append(x)
> rec()
> stack.pop()
> else:
> stack.append(lst[i])
> rec()
> rec()
> return strings
>
> l1 = [1,2,3,[5,6]]
> l2 = [1,2,3,[5,6],[7,8,9]]
> l3 = [1,2,3,[5,6,[10, 11]],7,[9,[1, 2, 3, 4, 5 ]]]
>
> Then:
>
> >>> unpack(l1)
>
> ['1-2-3-5', '1-2-3-6']>>> unpack(l2)
>
> ['1-2-3-5-7', '1-2-3-5-8', '1-2-3-5-9', '1-2-3-6-7', '1-2-3-6-8',
> '1-2-3-6-9']>>> unpack(l3)
>
> ['1-2-3-5-7-9', '1-2-3-5-7-1', '1-2-3-5-7-2', '1-2-3-5-7-3',
> '1-2-3-5-7-4', '1-2-3-5-7-5', '1-2-3-5-6-9', '1-2-3-5-6-1',
> '1-2-3-5-6-2', '1-2-3-5-6-3', '1-2-3-5-6-4', '1-2-3-5-6-5',
> '1-2-3-5-10-9', '1-2-3-5-10-1', '1-2-3-5-10-2', '1-2-3-5-10-3',
> '1-2-3-5-10-4', '1-2-3-5-10-5', '1-2-3-5-11-9', '1-2-3-5-11-1',
> '1-2-3-5-11-2', '1-2-3-5-11-3', '1-2-3-5-11-4', '1-2-3-5-11-5']
>
> --
> Arnaud
Thanks for your detailed reply. I will have to ponder your solution
carefully.
--
http://mail.python.org/mailman/listinfo/python-list
from package import * without overwriting similarly named functions?
I have multiple packages that have many of the same function names. Is it possible to do from package1 import * from package2 import * without overwriting similarly named objects from package1 with material in package2? How about a way to do this that at least gives a warning? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
big objects and avoiding deepcopy?
I am writing an algorithm that takes objects (i.e. graphs with thousands of nodes) into a "hypothetical" state. I need to keep a history of these hypothetical objects depending on what happens to them later. Note that these hypothetical objects are intimately operated on, changed, and made otherwise significantly different from the objects they were copied from. I've been using deepcopy to push the objects into the hypothetical state where I operate on them heavily. This is pretty slow since the objects are very large. Is there another way to do this without resorting to deepcopy? by the way, the algorithm works fine. It's just this part of it that I am trying to change. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Q: "Best" book for teaching
On Apr 6, 7:37 am, [email protected] wrote: > I am considering teaching an "introduction to programming" course for > continuing education adults at a local community college. These would > people with no programming experience, but I will require a reasonable > facility with computers. > > What would be a good book to use as the text for the course? > > Thanks. QuickPython is pretty good, but might be somewhat above the level you're looking for. Depends on the class. You might want to use it to guide a selection of topics. -- http://mail.python.org/mailman/listinfo/python-list
object knows which object called it?
hi, I have the following problem: I have two objects, say, A and B, which are both legitimate stand-alone objects with lives of their own. A contains B as a property, so I often do A.B.foo() the problem is that some functions inside of B actually need A (remember I said they were both standalone objects), so I have to often do: A.B.foo_func(A) Which is kind of awkward. Is there some way that B.foo_func() could somehow know that it was called as a property of A in this way? Note that I'm looking for the calling object and NOT the calling function. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
cPickle and subclassing lists?
I have a large class that is a child of list. I need to pickle it, but it's not working. For example, I have reduced it to the following: class Mylist(list): def __init__(self,x=[]): list.__init__(self,x) and I cannot even get this to pickle right. >> w=Mylist([1,2,3]) >> dumps(w) PicklingError: Can't pickle : attribute lookup __main__.p fa iled I'm using python 2.5 on win32. any help appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Re: cPickle and subclassing lists?
On Apr 17, 10:42 am, Peter Otten <[email protected]> wrote: > Reckoner wrote: > > I have a large class that is a child of list. I need to pickle it, but > > it's not working. For example, I have reduced it to the following: > > > class Mylist(list): > > def __init__(self,x=[]): > > list.__init__(self,x) > > > and I cannot even get this to pickle right. > > >>> w=Mylist([1,2,3]) > >>> dumps(w) > > > PicklingError: Can't pickle : attribute lookup > > __main__.p fa > > iled > > > I'm using python 2.5 on win32. > > > any help appreciated. > > This error occurs when you try to pickle a class that cannot be found by its > name: > > >>> from cPickle import dumps > >>> class p: pass > ... > >>> a = p > >>> del p > >>> dumps(a) > > Traceback (most recent call last): > File "", line 1, in > cPickle.PicklingError: Can't pickle __main__.p: attribute lookup __main__.p > failed > > I don't see how this error could be triggered by the code you give above. > Please try it again in a fresh interpreter. > > Peter sorry. here it is: PicklingError: Can't pickle : attribute lookup __main__.Mylist failed -- http://mail.python.org/mailman/listinfo/python-list
Re: cPickle and subclassing lists?
On Apr 17, 11:16 am, Piet van Oostrum wrote: > >>>>> Reckoner (R) wrote: > >R> I have a large class that is a child of list. I need to pickle it, but > >R> it's not working. For example, I have reduced it to the following: > >R> class Mylist(list): > >R> def __init__(self,x=[]): > >R> list.__init__(self,x) > >R> and I cannot even get this to pickle right. > >>>> w=Mylist([1,2,3]) > >>>> dumps(w) > >R> PicklingError: Can't pickle : attribute lookup > >R> __main__.p fa > >R> iled > > Where does the 'p' come from? > What is w.__class__ ? > > >R> I'm using python 2.5 on win32. > > No problem with 2.6.2 on Mac OS X. > -- > Piet van Oostrum > URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4] > Private email: [email protected] Thanks for all the great feedback. This turns out to be a problem with the IPython interpreter, and not a Python problem. sorry for the confusion. -- http://mail.python.org/mailman/listinfo/python-list
access variables from one Python session to another on the same machine?
Suppose I have two different command windows going on the same machine, each running their own Python interpreters. Is it possible to access the variables in one of the interpreter- sessions from the other? It turns out I have limited control over one of the sessions (i.e. cannot control all the code that is run from there), but complete control over the other. I get the feeling this has been asked before, but I'm not sure how to pose the question in such a way that it would show up on a search. It's confusing. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: access variables from one Python session to another on the same machine?
On Jun 9, 5:23 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > > Suppose I have two different command windows going on the same > > machine, each running their own Python interpreters. > > > Is it possible to access the variables in one of the interpreter- > > sessions from the other? > > > It turns out I have limited control over one of the sessions (i.e. > > cannot control all the code that is run from there), but complete > > control over the other. > > > I get the feeling this has been asked before, but I'm not sure how to > > pose the question in such a way that it would show up on a search. > > It's confusing. > > Depending on what 'limited control' means, the simplest choice would > be writing stuff to a plain text file from the master and reading it > from the slave. This may or may not work depending on your environment > though. > > Cheers, > Daniel > -- > Psss, psss, put it down! -http://www.cafepress.com/putitdown This disk-writing approach seems to be simplest & less intrusive. Thanks! I'll try it. -- http://mail.python.org/mailman/listinfo/python-list
use object method without initializing object
would it be possible to use one of an object's methods without initializing the object? In other words, if I have: class Test: def __init__(self): print 'init' def foo(self): print 'foo' and I want to use the foo function without hitting the initialize constructor function. Is this possible? -- http://mail.python.org/mailman/listinfo/python-list
Ignore leading '>>>' and ellipsis?
Hi, I am studying some examples in a tutorial where there are a lot of leading >>> characters and ellipsis in the text. This makes it hard to cut and paste into the IPython interpreter since it doesn't like these strings. Is there another interpreter I could use that will appropriately ignore and interpret these leading terms? For example, I cannot paste the following directly into the interpreter: >>> d = dict(x.__array_interface__) >>> d['shape'] = (3, 2, 5) >>> d['strides'] = (20, 20, 4) >>> class Arr: ... __array_interface__ = d ... base = x -- http://mail.python.org/mailman/listinfo/python-list
Using logging module for conditional nested logs
Hi,
I am getting started with your logging module and I went through the
tutorial and know-how to create a top-level 'root' logger with the
appropriate handlers.
I have a number of functions,say,
def foo1()
def foo2()
...
foo1() # foo2 calls foo1
and I know how to connect each of these functions to the 'root' logger
by doing something like
def foo1()
logger = getLogger('root.foo1')
but I want to arrange it so that foo1 adds to the logfile that foo2 is
using ONLY when foo2 calls foo1. In other words, if I do
def foo2()
logger = getLogger('root.foo2')
or
def foo1()
logger = getLogger('root.foo2.foo1')
it responds to the 'root' logger when I want it to respond to *any*
logger that is attached to foo2.
Then, the question is how can I set up foo1 to log to whatever logger
foo2 is using. The purpose of doing this is that I am interested in
capturing when and by whom foo1 is called in whatever logger foo2 is
using. So, if I attach a separate logger to a third function, say, foo3
(), then I can avoid reporting those instances when foo3 calls foo1.
I hope that made some sense.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Using logging module for conditional nested logs
On Nov 4, 1:30 pm, Vinay Sajip wrote: > On Nov 4, 7:40 pm, Reckoner wrote: > > > > > I hope that made some sense. > > Not especially :-( > > Sorry I don't understand exactly what you mean, because I find your > terminology confusing. For example, "logger that is attached to foo2" > - loggers are not attached to functions. "It responds to the 'root' > logger" - what responds? What's meant by "respond"? > > Loggers correspond to specific code components in an application. > Normally these areas are modules and sometimes they're classes. > > You can certainly treat functions as areas but this will typically > become unwieldy in any sizeable application. It doesn't (in general) > make sense to have a specific logger for foo1 for use only when it's > called by foo2. These seem like anti-patterns to me. > > Handlers are attached to loggers to make events logged via those > loggers available to different audiences - via console, file, email > etc. > > If you want to log that foo1 is being called by foo2, you can do this. > For example, you could have a utility function which walks (a > sufficient part of) the call stack to see the function call hierarchy, > then log this as additional information (e.g. using the 'extra' > parameter to the logging call). You can attach Filters to loggers and > handlers which use this information to decide where and whether to > actually record the event. > > As well as the Python logging documentation, you may also find the > following link useful: > > http://plumberjack.blogspot.com/2009/09/python-logging-101.html > > Regards, > > Vinay Sajip I appreciate your patience, as I am new to this. Your comments have put me on the right track. I will look at the link you specify. Thanks again. -- http://mail.python.org/mailman/listinfo/python-list
initializing with empty list as default causes freaky problems
Hi, Observe the following: In [202]: class Foo(): .: def __init__(self,h=[]): .: self.h=h .: .: In [203]: f=Foo() In [204]: g=Foo() In [205]: g.h Out[205]: [] In [206]: f.h Out[206]: [] In [207]: f.h.append(10) In [208]: f.h Out[208]: [10] In [209]: g.h Out[209]: [10] The question is: why is g.h updated when I append to f.h? Shouldn't g.h stay []? What am I missing here? I'm using Python 2.5.1. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
quick script to read digital terrain elevation data?
I'm running python 2.3 on Windows XP. Anyone have a quick small script to convert .DT1 and .DEM data to ASCII or some other format? I don't need a viewer. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
