[Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Jorge Godoy
Xif <[EMAIL PROTECTED]> writes: > Ok, so keeping getCells() as an external function makes sense. > > But where exactly do you recommend I'd put it? > > In a seperate module, like I currently do, even though it's going to be the > only piece of code contained inside that module? I don't see any

Re: [Tutor] IDEs

2005-09-14 Thread Jorge Godoy
on her nipples... ;-) -- Jorge Godoy <[EMAIL PROTECTED]> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Johan Geldenhuys <[EMAIL PROTECTED]> writes: > What is the syntax if I want to work out what percentage 42 is out of 250? If you want it as a factor to multiply / divide by something: perc = 42/250 If you want it to "read" as percentage: perc_100 = (42/250)*100 S

Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
b = 250 >>> a / b 0 >>> float(a)/b 0.16801 >>> One of the members has to be a floating point so that floating point division is performed instead of integer division. Be seeing you, -- Jorge Godoy <[EMAIL PROTECTED]> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
future__ import division >>> 42 / 250 0.16801 >>> Be seeing you, -- Jorge Godoy <[EMAIL PROTECTED]> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Pujo Aji <[EMAIL PROTECTED]> writes: > don't forget to use dot or converge into float. Or import division from __future__. >>> from __future__ import division >>> 42 / 250 0.16801 >>> -- Jorge Godoy <[EMAIL PROTECTED]> __

Re: [Tutor] Percentage

2005-11-08 Thread Jorge Godoy
>> b = "%.2f" % a >>> b '16.80' >>> float(b) 16.801 >>> str(float(b)) '16.8' >>> (The reason for the '0001' is because of the numeric base used to represent data -- binary --

Re: [Tutor] Unit testing

2006-06-26 Thread Jorge Godoy
queues with some data in the unit test? >From JMock's page you get to mockobject's page and from there there's a link to Python-mock. http://sourceforge.net/projects/python-mock I hope it helps. -- Jorge Godoy <[EMAIL PROTECTED]> "Quidquid latine dictu