How to define multiple initializers for a class, with different arguments

Category: Python - Miscellaneous

Sometimes your class design warrants the definition of multiple construction methods for a class, such as rebuilding from a serialized form vs. normal internal construction with explicit parameters. This recipe gives an example of using class level methods to create such constructors. Date: 01 May, 2012


Extending

Homepage: http://code.activestate.com/recipes/223611-how-to-define-multiple-initializers-for-a-class-wi/?in=lang-python

Developer: Paul McGuire

License: Python License

Operating System: Windows

Add a Comment

all are required fields

     
What do you think of this resource?

Select Your Rate:

Votes:0

 

Related Scripts Download

This script demonstrates how to use the Boost -a Python library to extend Python by creating a new Python module written in C/C.

developer Developer: codesampler.com
license License: Freeware
operating systems Operating System: All


Extending 'context' with new methods in RSpec.

developer Developer: snippets.dzone.com
license License: Freeware
operating systems Operating System: Windows, Linux


Other developers can create widgets for the new dashboard using this plugin's API.

developer Developer: wordpress.org
license License: Artistic License, GNU General Public License (GPL)
operating systems Operating System: Windows, Linux, Mac OS, BSD, Solaris


A very slight modification on Tomer Filiba's original Proxy class to use a factory function instead of an instance to create an object proxy the first time it is required.

developer Developer: Cory Virok
license License: Python License
operating systems Operating System: Windows


This demo shows how you can create and manage your own custom plugins for extending functionality in your Python projects.

developer Developer: AJ. Mayorga
license License: Freeware
operating systems Operating System: Windows


itersubclasses(cls) returns a generator over all subclasses of cls, in depth first order.

developer Developer: Gabriel Genellina
license License: Freeware
operating systems Operating System: Windows


After looking at featurelist.

developer Developer: Stephen Chappell
license License: Freeware
operating systems Operating System: Windows


Problem:
You want to use urllib to fetch web pages.

developer Developer: Dmitri Fours
license License: Python License
operating systems Operating System: Windows


A lightweight method to access the field names from a database.

developer Developer: Jim Kraai
license License: Python License
operating systems Operating System: Windows