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