Re: Constructors...BIIIIG PROBLEM!



On Thu, Sep 1, 2011 at 3:04 AM, Michiel Overtoom <motoom@xxxxxxxxx> wrote:

On Sep 1, 2011, at 10:24, Hegedüs Ervin wrote:

On Thu, Sep 01, 2011 at 10:00:27AM +0200, Michiel Overtoom wrote:
Derive your class from object,

why's that better than just create a simple class, without
derive?

Amongst other things, fixes to the type system and the method resolution order.

http://docs.python.org/reference/datamodel.html#new-style-and-classic-classes
http://unspecified.wordpress.com/2010/11/18/pythons-new-classes-vs-old-classes/
http://www.cafepy.com/article/python_types_and_objects/python_types_and_objects.html
http://www.python.org/download/releases/2.2.3/descrintro/

That is for Python 2. For Python 3, old-style classes are gone, all
classes derive from object by default, and writing it explicitly is
merely good style for compatibility.
.



Relevant Pages

  • [Announce] Gnosis Utils 1.2.0
    ... NEW SUBPACKAGES ... generally useful for building/maintaining a Python source ... - attributes# List of (XML) attributes of o ... Fixes to gnosis.xml.indexer suggested by Uche Ogbuju. ...
    (comp.lang.python)
  • Re: Re:
    ... > Aren't namespaces basically the same as packages/modules in python? ... C++ templates are hack which has grown quite powerful ... > Optional static typing in python would be nice for this. ... But the type system doesn't know if an integer ...
    (comp.lang.python)
  • Re: A question to experienced Pythoneers
    ... the programming language in my opinion makes little sense. ... which will be imported by the main Python programm. ... start from scratch you risk losing these fixes and having to ...
    (comp.lang.python)
  • Re: Trying to understand Python objects
    ... everything you do with old-style classes can be done with ... You are also wrong about new-style classes being the "official" object ... new-style classes should be avoided in Python 2.2 because of the subtle ... "In many ways, it's a dull language, borrowing solid old concepts from ...
    (comp.lang.python)
  • [ANN] NumPy 0.9.6 released
    ... This post is to announce the release of NumPy 0.9.6 which fixes some important bugs and has several speed improvments. ... NumPy is a multi-dimensional array-package for Python that allows rapid high-level array computing with Python. ... full support in Python2.5 to very-large arrays on 64-bit systems. ...
    (comp.lang.python)