~ubuntu-branches/ubuntu/oneiric/python2.6/oneiric

« back to all changes in this revision

Viewing changes to Doc/library/functions.rst

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-08-07 20:03:08 UTC
  • mfrom: (10.1.27 sid)
  • Revision ID: james.westby@ubuntu.com-20100807200308-bwsyymoc4donr9a9
Tags: 2.6.6~rc1-1ubuntu1
* Merge with Debian; remaining changes:
  - Regenerate the control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
399
399
   iterable if function(item)]`` if function is not ``None`` and ``[item for item
400
400
   in iterable if item]`` if function is ``None``.
401
401
 
402
 
   See :func:`itertools.ifilterfalse` for the complementary function that returns
403
 
   elements of *iterable* for which *function* returns false.
 
402
   See :func:`itertools.ifilter` and :func:`itertools.ifilterfalse` for iterator
 
403
   versions of this function, including a variation that filters for elements
 
404
   where the *function* returns false.
404
405
 
405
406
 
406
407
.. function:: float([x])
863
864
 
864
865
   *fget* is a function for getting an attribute value, likewise *fset* is a
865
866
   function for setting, and *fdel* a function for del'ing, an attribute.  Typical
866
 
   use is to define a managed attribute x::
 
867
   use is to define a managed attribute ``x``::
867
868
 
868
869
      class C(object):
869
870
          def __init__(self):
877
878
              del self._x
878
879
          x = property(getx, setx, delx, "I'm the 'x' property.")
879
880
 
 
881
   If then *c* is an instance of *C*, ``c.x`` will invoke the getter,
 
882
   ``c.x = value`` will invoke the setter and ``del c.x`` the deleter.
 
883
 
880
884
   If given, *doc* will be the docstring of the property attribute. Otherwise, the
881
885
   property will copy *fget*'s docstring (if it exists).  This makes it possible to
882
886
   create read-only properties easily using :func:`property` as a :term:`decorator`::