Home | Trees | Index | Help |
|
---|
Module pypol :: Class Unknown |
|
object
--+
|
Unknown
Provide a class representing a monomial unknown. It has only two attributes, degree and letter.
Example:>>> a = Unknown('x', 2) >>> a.letter 'x' >>> a.degree 2 >>> print a 2 x >>> a.eval(-2) 4 >>> a.newattribute = "test" Traceback (most recent call last): ... AttributeError: 'Unknown' object has no attribute 'newattribute'
Method Summary | |
---|---|
Build the unknown with two arguments, letter and degree (default is 1). | |
Check if two Unknown instances are equal. | |
Return a value that, passed to eval(), should return an Unknown instance equal to self. | |
Return the class instance in a human readable manner | |
Return the result of value^degree. | |
Return the degree of the unknown | |
Return the letter of the unknown | |
Check if the new degree is a valid integer | |
Check if letter is one and only one alphabetic char and assign it to self._letter | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value |
Property Summary | |
---|---|
degree : Integer representing unknown's degree | |
letter : String representing unknown's letter |
Class Variable Summary | |
---|---|
tuple |
__slots__ = ('letter', '_letter', 'degree', '_degree')
|
Method Details |
---|
__init__(self,
letter,
degree=1)
|
__eq__(self,
other)
|
__repr__(self)
|
__str__(self)
Return the class instance in a human readable manner
|
eval(self, value)Return the result of value^degree. Example:>>> a = Unknown('x', 2) >>> a.eval(-3) 9 >>> a.eval(2) 4 |
get_degree(self)Return the degree of the unknown |
get_letter(self)Return the letter of the unknown |
set_degree(self, degree)Check if the new degree is a valid integer |
set_letter(self, letter)Check if letter is one and only one alphabetic char and assign it to self._letter |
Property Details |
---|
degreeInteger representing unknown's degree
|
letterString representing unknown's letter
|
Class Variable Details |
---|
__slots__
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Fri Aug 10 15:00:04 2007 | http://epydoc.sf.net |