On Mar 27, 10:08 pm, [EMAIL PROTECTED] (Alex Martelli) wrote:
>
> Forget all the naming silliness and use self.__class__.printOnce
> instead.
>
> Alex
I tried self.__class__.printOnce and that worked. Thanks for your
help.
--
http://mail.python.org/mailman/listinfo/python-list
The following code will print a message only once:
class PrintOnce:
printOnce = True
def __init__(self):
if PrintOnce.printOnce:
print 'Printing once.'
PrintOnce.printOnce = False
first = PrintOnce()
second = PrintOnc
R. Bernstein wrote:
> Perhaps what you are looking for is:
> python /usr/lib/python2.4/pdb.py Myprogram.py
I tried this and it did not work. pdb did not load the file so it
could be debugged.
--
http://mail.python.org/mailman/listinfo/python-list
peter wrote:
> I haven't tried to use pdb myself, but this looks fairly helpful ...
>
> http://www.ferg.org/papers/debugging_in_python.html
>
> good luck
>
> Peter
That link was indeed helpful. I was finally able to debug the program
--
http://mail.python.org/mailman/listinfo/python-list
I am trying to figure out how to use the pdb module to debug Python
programs, and I'm having difficulties. I am pretty familiar with GDB
which seems to be similar, however I cannot even get the Python
debugger to break into a program so I can step through it. I wrote a
simple program and below is
The following code:
numbers = [1, 2, 3]
for value in numbers:
value *= 2
print numbers
results in the following output:
[1, 2, 3]
The intent of the code was to produce this output:
[2, 4, 6]
What is the reason for the output produced?
What code should be used to obtain the desired outpu
I am trying to make a copy of a certain Python object using the
copy.copy() function. When I try to perform this operation I get an
error like the following:
copy.Error: un(shallow)copyable object of type ...
What factors determine whether an object can be copied?
--
http://mail.python.org/mai
I am a C++ developer with only a little experience using Python. I
want to create a Python class where by I can construct an instance from
that class based on one of two different object types.
For example, if I were programming in C++, I would do the something
like the following:
class MyClass