the problem is in the return.
if you append a print statement to the class function
such as
print "number is ",number # (properly indented, of course)
you'll get 8
On May 12, 2007, at 5:11 PM, John Fouhy wrote:
> On 13/05/07, Marilyn Davis <[EMAIL PROTECTED]> wrote:
>> #!/usr/bin/env python
On 13/05/07, Marilyn Davis <[EMAIL PROTECTED]> wrote:
> #!/usr/bin/env python
> '''An Under10 class, just to fiddle with inheriting from int.'''
>
> class Under10(int):
>
> def __init__(self, number):
> number %= 10
> int.__init__(self, number)
Subclassing int and other types i
Hello Tutors,
I'm stumped. This silly bit of code doesn't work. I expect the
output to be 8, not 18. What am I missing?
#!/usr/bin/env python
'''An Under10 class, just to fiddle with inheriting from int.'''
class Under10(int):
def __init__(self, number):
number %= 10
int.
Alan Gilfoy wrote:
> Quoting Kent Johnson <[EMAIL PROTECTED]>:
>> - A debugger lets you step through the code and see how it behaves.
>> winpdb is a pretty nice GUI-based Python debugger and some Python
>> development tools have built-in debuggers.
>> http://www.digitalpeers.com/pythondebugger/
>
WAY too large a project I'm afraid. Yes, that would be the one which
would make me an 'expert' in Python ;)
Too bad there's just no time right now...
On 5/10/07, Bob Gailer <[EMAIL PROTECTED]> wrote:
> John Washakie wrote:
> > I have access to the source code.
> Did you tell us why you want to ke
"Kent Johnson" <[EMAIL PROTECTED]> wrote
> I'm not really sure what you expect this view to look like. I don't
> know
> of any tool that will let you dynamically watch a program as it
> executes.
Not particularly relevant but there are some commercial tools
that do this kind of thing, they are
Quoting Kent Johnson <[EMAIL PROTECTED]>:
> Alan Gilfoy wrote:
>> My programs often have long, detailed loops in them, and would like
>>to, as I'm executing the loop, view what part of the loop Python
>> is currently processing.
>>
>> Thus, if my program gets stuck in one part of the lo
adam urbas escreveu:
Hi,I just started python today and I would like a few pointers, if you don't mind. I tried
using a tutorial, but was only able to get the correct results for the most basic problems.
# Area calculation programprint “Welcome to the Area calculation program”print
“
Alan Gilfoy wrote:
> My programs often have long, detailed loops in them, and would like
> to, as I'm executing the loop, view what part of the loop Python is
> currently processing.
>
> Thus, if my program gets stuck in one part of the loop, I would see that.
> Thus, if one part of my loop is
Hi OkaMthembo,
Again, are you sure you need it? Have you done any benchmarking yet?
It looks like you have to run Psyco on 32 bit x86 architecture. That
may limit other parts of your system design that you want to speed up by
running on x86-64, for example. OTOH, it's easy to add/remove psyco (
2007/5/12, Alan Gilfoy <[EMAIL PROTECTED]>:
> How do you 'tell' Python to repeat a certain action X amount of times,
> and then stop.
>
> I could use a 'counter' (see below), but that seems kind of clunky.
>
>
>
> counter = 0
> example = True
> while example:
>
> print "Do something"
> co
On 5/12/07, Alan Gilfoy <[EMAIL PROTECTED]> wrote:
> How do you 'tell' Python to repeat a certain action X amount of times,
> and then stop.
>
> I could use a 'counter' (see below), but that seems kind of clunky.
>
>
>
> counter = 0
> example = True
> while example:
>
> print "Do something"
>
How do you 'tell' Python to repeat a certain action X amount of times,
and then stop.
I could use a 'counter' (see below), but that seems kind of clunky.
counter = 0
example = True
while example:
print "Do something"
counter += 1
if counter == 100:
example = False
__
My programs often have long, detailed loops in them, and would like
to, as I'm executing the loop, view what part of the loop Python is
currently processing.
Thus, if my program gets stuck in one part of the loop, I would see that.
Thus, if one part of my loop is never triggered, I would see t
Elizabeth Finn wrote:
> I need to read a file that is in binary format, and then convert some of
> the values into integer values. These values can range from 1 to 4 bytes.
>
> First question – is there an easy way to do this? I finally wrote my own
> little utility to handle multi-byte integer
"Bob Gailer" <[EMAIL PROTECTED]> wrote
>> print “Welcome to the Area calculation program”
>
> I guess you used a word processor to write the program,
And in case you missed Bob's point - don't do that!
Use a text editor like Notepad, or better still IDLE
or Pythonwin or any other editor designe
16 matches
Mail list logo