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/mailma
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
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,...,
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 proc
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
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
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-
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
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:/
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 otherwi
On Apr 6, 7:37 am, grkunt...@gmail.com 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
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 standalon
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)
P
On Apr 17, 10:42 am, Peter Otten <__pete...@web.de> 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):
> &
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 Myl
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
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
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 t
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 an
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 f
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, "logge
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]:
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
23 matches
Mail list logo