~ubuntu-branches/ubuntu/karmic/python3.0/karmic

« back to all changes in this revision

Viewing changes to Lib/numbers.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-02-16 17:18:23 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090216171823-1d5cm5qnnjvmnzzm
Tags: 3.0.1-0ubuntu1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
    If you just want to check if an argument x is a number, without
16
16
    caring what kind, use isinstance(x, Number).
17
17
    """
 
18
    __slots__ = ()
 
19
 
18
20
    # Concrete numeric types must provide their own hash implementation
19
21
    __hash__ = None
20
22
 
38
40
    type as described below.
39
41
    """
40
42
 
 
43
    __slots__ = ()
 
44
 
41
45
    @abstractmethod
42
46
    def __complex__(self):
43
47
        """Return a builtin complex instance. Called for complex(self)."""
152
156
    Real also provides defaults for the derived operations.
153
157
    """
154
158
 
 
159
    __slots__ = ()
 
160
 
155
161
    @abstractmethod
156
162
    def __float__(self):
157
163
        """Any Real can be converted to a native float object.
264
270
class Rational(Real):
265
271
    """.numerator and .denominator should be in lowest terms."""
266
272
 
 
273
    __slots__ = ()
 
274
 
267
275
    @abstractproperty
268
276
    def numerator(self):
269
277
        raise NotImplementedError
287
295
class Integral(Rational):
288
296
    """Integral adds a conversion to int and the bit-string operations."""
289
297
 
 
298
    __slots__ = ()
 
299
 
290
300
    @abstractmethod
291
301
    def __int__(self):
292
302
        """int(self)"""