Gentoo Archives: gentoo-portage-dev

From: Ali Polatel <hawking@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] Re: [RFC/PATCH] New objects cpv, pv and version to be used instead of raw strings.
Date: Fri, 18 Jul 2008 14:54:21
Message-Id: 20080718135654.GA20263@trippin
In Reply to: Re: [gentoo-portage-dev] [RFC/PATCH] New objects cpv, pv and version to be used instead of raw strings. by "René 'Necoro' Neumann"
1 René 'Necoro' Neumann yazmış:
2 > On Fri, 18 Jul 2008 12:41:52 +0300, Ali Polatel <hawking@g.o> wrote:
3 > > Hi,
4 > > Attached patch adds objects cpv, pv and version to portage.versions. This
5 > > is
6 > > meant as a thin layer over functions vercmp(), pkgcmp(), pkgsplit() and
7 > > catpkgsplit().
8 > > Using these objects instead of the mentioned functions allows us to write
9 > > cleaner code and remove deprecated stuff like:
10 > > list.sort(pkgcmp)
11 > > which won't exist in py3k.
12 > >
13 > > Please comment.
14 >
15 > Is there a reason, why you are using "__new__" instead of "__init__"?
16
17 __new__ is about object creation and the __new__ methods of these
18 objects create the objects from raw strings.
19
20 __init__ is for initializing and customizing objects and that method
21 is for application writers who want to customize these objects to suit
22 their needs.
23
24 >
25 > Regards,
26 > René
27 >
28
29 --
30 Regards,
31 Ali Polatel

Replies