FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Portage Developer

 
 
LinkBack Thread Tools
 
Old 07-18-2008, 10:59 PM
Brian Harring
 
Default New objects cpv, pv and version to be used instead of raw strings.

On Fri, Jul 18, 2008 at 04:56:54PM +0300, Ali Polatel wrote:
> René 'Necoro' Neumann yazmış:
> > On Fri, 18 Jul 2008 12:41:52 +0300, Ali Polatel <hawking@gentoo.org> wrote:
> > > Hi,
> > > Attached patch adds objects cpv, pv and version to portage.versions. This
> > > is
> > > meant as a thin layer over functions vercmp(), pkgcmp(), pkgsplit() and
> > > catpkgsplit().
> > > Using these objects instead of the mentioned functions allows us to write
> > > cleaner code and remove deprecated stuff like:
> > > list.sort(pkgcmp)
> > > which won't exist in py3k.
> > >
> > > Please comment.
> >
> > Is there a reason, why you are using "__new__" instead of "__init__"?
>
> __new__ is about object creation and the __new__ methods of these
> objects create the objects from raw strings.
>
> __init__ is for initializing and customizing objects and that method
> is for application writers who want to customize these objects to suit
> their needs.

as you said, __new__ is about object creation- literally, allocation.
You're using it for initialization however.

Re: customization, customization isn't particularly possible anyways
with your extreme usage of __ to hide variables; rather unpythonic.
~brian
--
gentoo-portage-dev@lists.gentoo.org mailing list
 

Thread Tools




All times are GMT. The time now is 11:55 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org