Is it possible (and wise) to extend the None-type ?

M.-A. Lemburg mal at egenix.com
Wed Nov 26 17:03:38 EST 2008


On 2008-11-26 18:55, Stef Mientki wrote:
> hello,
> 
> I've the idea that I always have a lot of useless code in my programs,
> like the next example.
> 
>  def _On_Menu_File_Open ( self, event = None ):
>    if event :
>     event.Skip ()
> 
> instead of
> 
>  def _On_Menu_File_Open ( self, event = None ):
>   event.Skip ()
> 
> So I would like to extend the None-type (if that's possible),
> with a dummy Skip() method.
> 
> Is it wise to do ?
> If not what are the disadvantages ?

This doesn't work. None is a Python singleton that cannot be
subclassed.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Nov 26 2008)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2008-11-12: Released mxODBC.Connect 0.9.3      http://python.egenix.com/

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611



More information about the Python-list mailing list