[Tutor] Overloading + factoring

William Park parkw@better.net
Fri, 3 Dec 1999 10:52:48 -0500


On Thu, Dec 02, 1999 at 03:30:44PM -0300, FFlores wrote:
> A question about class methods:
> Can you overload the definition of a method,
> especially __init__?

Yes.  For example,

    class first:
	def __init__(self):
	    ...
    
    class second(first):	# inherits from the first class
	def __init__(self):	# this overrides the first one.
	    ...


> And something else, though it's not Python-related:
> is there a nice method for factoring numbers, calculating
> lcd, gcd, and/or a good library of such functions for rational
> numbers?

Not to my knowledge.  But, you could probably write one yourself.

--William Park