Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Re: [RFC/PATCH] New objects cpv, pv and version to be used instead of raw strings.
Date: Fri, 18 Jul 2008 22:59:06
Message-Id: 20080718225901.GA3533@hrair.metaweb.com
In Reply to: [gentoo-portage-dev] Re: [RFC/PATCH] New objects cpv, pv and version to be used instead of raw strings. by Ali Polatel
1 On Fri, Jul 18, 2008 at 04:56:54PM +0300, Ali Polatel wrote:
2 > René 'Necoro' Neumann yazmış:
3 > > On Fri, 18 Jul 2008 12:41:52 +0300, Ali Polatel <hawking@g.o> wrote:
4 > > > Hi,
5 > > > Attached patch adds objects cpv, pv and version to portage.versions. This
6 > > > is
7 > > > meant as a thin layer over functions vercmp(), pkgcmp(), pkgsplit() and
8 > > > catpkgsplit().
9 > > > Using these objects instead of the mentioned functions allows us to write
10 > > > cleaner code and remove deprecated stuff like:
11 > > > list.sort(pkgcmp)
12 > > > which won't exist in py3k.
13 > > >
14 > > > Please comment.
15 > >
16 > > Is there a reason, why you are using "__new__" instead of "__init__"?
17 >
18 > __new__ is about object creation and the __new__ methods of these
19 > objects create the objects from raw strings.
20 >
21 > __init__ is for initializing and customizing objects and that method
22 > is for application writers who want to customize these objects to suit
23 > their needs.
24
25 as you said, __new__ is about object creation- literally, allocation.
26 You're using it for initialization however.
27
28 Re: customization, customization isn't particularly possible anyways
29 with your extreme usage of __ to hide variables; rather unpythonic.
30 ~brian
31 --
32 gentoo-portage-dev@l.g.o mailing list