From arigo at tunes.org Sun Jan 1 13:48:32 2006 From: arigo at tunes.org (Armin Rigo) Date: Sun, 1 Jan 2006 13:48:32 +0100 Subject: [pypy-dev] Thread/gil/java question In-Reply-To: <43B4759A.4020308@stackless.com> References: <716621DCB4468F46BBCC1BCFBED45C120129DA70@XCH-NW-2V2.nw.nos.boeing.com> <43B4759A.4020308@stackless.com> Message-ID: <20060101124832.GB18474@code1.codespeak.net> Hi, On Fri, Dec 30, 2005 at 12:47:38AM +0100, Christian Tismer wrote: > you already got a very good answer, since you happened to hit > the former maintainer of Jython. Christian's answer is a bit too harsh IMHO. I don't think we should try to keep open discussions off pypy-dev, at least as long as they don't become long threads where every answer is just uninformed guesses and wild speculations building on each other. I don't see pypy-dev in danger of becoming that at the moment. > >Thank you for the quick response. Let me get this straight: If I use > >Jython instead of CPython, then my Python threads can migrate to > >different CPUs? Yes. > >Not sure what you meant by "... granularity is such that not much could > >be assumed for user programs..."--could you clarify that a bit? In CPython, if say 'd' is a dict, then 'd.setdefault(x,y)' is atomic, so the result cannot be messed up by another thread accessing 'd' at the same time. In Java you don't have complex operations, so you (or a Java library) would have to write code like: if (d.hasKey(x)) { return d.get(x); } else { d.set(x, y); return y; } Because this is user Java code, in a multithreaded program you need explicit locks around it. The "granularity" of Java is finer than Python, so even if individual Java operations (e.g. hasKey(), possibly) are atomic, no higher-level operation is intrinsically atomic. In Jython, all dict methods lock the dict (and similarily for all standard types), which gives the Python program again the illusion that the methods are atomic. A bientot, Armin. From arigo at tunes.org Mon Jan 2 13:01:16 2006 From: arigo at tunes.org (Armin Rigo) Date: Mon, 2 Jan 2006 13:01:16 +0100 Subject: [pypy-dev] Chalmers Winter Meeting paper Message-ID: <20060102120116.GA4621@code1.codespeak.net> Hi all, For the Winter Meeting of the Chalmers technical university of Gothenburg, I've taken the architecture.txt document again, copied from its CCC version. I'll submit it tomorrow. It's checked in in http://codespeak.net/svn/pypy/extradoc/talk/chalmers . I had to decide how to attribute authors properly, which of course is not a trivial task. I've settled for putting only my own name under the title (as the presenter of the paper), with a footnote that lists all svn authors that have done non-trivial changes to architecture.txt. It sounds more reasonable than listing all the authors directly under the title -- that would take half the first page! Does this sound acceptable to everybody? A bientot, Armin From cfbolz at gmx.de Mon Jan 2 17:19:17 2006 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Mon, 2 Jan 2006 17:19:17 +0100 (MET) Subject: [pypy-dev] Chalmers Winter Meeting paper References: <20060102120116.GA4621@code1.codespeak.net> Message-ID: <13987.1136218757@www42.gmx.net> Hi Armin! Armin Rigo wrote: > I had to decide how to attribute authors properly, which of course is > not a trivial task. I've settled for putting only my own name under the > title (as the presenter of the paper), with a footnote that lists all > svn authors that have done non-trivial changes to architecture.txt. It > sounds more reasonable than listing all the authors directly under the > title -- that would take half the first page! Does this sound > acceptable to everybody? Makes sense to me (and it basically follows what we did with the CCC paper). Happy new year! Carl Friedrich From hpk at trillke.net Mon Jan 2 17:25:44 2006 From: hpk at trillke.net (holger krekel) Date: Mon, 2 Jan 2006 17:25:44 +0100 Subject: [pypy-dev] Chalmers Winter Meeting paper In-Reply-To: <13987.1136218757@www42.gmx.net> References: <20060102120116.GA4621@code1.codespeak.net> <13987.1136218757@www42.gmx.net> Message-ID: <20060102162544.GC4570@solar.trillke.net> Hi Armin, hi Carl, On Mon, Jan 02, 2006 at 17:19 +0100, Carl Friedrich Bolz wrote: > Armin Rigo wrote: > > I had to decide how to attribute authors properly, which of course is > > not a trivial task. I've settled for putting only my own name under the > > title (as the presenter of the paper), with a footnote that lists all > > svn authors that have done non-trivial changes to architecture.txt. It > > sounds more reasonable than listing all the authors directly under the > > title -- that would take half the first page! Does this sound > > acceptable to everybody? > > Makes sense to me (and it basically follows what we did with the CCC paper). same here. > Happy new year! happy new year! holger From cfbolz at gmx.de Tue Jan 3 17:12:15 2006 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Tue, 3 Jan 2006 17:12:15 +0100 (MET) Subject: [pypy-dev] pypy and the singularity Message-ID: <26858.1136304735@www81.gmx.net> Hi all! Sorry, just had to post this: Hans Nowak wrote on comp.lang.python: > Robert Kern wrote: >> PyPy will not bring about the Singularity. > But if it did, imagine how cool that would look on the developers > resumes... :-) :-) Cheers, Carl Friedrich From eric at vanrietpaap.nl Wed Jan 4 14:29:55 2006 From: eric at vanrietpaap.nl (Eric van Riet Paap) Date: Wed, 4 Jan 2006 14:29:55 +0100 Subject: [pypy-dev] pypy-sync announcement Message-ID: <812956A3-189E-4F84-9738-BFD98F25DCAB@vanrietpaap.nl> Hello, For tomorrow's #pypy-sync meeting at the regular time of 1PM we need someone to moderate. I will probably not be able to do it this time. Who wants to volunteer? cheers Eric From pedronis at strakt.com Wed Jan 4 14:38:48 2006 From: pedronis at strakt.com (Samuele Pedroni) Date: Wed, 04 Jan 2006 14:38:48 +0100 Subject: [pypy-dev] pypy-sync announcement In-Reply-To: <812956A3-189E-4F84-9738-BFD98F25DCAB@vanrietpaap.nl> References: <812956A3-189E-4F84-9738-BFD98F25DCAB@vanrietpaap.nl> Message-ID: <43BBCFE8.5070000@strakt.com> Eric van Riet Paap wrote: > Hello, > > For tomorrow's #pypy-sync meeting at the regular time of 1PM we need > someone to moderate. I will probably not be able to do it this time. > Who wants to volunteer? > I can do it. From hpk at trillke.net Wed Jan 4 20:47:56 2006 From: hpk at trillke.net (holger krekel) Date: Wed, 4 Jan 2006 20:47:56 +0100 Subject: [pypy-dev] impressions from CCC congress last week Message-ID: <20060104194756.GC21452@solar.trillke.net> Hey there, here are some impressions from the Chaos Communication Congress in Berlin end last year (a few days ago). It again was a rather wild session of some 3000 hackers from various areas ... with higher broadband connectivity than the whole of Africa (10 Gbit) i heart. Only 1Gbit was actually used, though, including free VOIP-phoning to all of germany. This year i didn't attend so many talks also because they regularly lasted 1 hour - usually too much - but hardly enough for our current PyPy talks :) Carl and me had some 350 listeners. It was a rather concentrated and nice atmosphere - despite our JIT preparation style. We had one guy from the Dylan group (Andreas Bogk) who involved Carl and me in a number of discussions where i wished that Samuele had been there :) The other talk about "EU-funding, Open Source and Agility" with Bea went very well and also brought some new contacts, among them a press guy who wants to report about PyPy on a suitable occassion. There apparently was some article about PyPy in a Linux magazine in November or December, btw, somebody told me. The two PyPy talks were filmed and we can probably provide mpeg's somewhere if there is interest. Also the 22C3 organisers themselves want to provide films+sounds from many talks, i think. What else? For example, "How to get a free parking license for Europe including all areas nobody is usually allowed to park on" - for purposes of "measuring networks". The successful solution is actually quite pythonic and was presented in a 5 minute lightning talk. Or how to use google maps to discover military airbases and nuclear power plants including number of trucks, airplane types and position and whatnot. Or on how to use Google to find lots of mp3's or other interesting content left by people in their public_html directories ... All easy stuff but with impressive results :) As always, the "trifinite" group and friends presented new ways to remote-control many of today's mobile phones, including complete surveilance and calling/SMSing on the owner's behalf etc. They had done that two years ago already when they analyzed the situation within the British Parliament ... but it seems the issues keep popping up. There are really many "interesting" examples of what you can do with control over mobile phones ... i find a funny one letting everyone in a tube station ring up their neighbour ... should feel a bit like being in the matrix. Some guys from Austria demonstrated a hack surveilling surveillance cameras and thus presenting the focus of police activities: randomly scanning around at windows to glimpse into rooms ... Carl and Bea went to more talks than me so they might have some funny ones to add. We also met Bert and Michael from Impara who are doing Smalltalk/Squeak stuff and some PyPy glue experiments. Christian was often around as well as was Stephan Diel and Boris Feigin, earlier PyPy sprint attenders. Nice chatting. All in all, this chaos communication conference is quite a rush and it is impossible to catch everything - so it's often a good idea to hang around in the large cafeteria area with some music and arts going on. Or to step outside into a snowy Berlin to breath different air ... cheers, holger From cfbolz at gmx.de Thu Jan 5 23:55:14 2006 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Thu, 05 Jan 2006 23:55:14 +0100 Subject: [pypy-dev] EU reports Message-ID: <43BDA3D2.4020906@gmx.de> Hi PyPy-dev! I just checked in a new doc page containing short descriptions and links of/to the preliminary EU reports. The page is at: http://codespeak.net/pypy/dist/pypy/doc/index-report.html These reports (for all the people that did not help prepare them :-) ) contain big parts of our documentation but also quite a lot of new interesting content that supplements the regular Python documentation. Also: should I add a news item to make the reports more visible than just the links to it in the documentation index page? Cheers, Carl Friedrich From pedronis at strakt.com Fri Jan 6 00:03:20 2006 From: pedronis at strakt.com (Samuele Pedroni) Date: Fri, 06 Jan 2006 00:03:20 +0100 Subject: [pypy-dev] EU reports In-Reply-To: <43BDA3D2.4020906@gmx.de> References: <43BDA3D2.4020906@gmx.de> Message-ID: <43BDA5B8.4010704@strakt.com> Carl Friedrich Bolz wrote: > Hi PyPy-dev! > > I just checked in a new doc page containing short descriptions and links > of/to the preliminary EU reports. The page is at: > > http://codespeak.net/pypy/dist/pypy/doc/index-report.html > > These reports (for all the people that did not help prepare them :-) ) > contain big parts of our documentation but also quite a lot of new > interesting content that supplements the regular Python documentation. s/the regular Python/the regular PyPy > > Also: should I add a news item to make the reports more visible than > just the links to it in the documentation index page? > > Cheers, > > Carl Friedrich > _______________________________________________ > pypy-dev at codespeak.net > http://codespeak.net/mailman/listinfo/pypy-dev From mwh at python.net Fri Jan 6 12:15:18 2006 From: mwh at python.net (Michael Hudson) Date: Fri, 06 Jan 2006 11:15:18 +0000 Subject: [pypy-dev] Re: OCSCON 2006 in Portland again, paper deadline Feb 13 References: <200512291447.jBTEleJC023145@theraft.strakt.com> <200512292331.jBTNVK4u009403@theraft.strakt.com> Message-ID: <2mr77lzjy1.fsf@starship.python.net> Beatrice During writes: > Hi there > > On Fri, 30 Dec 2005, Laura Creighton wrote: > >> In a message of Fri, 30 Dec 2005 00:16:09 +0100, Beatrice During writes: >>> Hi there >>> >>> We have such a calendar on codespeak - Michael have informed about it on >>> pypy-funding. You can find it: >>> >>> http://codespeak.net/pypy/dist/pypy/doc/contact.html >>> >>> or directly at: >>> >>> http://pypycal.sabi.net/. >> >> >> What program is this? how to add a new entry ... ie OSCON ... is >> not obvious for this bear of very little brain. What doc need I >> read? I still think a nice link on codespeak would make sense >> rather than having to store a bookmark, which will only work on >> a machine where you have stored things ... There *is* a link on codespeak!! > We do have a link from codespeak - from the contact page. > Unfortunately Michael is currently the only one who can update so best > thing is to email him - or he sees this ;-) > > He is usually very vigilant in this - but maybe not now because > he is hopefully enjoying his vacation ;-) I've added OSCON and FOSDEM now. Cheers, mwh -- The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence. -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5 From Ben.Young at risk.sungard.com Fri Jan 6 16:27:20 2006 From: Ben.Young at risk.sungard.com (Ben.Young at risk.sungard.com) Date: Fri, 6 Jan 2006 15:27:20 +0000 Subject: [pypy-dev] Fw: [pypy-svn] r21739 - in pypy/dist/pypy/lib/pyontology: . test Message-ID: Hi Everyone, Just a quick question. What is all this pyontology stuff? Is there any docs explaining what it is, what it's used for, and why pypy is a good match for it? I'm sure I could find out with some google'ing, but I'm feeling a bit lazy! Hope you all had a good Christmas/New Year. I see you are all still recovering by the lack of pypy action :-) Cheers, Ben ----- Forwarded by Ben Young/Infinity on 06/01/2006 15:24 ----- pypy-svn-bounces at codespeak.net wrote on 06/01/2006 14:48:58: > Author: ale > Date: Fri Jan 6 15:48:57 2006 > New Revision: 21739 > > Modified: > pypy/dist/pypy/lib/pyontology/pyontology.py > pypy/dist/pypy/lib/pyontology/test/test_ontology.py > Log: > Lots of small changes and refactorings, I probably should commit more often > > Modified: pypy/dist/pypy/lib/pyontology/pyontology.py > ============================================================================== > --- pypy/dist/pypy/lib/pyontology/pyontology.py (original) > +++ pypy/dist/pypy/lib/pyontology/pyontology.py Fri Jan 6 15:48:57 2006 > @@ -1,4 +1,4 @@ > -from rdflib import Graph, URIRef, BNode > +from rdflib import Graph, URIRef, BNode, Literal > from logilab.constraint import Repository, Solver > from logilab.constraint.fd import Equals, AllDistinct, > BinaryExpression, Expression > from logilab.constraint.fd import FiniteDomain as fd > @@ -71,23 +71,25 @@ > > class Property(ClassDomain): > # Property contains the relationship between a class instance and a value > - # - a pair. To accomodate global assertions like 'range' and > 'domain' anonymous > - # pairs are allowed, ie None as key > + # - a pair. To accomodate global assertions like 'range' and > 'domain' attributes > + # for range and domain must be filled in by rdfs:range and rdfs:domain > + > def __init__(self, name='', values=[], bases = []): > ClassDomain.__init__(self, name, values, bases) > - self._dict = {} > + self._dict = Linkeddict() > + self.range = [] > + self.domain = [] > > def getValues(self): > - return self._dict.items() > + items = self._dict.items() > + res = [] > + for k,v in items: > + for i in v: > + res.append((k,i)) > + return res > > def setValues(self, values): > - for k,v in values: > - self._dict.setdefault(k,[]) > - if type(v) == list: > - self._dict[k] = v > - else: > - if not v in self._dict[k]: > - self._dict[k].append(v) > + self._dict = Linkeddict(values) > > def removeValues(self, values): > for k,v in values: > @@ -124,13 +126,13 @@ > > def __init__(self, name='', values=[], bases = []): > Property.__init__(self, name, values, bases) > - self.constraint = FunctionalCardinality(name, 1) > + self.constraint = FunctionalCardinality(name) > > class InverseFunctionalProperty(Property): > > def __init__(self, name='', values=[], bases = []): > Property.__init__(self, name, values, bases) > - self.constraint = InverseFunctionalCardinality(name, 1) > + self.constraint = InverseFunctionalCardinality(name) > > class TransitiveProperty(Property): > > @@ -192,25 +194,22 @@ > ns ='' > func = p > if ns in namespaces.values(): > + #predicate is one of builtin OWL predicates > pred = getattr(self, func) > res = pred(s, p, o) > if not res : > continue > if type(res) != list : > res = [res] > - avar = self.make_var(fd, s) > + avar = self.make_var(ClassDomain, s) > else: > res = [o] > avar = self.make_var(Property, p) > # Set the values of the property p to o > - sub = self.make_var(fd, s) > - obj = self.make_var(fd, o) > + sub = self.make_var(ClassDomain, s) > + obj = self.make_var(Thing, o) > res = self.variables[avar].getValues() > - self.variables[avar].setValues(res + ((sub, obj),)) > - if self.variables.get(avar) and type(self.variables[avar]) == fd: > - self.variables[avar] = fd(list(self. > variables[avar].getValues()) + res) > - else: > - self.variables[avar] = fd(res) > + self.variables[avar].setValues(res + [(sub, obj)]) > > def merge_constraints(self): > # Make the intersection of multiple rdfs:range constraints > on the same variable > @@ -240,9 +239,7 @@ > first = list(self.objects(subject, rdf_first)) > assert len(first) == 1 > if type(first[0]) == URIRef: > - var = self.make_var(fd, first[0]) > - if var not in self.variables.keys(): > - self.variables[var] = ClassDomain(var) > + var = self.make_var(ClassDomain, first[0]) > res += first > > rest = list(self.objects(subject, rdf_rest)) > @@ -252,24 +249,25 @@ > res += self.get_list(rest[0]) > return res > > - def make_var(self, cls=fd, *args): > - res = [] > - for a in args: > - if type(a) == URIRef: > - if a.find('#') != -1: > - ns,name = a.split('#') > - else: > - ns,name = a,'' > - if ns not in uris.keys(): > - uris[ns] = ns.split('/')[-1] > - namespaces[uris[ns]] = ns > - mangle_name = uris[ns] + '_' + name > - res.append(mangle_name) > + def make_var(self, cls=fd, a=''): > + if type(a) == URIRef: > + if a.find('#') != -1: > + ns,name = a.split('#') > else: > - res.append(a) > - var = '.'.join([str(a.replace('-','_')) for a in res]) > + ns,name = a,'' > + if ns not in uris.keys(): > + uris[ns] = ns.split('/')[-1] > + a = uris[ns] + '_' + name > + var = str(a.replace('-','_')) > + if not cls: > + return var > if not var in self.variables.keys(): > self.variables[var] = cls(var) > + elif type(self.variables[var]) != cls: > + olddom = self.variables[var] > + newdom = cls(var) > + newdom.setValues(olddom.getValues()) > + self.variables[var] = newdom > return var > > def find_prop(self, s): > @@ -284,7 +282,7 @@ > if type(s) == BNode: > pr = list( self.subjects(p,s) ) > if len(pr) == 0: > - return > + pr = list( self.subjects(r,s) ) > return pr[0] > else: > return s > @@ -296,37 +294,25 @@ > > def find_property(self, s): > prop = self.find_prop(s) > - cls = self.find_cls(s) > - if cls : > - avar = self.make_var(ClassDomain, cls, prop) > - else: > - avar = self.make_var(ClassDomain, prop) > - if not self.variables.get(avar): > - self.variables[avar] = ClassDomain(avar) > + avar = self.make_var(Property, prop) > return avar > > #---------------- Implementation ---------------- > > def type(self, s, p, var): > - > - #if (type(var) == URIRef and not > - if not (var in [URIRef(namespaces['owl']+'#'+x) for x in > builtin_voc]): > + if not (var in [URIRef(namespaces[ns]+'#'+x) for x in > builtin_voc for ns in namespaces]): > # var is not one of the builtin classes > - svar = self.make_var(ClassDomain, s) > avar = self.make_var(ClassDomain, var) > - self.variables[svar].setValues(self.variables[avar].getValues()) > + svar = self.make_var(self.variables[avar].__class__, s) > constrain = BinaryExpression([svar, avar],"%s in %s" % > (svar, avar)) > self.constraints.append(constrain) > - else: # type(s) != BNode: > + else: > # var is a builtin class > - svar = self.make_var(ClassDomain, s) > - print "===",var > - cls =builtin_voc[var.split('#')[-1]](name=svar) > + cls =builtin_voc[var.split('#')[-1]] > + svar = self.make_var(cls, s) > + cls = self.variables[svar] > if hasattr(cls, 'constraint'): > self.constraints.append(cls.constraint) > - vals = self.variables[svar].getValues() > - cls.setValues(vals) > - self.variables[svar] = cls > > def first(self, s, p, var): > pass > @@ -334,14 +320,17 @@ > def rest(self, s, p, var): > pass > > + def onProperty(self, s, p, var): > + pass > + > #---Class Axioms--- > #000000#FFFFFF----------------------------------------------- > > def subClassOf(self, s, p, var): > # s is a subclass of var means that the > # class extension of s is a subset of the > # class extension of var. > - avar = self.make_var(ClassDomain, var) > - svar = self.make_var(ClassDomain, s) > + avar = self.make_var(None, var) > + svar = self.make_var(None, s) > cons = SubClassConstraint( svar, avar) > self.constraints.append(cons) > > @@ -350,21 +339,22 @@ > self.subClassOf(var, p, s) > > def disjointWith(self, s, p, var): > - avar = self.make_var(ClassDomain, var) > - svar = self.make_var(ClassDomain, s) > + avar = self.make_var(None, var) > + svar = self.make_var(None, s) > constrain = DisjointClassConstraint(svar, avar) > self.constraints.append(constrain) > > def complementOf(self, s, p, var): > # add constraint of not var > # TODO: implementthis for OWL DL > - avar = self.make_var(ClassDomain, var) > - svar = self.make_var(ClassDomain, s) > +## avar = self.make_var(ClassDomain, var) > +## svar = self.make_var(ClassDomain, s) > + pass > > def oneOf(self, s, p, var): > res = self.get_list(var) > - prop = self.find_uriref(s) > - avar = self.make_var(fd, prop) > + #prop = self.find_uriref(s) > + avar = self.make_var(None, s) > if self.variables.get(avar) and type(self.variables[avar]) == fd: > self.variables[avar] = fd(list(self.variables[avar]. > getValues()) + res) > else: > @@ -388,13 +378,6 @@ > def range(self, s, p, var): > avar = self.make_var(ClassDomain, var) > svar = self.make_var(Property, s) > - vals = get_values(self.variables[avar], self.variables) > - for k,v in self.variables[svar].getValues(): > - for x in v: > - if not x in vals: > - vals.append(x) > - vals =[(None,val) for val in vals] > - self.variables[svar].setValues(vals) > cons = RangeConstraint(svar, avar) > self.constraints.append(cons) > > @@ -424,37 +407,42 @@ > def equivalentProperty(self, s, p, var): > avar = self.make_var(Property, var) > svar = self.make_var(Property, s) > - cons = EquivalentConstraint( svar, avar) > + cons = EquivalentPropertyConstraint( svar, avar) > self.constraints.append(cons) > > def inverseOf(self, s, p, var): > - # TODO: implement this > - pass > + avar = self.make_var(Property, var) > + svar = self.make_var(Property, s) > + con = InverseofConstraint(svar, avar) > + self.constraints.append(con) > > #---Property > restrictions------------------------------------------------------ > > def maxCardinality(self, s, p, var): > """ Len of finite domain of the property shall be less than > or equal to var""" > avar = self.find_property(s) > - constrain = MaxCardinality(avar,int(var)) > + cls =self.make_var(None, self.find_cls(s)) > + constrain = MaxCardinality(avar, cls, int(var)) > self.constraints.append(constrain) > > def minCardinality(self, s, p, var): > """ Len of finite domain of the property shall be greater > than or equal to var""" > avar = self.find_property(s) > - constrain = MinCardinality(avar,int(var)) > + cls =self.make_var(None, self.find_cls(s)) > + constrain = MinCardinality(avar, cls, int(var)) > self.constraints.append(constrain) > > def cardinality(self, s, p, var): > """ Len of finite domain of the property shall be equal to var""" > avar = self.find_property(s) > + cls =self.make_var(None, self.find_cls(s)) > # Check if var is an int, else find the int buried in the structure > - constrain = Cardinality(avar,int(var)) > + constrain = Cardinality(avar, cls, int(var)) > self.constraints.append(constrain) > > def differentFrom(self, s, p, var): > s_var = self.make_var(ClassDomain, s) > - var_var = self.make_var(fd, var) > + var_var = self.make_var(Thing, var) > constrain = BinaryExpression([s_var, var_var],"%s != %s" % > (s_var, var_var)) > self.constraints.append(constrain) > > @@ -464,14 +452,12 @@ > return res > > def sameAs(self, s, p, var): > - constrain = BinaryExpression([self.make_var(ClassDomain, > s), self.make_var(ClassDomain, var)], > - "%s == %s" %(self.make_var(ClassDomain, s), self. > make_var(ClassDomain, var))) > + s_var = self.make_var(None, s) > + var_var = self.make_var(None, var) > + constrain = BinaryExpression([s_var, var_var], > + "%s == %s" %(s_var, var_var)) > self.constraints.append(constrain) > > - def onProperty(self, s, p, var): > - # TODO: implement this > - pass > - > def hasValue(self, s, p, var): > # TODO: implement this > pass > @@ -485,7 +471,7 @@ > pass > > def imports(self, s, p, var): > - # TODO: implement this > + # PP TODO: implement this > pass > > # ----------------- Helper classes ---------------- > @@ -507,17 +493,19 @@ > class MaxCardinality(OwlConstraint): > """Contraint: all values must be distinct""" > > - def __init__(self, variable, cardinality): > + def __init__(self, variable, cls, cardinality): > OwlConstraint.__init__(self, variable) > self.__cost = 1 > self.cardinality = cardinality > + self.cls = cls > > def __repr__(self): > return '<%s %s %i>' % (self.__class__.__name__, str(self. > _variables[0]), self.cardinality) > > def narrow(self, domains): > """narrowing algorithm for the constraint""" > - if len(domains[self._variables[0]]) > self.cardinality: > + prop = Linkeddict(domains[self.variable].getValues()) > + if len(prop[self.cls]) > self.cardinality: > raise ConsistencyFailure("Maxcardinality exceeded") > else: > return 1 > @@ -526,8 +514,8 @@ > > def narrow(self, domains): > """narrowing algorithm for the constraint""" > - > - if len(domains[self._variables[0]]) < self.cardinality: > + prop = Linkeddict(domains[self.variable].getValues()) > + if len(prop[self.cls]) < self.cardinality: > raise ConsistencyFailure("MinCardinality not accomplished") > else: > return 1 > @@ -536,8 +524,8 @@ > > def narrow(self, domains): > """narrowing algorithm for the constraint""" > - > - if len(domains[self._variables[0]]) != self.cardinality: > + prop = Linkeddict(domains[self.variable].getValues()) > + if len(prop[self.cls]) != self.cardinality: > raise ConsistencyFailure("Cardinality constraint not met") > else: > return 1 > @@ -545,12 +533,14 @@ > > def get_values(dom, domains, attr = 'getValues'): > res = [] > + if type(dom) == Literal: > + return [dom] > for val in getattr(dom, attr)(): > res.append(val) > if type(val) == tuple: > val = val[0] > if val in domains.keys(): > - res.extend(get_values(val, domains, attr)) > + res.extend(get_values(domains[val], domains, attr)) > #res[dom] = 1 > return res > > @@ -558,15 +548,15 @@ > > def __init__(self, variable, cls_or_restriction): > OwlConstraint.__init__(self, variable) > - self.super = cls_or_restriction > + self.object = cls_or_restriction > self.variable = variable > > def __repr__(self): > - return '<%s %s %s>' % (self.__class__.__name__, str(self. > _variables[0]), self.super) > + return '<%s %s %s>' % (self.__class__.__name__, str(self. > _variables[0]), self.object) > > def narrow(self, domains): > subdom = domains[self.variable] > - superdom = domains[self.super] > + superdom = domains[self.object] > bases = get_values(superdom, domains, 'getBases') > subdom.bases += [bas for bas in bases if bas not in subdom.bases] > vals = get_values(subdom, domains, 'getValues') > @@ -576,11 +566,11 @@ > > def narrow(self, domains): > subdom = domains[self.variable] > - superdom = domains[self.super] > + superdom = domains[self.object] > bases = get_values(superdom, domains, 'getBases') > subdom.bases += [bas for bas in bases if bas not in subdom.bases] > vals1 = get_values(superdom, domains, 'getValues') > - vals2 = get_values(variable, domains, 'getValues') > + vals2 = get_values(subdom, domains, 'getValues') > for i in vals1: > if i in vals2: > raise ConsistencyFailure() > @@ -589,39 +579,46 @@ > > def narrow(self, domains): > subdom = domains[self.variable] > - superdom = domains[self.super] > + superdom = domains[self.object] > > class RangeConstraint(SubClassConstraint): > > def narrow(self, domains): > - subdom = domains[self.variable] > - superdom = domains[self.super] > - vals = get_values(superdom, domains, 'getValues') > - res = [] > - svals = get_values(subdom, domains, 'getValues') > - for k,val in svals: > - for v in val: > - if not v in vals: > - res.append((k,v)) > - subdom.removeValues(res) > + propdom = domains[self.variable] > + rangedom = domains[self.object] > + newrange = get_values(rangedom, domains, 'getValues') > + range = [] > + prop = Linkeddict(propdom.getValues()) > + oldrange = propdom.range#get(None) > + if oldrange: > + for v in oldrange: > + if v in newrange: > + range.append(v) > + else: > + range = newrange > + propdom.range = range > +# propdom.setValues(prop.items()) > + for pval in sum(prop.values(),[]): > + if pval not in range: > + raise ConsistencyFailure("Value %r not in range % > r"%(pval,range)) > > class DomainConstraint(SubClassConstraint): > > def narrow(self, domains): > - subdom = domains[self.variable] > - superdom = domains[self.super] > - vals = get_values(superdom, domains, 'getValues') > + propdom = domains[self.variable] > + domaindom = domains[self.object] > + vals = get_values(domaindom, domains, 'getValues') > res = [] > - for k,val in get_values(subdom, domains, 'getValues'): > - if not k in vals and k != superdom: > + for k,val in get_values(propdom, domains, 'getValues'): > + if not k in vals and k != domaindom: > res.append((k,val)) > - subdom.removeValues(res) > + propdom.removeValues(res) > > class SubPropertyConstraint(SubClassConstraint): > > def narrow(self, domains): > subdom = domains[self.variable] > - superdom = domains[self.super] > + superdom = domains[self.object] > vals = get_values(superdom, domains, 'getValues') > for val in subdom.getValues(): > if not val in vals: > @@ -632,25 +629,26 @@ > > def narrow(self, domains): > subdom = domains[self.variable] > - superdom = domains[self.super] > + superdom = domains[self.object] > vals = get_values(superdom, domains, 'getValues') > for val in subdom.getValues(): > if not val in vals: > raise ConsistencyFailure("Value not in prescribed range") > > -class FunctionalCardinality(MaxCardinality): > +class FunctionalCardinality(OwlConstraint): > """Contraint: all values must be distinct""" > > def narrow(self, domains): > """narrowing algorithm for the constraint""" > domain = domains[self.variable].getValues() > - for cls, val in domain: > - if len(val) != self.cardinality: > + domain_dict = Linkeddict(domain) > + for cls, val in domain_dict.items(): > + if len(val) != 1: > raise ConsistencyFailure("Maxcardinality exceeded") > else: > return 0 > > -class InverseFunctionalCardinality(MaxCardinality): > +class InverseFunctionalCardinality(OwlConstraint): > """Contraint: all values must be distinct""" > > def narrow(self, domains): > @@ -658,27 +656,36 @@ > domain = domains[self.variable].getValues() > vals = {} > for cls, val in domain: > - for v in val: > - if vals.has_key(v): > - raise ConsistencyFailure("Maxcardinality exceeded") > - else: > - vals[v] = 1 > + if vals.has_key(val): > + raise ConsistencyFailure("Maxcardinality exceeded") > + else: > + vals[val] = 1 > else: > return 0 > > +class Linkeddict(dict): > + def __init__(self, values=()): > + for k,v in values: > + dict.setdefault(self,k,[]) > + if type(v) == list: > + dict.__setitem__(self, k, v) > + else: > + if not v in dict.__getitem__(self,k): > + dict.__getitem__(self,k).append(v) > +## dict.__getitem__(self,k).append(v) > + > class TransitiveConstraint(OwlConstraint): > """Contraint: all values must be distinct""" > > def narrow(self, domains): > """narrowing algorithm for the constraint""" > domain = domains[self.variable].getValues() > - domain_dict = dict( domain ) > + domain_dict = Linkeddict(domain) > for cls, val in domain: > - for v in val: > - if v in domain_dict: > - val.extend(domain_dict[v]) > - domain_dict[cls] = val > - domains[self.variable].setValues(domain_dict.items()) > + if val in domain_dict: > + for v in domain_dict[val]: > + domain.append((cls,v)) > + domains[self.variable].setValues(domain) > > class SymmetricConstraint(OwlConstraint): > """Contraint: all values must be distinct""" > @@ -686,9 +693,24 @@ > def narrow(self, domains): > """narrowing algorithm for the constraint""" > domain = domains[self.variable].getValues() > - domain_dict = dict( domain ) > for cls, val in domain: > - for v in val: > - domain_dict.setdefault(v, []) > - domain_dict[v].append(cls) > - domains[self.variable].setValues(domain_dict.items()) > + if not (val, cls) in domain: > + domain.append((val,cls)) > + domains[self.variable].setValues(domain) > + > +class InverseofConstraint(SubClassConstraint): > + """Contraint: all values must be distinct""" > + > + def narrow(self, domains): > + """narrowing algorithm for the constraint""" > + obj_domain = domains[self.object].getValues() > + sub_domain = domains[self.variable].getValues() > + res = [] > + for cls, val in obj_domain: > + if not (val,cls) in sub_domain: > + raise ConsistencyFailure("Inverseof failed") > + for cls, val in sub_domain: > + if not (val,cls) in obj_domain: > + raise ConsistencyFailure("Inverseof failed") > +## res.append((val, cls)) > +## domains[self.variable].setValues(res) > > Modified: pypy/dist/pypy/lib/pyontology/test/test_ontology.py > ============================================================================== > --- pypy/dist/pypy/lib/pyontology/test/test_ontology.py (original) > +++ pypy/dist/pypy/lib/pyontology/test/test_ontology.py Fri Jan 6 > 15:48:57 2006 > @@ -17,7 +17,7 @@ > name = O.make_var(ClassDomain, var) > cod = name+' = 1' > exec cod > - assert O.make_var(ClassDomain, var) in locals() > + assert O.make_var(None, var) in locals() > assert isinstance(O.variables[name], ClassDomain) > > def test_subClassof(): > @@ -25,10 +25,11 @@ > a = URIRef(u'http://www.w3.org/2002/03owlt/unionOf/premises004#A') > b = URIRef(u'http://www.w3.org/2002/03owlt/unionOf/premises004#B') > c = URIRef(u'http://www.w3.org/2002/03owlt/unionOf/premises004#C') > - O.subClassOf(b, None, a) > - O.subClassOf(c, None, b) > A = O.make_var(ClassDomain, a) > C = O.make_var(ClassDomain, c) > + C = O.make_var(ClassDomain, b) > + O.subClassOf(b, None, a) > + O.subClassOf(c, None, b) > for con in O.constraints: > con.narrow(O.variables) > assert len(O.variables) == 3 > @@ -100,8 +101,10 @@ > pred = URIRef('type') > obj = URIRef('o') > O = Ontology() > + O.make_var(ClassDomain, obj) > O.type(sub, pred , obj) > - assert O.variables[O.make_var(ClassDomain, sub)].__class__ == > ClassDomain > + > + assert O.variables[O.make_var(None, sub)].__class__ == ClassDomain > > def test_ObjectProperty(): > sub = URIRef('a') > @@ -109,7 +112,7 @@ > obj = URIRef(namespaces['owl']+'#ObjectProperty') > O = Ontology() > O.type(sub, pred , obj) > - assert O.variables[O.make_var(ClassDomain, sub)].__class__ == > ObjectProperty > + assert O.variables[O.make_var(None, sub)].__class__ == ObjectProperty > > def test_range(): > O = Ontology() > @@ -123,7 +126,7 @@ > O.type(sub, pred , obj) > assert len(O.constraints) == 1 > O.constraints[0].narrow(O.variables) > - assert O.variables['a_'].getValues() == [(None,[1,2,3,4]),] > + assert O.variables['a_'].range == [1,2,3,4] > > def test_merge(): > O = Ontology() > @@ -140,7 +143,7 @@ > O.type(sub, pred , obj) > assert len(O.constraints) == 2 > O.consistency() > - assert O.variables['a_'].getValues() == [(None, [3,4]),] > + assert O.variables['a_'].range == [ 3,4] > > def test_domain(): > O = Ontology() > @@ -154,7 +157,7 @@ > O.type(sub, pred , obj) > assert len(O.constraints) == 1 > O.constraints[0].narrow(O.variables) > - assert O.variables['a_'].getValues() == [(O.variables['b_'], [None]),] > + assert O.variables['a_'].getValues() == [(O.variables['b_'], None),] > > def test_domain_merge(): > O = Ontology() > @@ -165,9 +168,8 @@ > obj = URIRef('c') > O.variables['c_'] = ClassDomain('c') > O.domain(sub, None , obj) > - pred = URIRef('type') > obj = URIRef(namespaces['owl']+'#ObjectProperty') > - O.type(sub, pred , obj) > + O.type(sub, None , obj) > > assert len(O.constraints) == 2 > for con in O.constraints: > @@ -204,7 +206,7 @@ > obj = URIRef('c') > O.type(sub, None, obj) > O.variables['p_'].setValues([('individ_',42)]) > - assert len(O.constraints) == 2 > + #assert len(O.constraints) == 2 > #add another valueof the property > O.variables['p_'].setValues([('individ_',42),('individ_',43)]) > #check that consistency raises > @@ -226,12 +228,12 @@ > obj = URIRef('c') > O.type(sub, None, obj) > O.variables['p_'].setValues([('individ_',42)]) > - assert len(O.constraints) == 2 > + #assert len(O.constraints) == 2 > #add another individual with the same value for the property > sub = URIRef('individ2') > obj = URIRef('c') > O.type(sub, None, obj) > - O.variables['p_'].setValues([('individ2_',42)]) > + O.variables['p_'].setValues([('individ_',42),('individ2_',42)]) > #check that consistency raises > py.test.raises(ConsistencyFailure, O.consistency) > > @@ -256,7 +258,7 @@ > O.type(sub, None, obj) > O.variables['subRegionOf_'].setValues([('Italy_','Tuscanny_'), > ('Tuscanny_','Chianti_')]) > O.consistency() > - assert ('Italy_', ['Tuscanny_', 'Chianti_']) in O. > variables['subRegionOf_'].getValues() > + assert ('Italy_', 'Chianti_') in O.variables['subRegionOf_'].getValues() > > def test_symmetricproperty(): > > @@ -265,6 +267,7 @@ > sub = URIRef('friend') > obj = URIRef(namespaces['owl']+'#SymmetricProperty') > O.type(sub, None, obj) > + assert O.variables[O.make_var(None, sub)].__class__. > __name__=='SymmetricProperty' > #Make class > sub = URIRef('c') > obj = URIRef(namespaces['owl']+'#Class') > @@ -276,8 +279,9 @@ > sub = URIRef('Alice') > O.type(sub, None, obj) > O.variables['friend_'].setValues([('Bob_','Alice_')]) > + print O.variables['friend_']._dict > O.consistency() > - assert ('Alice_', ['Bob_']) in O.variables['friend_'].getValues() > + assert ('Alice_', 'Bob_') in O.variables['friend_'].getValues() > > def no_test_maxcardinality(): > > @@ -301,6 +305,4 @@ > O.maxCardinality(sub, None, 1) > O.variables['friend_'].setValues([('Bob_',['Alice_','Finn_'])]) > O.consistency(verbose=5) > - print O.variables > - print O.constraints > assert not '_anon' in O.variables > \ No newline at end of file > _______________________________________________ > pypy-svn mailing list > pypy-svn at codespeak.net > http://codespeak.net/mailman/listinfo/pypy-svn > From Ben.Young at risk.sungard.com Fri Jan 6 17:11:47 2006 From: Ben.Young at risk.sungard.com (Ben.Young at risk.sungard.com) Date: Fri, 6 Jan 2006 16:11:47 +0000 Subject: [pypy-dev] Fw: [pypy-svn] r21739 - in pypy/dist/pypy/lib/pyontology: . test In-Reply-To: <12410AA9-A265-450B-AA4A-A1D2CC4CAEC9@dfki.de> Message-ID: Thanks for the info Anders. What I don't understand is what the relation of this all is with PyPy. Will it eventually be somehow integrated with python itself rather than a library? What benefits will this bring? Cheers, Ben Anders Lehmann wrote on 06/01/2006 16:03:20: > It is part of what we have promised to deliver in the eu-project, in > the the workpackage about Semantic web and Logic (WP9). It is > supposed to become an parser/reasoner of the Web Ontology Language > (OWL) speciification from W3C. > > There is no documentation yet (hopefully that will change next week). > > We decided in Gothenburg that it should live in the lib directory > even though the overlap to the rest of PyPy is non-existent. > > Cheers > > Anders Lehmann > Den 06/01/2006 kl. 16.27 skrev Ben.Young at risk.sungard.com: > > > Hi Everyone, > > > > Just a quick question. What is all this pyontology stuff? Is there any > > docs explaining what it is, what it's used for, and why pypy is a good > > match for it? I'm sure I could find out with some google'ing, but I'm > > feeling a bit lazy! > > > > Hope you all had a good Christmas/New Year. I see you are all still > > recovering by the lack of pypy action :-) > > > > Cheers, > > Ben > > From Ben.Young at risk.sungard.com Fri Jan 6 17:25:40 2006 From: Ben.Young at risk.sungard.com (Ben.Young at risk.sungard.com) Date: Fri, 6 Jan 2006 16:25:40 +0000 Subject: [pypy-dev] Fw: [pypy-svn] r21739 - in pypy/dist/pypy/lib/pyontology: . test In-Reply-To: <691E9427-1389-4F56-87CD-17804E2CAE23@dfki.de> Message-ID: Anders Lehmann wrote on 06/01/2006 16:21:42: > Sorry for not sending the first answer to the list, please read below. > > Den 06/01/2006 kl. 17.11 skrev Ben.Young at risk.sungard.com: > > > Thanks for the info Anders. > > > > What I don't understand is what the relation of this all is with PyPy. > > Will it eventually be somehow integrated with python itself rather > > than a > > library? What benefits will this bring? > > > > Cheers, > > Ben > > > > For now there are no relation to PyPy. For now the parser/reasoner is > using the constraint solving package from Logilab for the heavy > lifting. We plan to integrate this Logic solving package into PyPy > (in LogicObjectSpace) and thus showcasing the flexibility of PyPy. > > The possibility to use OWL from python is in some demand (at least in > rdf land and here at DFKI). > > Hope this helps > > Anders Lehmann > Ah, I see (I think). So the integrated LogicObjectSpace will be about to somehow solve logic problems expressed in ordinary python objects. Thanks for the info! Cheers, Ben From pedronis at strakt.com Sat Jan 7 22:32:21 2006 From: pedronis at strakt.com (Samuele Pedroni) Date: Sat, 07 Jan 2006 22:32:21 +0100 Subject: [pypy-dev] at some point we will experiment with issues of security, persistence & distribution Message-ID: <43C03365.3050109@strakt.com> this talk by Gilad Bracha: Objects as Software Services, An invited talk at the Dynamic Language Symposium at OOPSLA 2005. ( http://www.bracha.org/oopsla05-dls-talk.pdf ) is an interesting across-the-sprectum take on these or related issues. At least it makes for some interesting thinking. regards. From Gerald.Klix at klix.ch Sun Jan 8 22:17:24 2006 From: Gerald.Klix at klix.ch (Gerald Klix) Date: Sun, 08 Jan 2006 22:17:24 +0100 Subject: [pypy-dev] Fw: [pypy-svn] r21739 - in pypy/dist/pypy/lib/pyontology: . test In-Reply-To: References: Message-ID: <43C18164.2000404@klix.ch> Together with the planned persistence solutions; i suppose this will be also an object space, it will make a great deductive database. yust my 0.02 ?. Cya, Gerald Ben.Young at risk.sungard.com schrieb: > Anders Lehmann wrote on 06/01/2006 16:21:42: > > >>Sorry for not sending the first answer to the list, please read below. >> >>Den 06/01/2006 kl. 17.11 skrev Ben.Young at risk.sungard.com: >> >> >>>Thanks for the info Anders. >>> >>>What I don't understand is what the relation of this all is with PyPy. >>>Will it eventually be somehow integrated with python itself rather >>>than a >>>library? What benefits will this bring? >>> >>>Cheers, >>>Ben >>> >> >>For now there are no relation to PyPy. For now the parser/reasoner is >>using the constraint solving package from Logilab for the heavy >>lifting. We plan to integrate this Logic solving package into PyPy >>(in LogicObjectSpace) and thus showcasing the flexibility of PyPy. >> >>The possibility to use OWL from python is in some demand (at least in >>rdf land and here at DFKI). >> >>Hope this helps >> >>Anders Lehmann >> > > > Ah, I see (I think). So the integrated LogicObjectSpace will be about to > somehow solve logic problems expressed in ordinary python objects. > > Thanks for the info! > > Cheers, > Ben > _______________________________________________ > pypy-dev at codespeak.net > http://codespeak.net/mailman/listinfo/pypy-dev From mwh at python.net Mon Jan 9 12:05:12 2006 From: mwh at python.net (Michael Hudson) Date: Mon, 09 Jan 2006 11:05:12 +0000 Subject: [pypy-dev] Re: at some point we will experiment with issues of security, persistence & distribution References: <43C03365.3050109@strakt.com> Message-ID: <2mslrxr79z.fsf@starship.python.net> Samuele Pedroni writes: > this talk by Gilad Bracha: > > > Objects as Software Services, An invited talk at the Dynamic Language > Symposium at OOPSLA 2005. > > ( http://www.bracha.org/oopsla05-dls-talk.pdf ) > > is an interesting across-the-sprectum take on these or related issues. > At least it makes for some interesting thinking. I think I'm lacking some context. I can't tell if "Mirrors act as capabilities for reflection" is deep or fatuous or somewhere in between. Also, I find the " Bits Rot, deal with it" idea to be somewhat terrifying, but I guess that's a different point. Cheers, mwh -- Or here's an even simpler indicator of how much C++ sucks: Print out the C++ Public Review Document. Have someone hold it about three feet above your head and then drop it. Thus you will be enlightened. -- Thant Tessman From pedronis at strakt.com Mon Jan 9 15:06:59 2006 From: pedronis at strakt.com (Samuele Pedroni) Date: Mon, 09 Jan 2006 15:06:59 +0100 Subject: [pypy-dev] Re: at some point we will experiment with issues of security, persistence & distribution In-Reply-To: <2mslrxr79z.fsf@starship.python.net> References: <43C03365.3050109@strakt.com> <2mslrxr79z.fsf@starship.python.net> Message-ID: <43C26E03.6080201@strakt.com> Michael Hudson wrote: >Samuele Pedroni writes: > > > >>this talk by Gilad Bracha: >> >> >>Objects as Software Services, An invited talk at the Dynamic Language >>Symposium at OOPSLA 2005. >> >>( http://www.bracha.org/oopsla05-dls-talk.pdf ) >> >>is an interesting across-the-sprectum take on these or related issues. >>At least it makes for some interesting thinking. >> >> > >I think I'm lacking some context. I can't tell if > > "Mirrors act as capabilities for reflection" > > > mirrors refers to Self reflection model. In Self and similar model normal objects don't expose reflective operations, instead you create secondary objects, so called mirrors, through which reflective operations can be performed on the original object. From ac at strakt.com Wed Jan 11 13:23:41 2006 From: ac at strakt.com (=?ISO-8859-1?Q?Anders_Chrigstr=F6m?=) Date: Wed, 11 Jan 2006 13:23:41 +0100 Subject: [pypy-dev] New branch for performance experiments. Message-ID: <43C4F8CD.1030407@strakt.com> I'm creating the branch ssh://codespeak.net/svn/pypy/branch/arre-experiments to use for experimenting with performance. The first of these will be trying to refactor the usage of the Arguments objects so that fewer objects get created when it is used. This is a part of the work to get creation of applevel user-defined objects go faster. /Arre From cfbolz at gmx.de Thu Jan 12 00:15:12 2006 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Thu, 12 Jan 2006 00:15:12 +0100 Subject: [pypy-dev] next pypy-sync meeting Message-ID: <43C59180.70900@gmx.de> Hi pypy-devers! You are hereby invited to tomorrow's pypy-sync meeting Time & location: 1.00 - 1.30 pm (GMT+1) at #pypy-sync Regular Topics ==================== - activity reports (3 prepared lines of info, LAST/NEXT/BLOCKERS). - resolve conflicts/blockers Annotated Topics of the week ================================= logic programming and aspect orient programming in PyPy -------------------------------------------------------- Logilab and DFKI are going to work on integrating logic programming and aspect oriented programming with PyPy. Since they don't want to disturb the rest of PyPy with changes that might potentially break things, they want to discuss a branch for their work. Furthermore all the developers not directly involved in this part of the project would like to be informed about the plans in that area, which is something that has not happened so far. There are no further official topics today, you are free to come up with anything on short notice. Cheers, Carl Friedrich From Ben.Young at risk.sungard.com Thu Jan 12 10:41:52 2006 From: Ben.Young at risk.sungard.com (Ben.Young at risk.sungard.com) Date: Thu, 12 Jan 2006 09:41:52 +0000 Subject: [pypy-dev] Re: [pypy-svn] r22006 - in pypy/dist/pypy/translator/c: . src test In-Reply-To: <20060112093121.8F72427B58@code1.codespeak.net> Message-ID: Hi Eric, Just to let you know that on Windows, alloca is spelt _alloca. In later versions the preferred version is _malloca, which needs to be matched by a _freea, as _malloca can allocate on the heap if the object is too large. Cheers, Ben pypy-svn-bounces at codespeak.net wrote on 12/01/2006 09:31:21: > Author: ericvrp > Date: Thu Jan 12 10:31:20 2006 > New Revision: 22006 > > Modified: > pypy/dist/pypy/translator/c/funcgen.py > pypy/dist/pypy/translator/c/src/address.h > pypy/dist/pypy/translator/c/test/test_lladdresses.py > Log: > Added genc support of stack flavored_malloc > > > Modified: pypy/dist/pypy/translator/c/funcgen.py > ============================================================================== > --- pypy/dist/pypy/translator/c/funcgen.py (original) > +++ pypy/dist/pypy/translator/c/funcgen.py Thu Jan 12 10:31:20 2006 > @@ -568,6 +568,8 @@ > flavor = op.args[0].value > if flavor == "raw": > return "OP_RAW_MALLOC(%s, %s, %s);" % (esize, eresult, err) > + elif flavor == "stack": > + return "OP_STACK_MALLOC(%s, %s, %s);" % (esize, eresult, err) > else: > raise NotImplementedError > > > Modified: pypy/dist/pypy/translator/c/src/address.h > ============================================================================== > --- pypy/dist/pypy/translator/c/src/address.h (original) > +++ pypy/dist/pypy/translator/c/src/address.h Thu Jan 12 10:31:20 2006 > @@ -20,5 +20,9 @@ > r = (void*) malloc(size); \ > if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of memory");\ > > +#define OP_STACK_MALLOC(size,r,err) \ > + r = (void*) alloca(size); \ > + if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of memory");\ > + > #define OP_RAW_FREE(x,r,err) free(x); > #define OP_RAW_MEMCOPY(x,y,size,r,err) memcpy(y,x,size); > > Modified: pypy/dist/pypy/translator/c/test/test_lladdresses.py > ============================================================================== > --- pypy/dist/pypy/translator/c/test/test_lladdresses.py (original) > +++ pypy/dist/pypy/translator/c/test/test_lladdresses.py Thu Jan > 12 10:31:20 2006 > @@ -88,7 +88,7 @@ > res = fc() > assert res == int('011100' * 2, 2) > > -def test_flavored_malloc(): > +def test_flavored_malloc_raw(): > class A(object): > _alloc_flavor_ = "raw" > def __init__(self, val): > @@ -100,3 +100,15 @@ > return result > fn = compile(f, [int]) > assert fn(1) == 2 > + > +def test_flavored_malloc_stack(): > + class A(object): > + _alloc_flavor_ = "stack" > + def __init__(self, val): > + self.val = val > + def f(x): > + a = A(x + 1) > + result = a.val > + return result > + fn = compile(f, [int]) > + assert fn(1) == 2 > _______________________________________________ > pypy-svn mailing list > pypy-svn at codespeak.net > http://codespeak.net/mailman/listinfo/pypy-svn > From Ben.Young at risk.sungard.com Thu Jan 12 11:28:14 2006 From: Ben.Young at risk.sungard.com (Ben.Young at risk.sungard.com) Date: Thu, 12 Jan 2006 10:28:14 +0000 Subject: Fw: [pypy-dev] Re: [pypy-svn] r22006 - in pypy/dist/pypy/translator/c: . src test Message-ID: Cool. That was very quick! This malloc removal stuff is looking really good! Does it also mean (if it works) that the inlining threshold can be reduced a bit as part of the reason it needs to be high is to allow the current malloc removal to work? This could reduce the codebase size by rather a lot. Cheers, Ben Eric van Riet Paap wrote on 12/01/2006 09:49:38: > Hi Ben, > > Thank you for that info. I've added some preprocessor stuff to handle > this windows case. I hope the test/test_lladdresses.py tests pass on > windows too now. > Using _malloca (together with _freea) is something we have to think > about. Mostly because currently is all to easy to exhaust stackspace > anyway. > > cheers > Eric > > > On Jan 12, 2006, at 10:41 AM, Ben.Young at risk.sungard.com wrote: > > > Hi Eric, > > > > Just to let you know that on Windows, alloca is spelt _alloca. In > > later > > versions the preferred version is _malloca, which needs to be > > matched by a > > _freea, as _malloca can allocate on the heap if the object is too > > large. > > > > Cheers, > > Ben > > > > pypy-svn-bounces at codespeak.net wrote on 12/01/2006 09:31:21: > > > >> Author: ericvrp > >> Date: Thu Jan 12 10:31:20 2006 > >> New Revision: 22006 > >> > >> Modified: > >> pypy/dist/pypy/translator/c/funcgen.py > >> pypy/dist/pypy/translator/c/src/address.h > >> pypy/dist/pypy/translator/c/test/test_lladdresses.py > >> Log: > >> Added genc support of stack flavored_malloc > >> > >> > >> Modified: pypy/dist/pypy/translator/c/funcgen.py > >> > > ====================================================================== > > ======== > >> --- pypy/dist/pypy/translator/c/funcgen.py (original) > >> +++ pypy/dist/pypy/translator/c/funcgen.py Thu Jan 12 10:31:20 2006 > >> @@ -568,6 +568,8 @@ > >> flavor = op.args[0].value > >> if flavor == "raw": > >> return "OP_RAW_MALLOC(%s, %s, %s);" % (esize, > >> eresult, err) > > > >> + elif flavor == "stack": > >> + return "OP_STACK_MALLOC(%s, %s, %s);" % (esize, eresult, > > err) > >> else: > >> raise NotImplementedError > >> > >> > >> Modified: pypy/dist/pypy/translator/c/src/address.h > >> > > ====================================================================== > > ======== > >> --- pypy/dist/pypy/translator/c/src/address.h (original) > >> +++ pypy/dist/pypy/translator/c/src/address.h Thu Jan 12 > >> 10:31:20 2006 > >> @@ -20,5 +20,9 @@ > >> r = (void*) malloc(size); \ > >> if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of > > memory");\ > >> > >> +#define OP_STACK_MALLOC(size,r,err) \ > >> + r = (void*) alloca(size); \ > >> + if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of > > memory");\ > >> + > >> #define OP_RAW_FREE(x,r,err) free(x); > >> #define OP_RAW_MEMCOPY(x,y,size,r,err) memcpy(y,x,size); > >> > >> Modified: pypy/dist/pypy/translator/c/test/test_lladdresses.py > >> > > ====================================================================== > > ======== > >> --- pypy/dist/pypy/translator/c/test/test_lladdresses.py (original) > >> +++ pypy/dist/pypy/translator/c/test/test_lladdresses.py Thu Jan > >> 12 10:31:20 2006 > >> @@ -88,7 +88,7 @@ > >> res = fc() > >> assert res == int('011100' * 2, 2) > >> > >> -def test_flavored_malloc(): > >> +def test_flavored_malloc_raw(): > >> class A(object): > >> _alloc_flavor_ = "raw" > >> def __init__(self, val): > >> @@ -100,3 +100,15 @@ > >> return result > >> fn = compile(f, [int]) > >> assert fn(1) == 2 > >> + > >> +def test_flavored_malloc_stack(): > >> + class A(object): > >> + _alloc_flavor_ = "stack" > >> + def __init__(self, val): > >> + self.val = val > >> + def f(x): > >> + a = A(x + 1) > >> + result = a.val > >> + return result > >> + fn = compile(f, [int]) > >> + assert fn(1) == 2 > >> _______________________________________________ > >> pypy-svn mailing list > >> pypy-svn at codespeak.net > >> http://codespeak.net/mailman/listinfo/pypy-svn > >> > > > > _______________________________________________ > > pypy-dev at codespeak.net > > http://codespeak.net/mailman/listinfo/pypy-dev > > From cfbolz at gmx.de Thu Jan 12 12:04:32 2006 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Thu, 12 Jan 2006 12:04:32 +0100 Subject: Fw: [pypy-dev] Re: [pypy-svn] r22006 - in pypy/dist/pypy/translator/c: . src test In-Reply-To: References: Message-ID: <43C637C0.30307@gmx.de> Hi Ben! Ben.Young at risk.sungard.com wrote: > Cool. That was very quick! > > This malloc removal stuff is looking really good! Does it also mean (if it > works) that the inlining threshold can be reduced a bit as part of the > reason it needs to be high is to allow the current malloc removal to work? > This could reduce the codebase size by rather a lot. This is quite unclear at this moment. For example it is possible that the current malloc removal and the new malloc removal work in different cases and complement each other. Plus, the new malloc removal does not play well with stackless yet (since it is putting more stuff on the stack). Cheers, Carl Friedrich From hpk at trillke.net Sat Jan 14 21:31:30 2006 From: hpk at trillke.net (holger krekel) Date: Sat, 14 Jan 2006 21:31:30 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback Message-ID: <20060114203130.GC23333@solar.trillke.net> Hey folks, while many of us are gearing up for the EU review end next week (we should sent our last reports in, puh!) there is an idea where i'd enjoy your feedback on. We'd like to propose to the EU that we can fund a Summer of PyPy (modelled after Google's Summer of Code last year) which would roughly work like this: - all students can send in proposals for roughly two-months projects that leverage PyPy in some way - e.g. in areas like new backends or frontends, optimisations, new fun tools, security, distributed systems, logical programming, whatever. - 6-10 people get accepted from a board of experts and everyone gets a personal mentor - you would be invited to the PyPy Post-EuroPython sprint which serves as a kickoff meeting - two months implementation time - participants are invited to another closing-off sprint - results get reviewed if they achieved the goals if so: a sum of 3000-4000 euro is payed flat This is the rough idea - no guarantee it will work this exact way or any way at all :) So what do you think about this whole idea? And would you personally consider wanting to participate? Are you not a student and would like to participate anyway? Summer of PyPy would involve a noticeable organisational effort on our side so it's good to have an idea how much interest there might be. thanks & cheers, holger From hpk at trillke.net Mon Jan 16 07:49:31 2006 From: hpk at trillke.net (holger krekel) Date: Mon, 16 Jan 2006 07:49:31 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback In-Reply-To: <20060114203130.GC23333@solar.trillke.net> References: <20060114203130.GC23333@solar.trillke.net> Message-ID: <20060116064931.GQ23333@solar.trillke.net> Hey again, so right after this mail was sent out there was a codespeak downtime lasting 12 hours. Anyway, let me clarify that this mail was not addressed to the core PyPy developers (who endorse the idea already) but to everybody else so please speak up if you are interested or have comments regarding the idea. Hum, or should we post to comp.lang.python? you can of course also mail me privately - it doesn't mean that you have to guarantee to propose something later. cheers, holger On Sat, Jan 14, 2006 at 21:31 +0100, holger krekel wrote: > while many of us are gearing up for the EU review end next > week (we should sent our last reports in, puh!) > there is an idea where i'd enjoy your feedback on. > > We'd like to propose to the EU that we can fund > a Summer of PyPy (modelled after Google's Summer of Code > last year) which would roughly work like this: > > - all students can send in proposals for roughly two-months > projects that leverage PyPy in some way - e.g. in areas like > new backends or frontends, optimisations, new fun > tools, security, distributed systems, logical programming, > whatever. > > - 6-10 people get accepted from a board of experts > and everyone gets a personal mentor > > - you would be invited to the PyPy Post-EuroPython sprint > which serves as a kickoff meeting > > - two months implementation time > > - participants are invited to another closing-off sprint > > - results get reviewed if they achieved the goals > if so: a sum of 3000-4000 euro is payed flat > > This is the rough idea - no guarantee it will work this > exact way or any way at all :) > > So what do you think about this whole idea? > > And would you personally consider wanting to participate? > Are you not a student and would like to participate anyway? > > Summer of PyPy would involve a noticeable organisational > effort on our side so it's good to have an idea how much > interest there might be. > > thanks & cheers, > > holger > _______________________________________________ > pypy-dev at codespeak.net > http://codespeak.net/mailman/listinfo/pypy-dev > From mrevelle at gmail.com Mon Jan 16 16:14:07 2006 From: mrevelle at gmail.com (Matt Revelle) Date: Mon, 16 Jan 2006 10:14:07 -0500 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback In-Reply-To: <20060116150346.GY23333@solar.trillke.net> References: <20060114203130.GC23333@solar.trillke.net> <20060116064931.GQ23333@solar.trillke.net> <799be8e70601160642w29f90582ka3b138d5fdd1a861@mail.gmail.com> <20060116150346.GY23333@solar.trillke.net> Message-ID: <799be8e70601160714t207de361wfb13c395fba3f7d2@mail.gmail.com> Hi Holger, Sure thing. =) On 1/16/06, holger krekel wrote: > Hey Matt, > > On Mon, Jan 16, 2006 at 09:42 -0500, Matt Revelle wrote: > > Hi Holger, > > It might be better to see if a second Summer of Code is going to occur > > and to be one of the listed projects. I'm curious about how many > > students would be interested in and capable of writing code for PyPy. > > The program sounds like fun, though. > > The thing with summer-of-code is: we could not easily fund > the sprint attendances and also we might not be able > to push 6-10 proposals through although they could be > interesting ... > > cheers, > > holger > > P.S.: are you ok with cross-posting our conversation > to pypy-dev? I think it's interesting for > everyone ... i have heard this comment a number > of times before :) > > > > On 1/16/06, holger krekel wrote: > > > Hey again, > > > > > > so right after this mail was sent out there was a > > > codespeak downtime lasting 12 hours. > > > > > > Anyway, let me clarify that this mail was not addressed > > > to the core PyPy developers (who endorse the idea already) > > > but to everybody else so please speak up if you are interested > > > or have comments regarding the idea. Hum, or should we > > > post to comp.lang.python? > > > > > > you can of course also mail me privately - it doesn't mean > > > that you have to guarantee to propose something later. > > > > > > cheers, > > > > > > holger > > > > > > > > > On Sat, Jan 14, 2006 at 21:31 +0100, holger krekel wrote: > > > > while many of us are gearing up for the EU review end next > > > > week (we should sent our last reports in, puh!) > > > > there is an idea where i'd enjoy your feedback on. > > > > > > > > We'd like to propose to the EU that we can fund > > > > a Summer of PyPy (modelled after Google's Summer of Code > > > > last year) which would roughly work like this: > > > > > > > > - all students can send in proposals for roughly two-months > > > > projects that leverage PyPy in some way - e.g. in areas like > > > > new backends or frontends, optimisations, new fun > > > > tools, security, distributed systems, logical programming, > > > > whatever. > > > > > > > > - 6-10 people get accepted from a board of experts > > > > and everyone gets a personal mentor > > > > > > > > - you would be invited to the PyPy Post-EuroPython sprint > > > > which serves as a kickoff meeting > > > > > > > > - two months implementation time > > > > > > > > - participants are invited to another closing-off sprint > > > > > > > > - results get reviewed if they achieved the goals > > > > if so: a sum of 3000-4000 euro is payed flat > > > > > > > > This is the rough idea - no guarantee it will work this > > > > exact way or any way at all :) > > > > > > > > So what do you think about this whole idea? > > > > > > > > And would you personally consider wanting to participate? > > > > Are you not a student and would like to participate anyway? > > > > > > > > Summer of PyPy would involve a noticeable organisational > > > > effort on our side so it's good to have an idea how much > > > > interest there might be. > > > > > > > > thanks & cheers, > > > > > > > > holger > > > > _______________________________________________ > > > > pypy-dev at codespeak.net > > > > http://codespeak.net/mailman/listinfo/pypy-dev > > > > > > > _______________________________________________ > > > pypy-dev at codespeak.net > > > http://codespeak.net/mailman/listinfo/pypy-dev > > > > > > From jcea at argo.es Mon Jan 16 23:27:12 2006 From: jcea at argo.es (Jesus Cea) Date: Mon, 16 Jan 2006 23:27:12 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback In-Reply-To: <20060114203130.GC23333@solar.trillke.net> References: <20060114203130.GC23333@solar.trillke.net> Message-ID: <43CC1DC0.9030405@argo.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 holger krekel wrote: > So what do you think about this whole idea? Would be very very nice. > And would you personally consider wanting to participate? Possibly. If I could get some speed in pypy code... :). - -- Jesus Cea Avion _/_/ _/_/_/ _/_/_/ jcea at argo.es http://www.argo.es/~jcea/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/_/ PGP Key Available at KeyServ _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQCVAwUBQ8wdwJlgi5GaxT1NAQI7LQP/WWleIIqWJ0+YqouHp50Yx/UHDTMEN+yH bq47WPOr3jeYAdHmd5J6zY0O7XVyhM/wKwleBVdU+qterz2ynVz5ZeInQ2L/hdxE xXYKeDCl1y+4/BpkTPyuAw1jV3yL83b9IVRcXvq5D1yJha7pOjWBH2sZPpeCxrcq AoiTXy04BB8= =rLEA -----END PGP SIGNATURE----- From tismer at stackless.com Tue Jan 17 04:30:17 2006 From: tismer at stackless.com (Christian Tismer) Date: Tue, 17 Jan 2006 04:30:17 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback In-Reply-To: <43CC1DC0.9030405@argo.es> References: <20060114203130.GC23333@solar.trillke.net> <43CC1DC0.9030405@argo.es> Message-ID: <43CC64C9.8020903@stackless.com> Jesus Cea wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > holger krekel wrote: >> So what do you think about this whole idea? > > Would be very very nice. > >> And would you personally consider wanting to participate? > > Possibly. If I could get some speed in pypy code... :). This is interesting! Please let us kmow, how! sincerely -- chris -- Christian Tismer :^) tismerysoft GmbH : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/ From arigo at tunes.org Tue Jan 17 11:08:42 2006 From: arigo at tunes.org (Armin Rigo) Date: Tue, 17 Jan 2006 11:08:42 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback In-Reply-To: <20060116064931.GQ23333@solar.trillke.net> References: <20060114203130.GC23333@solar.trillke.net> <20060116064931.GQ23333@solar.trillke.net> Message-ID: <20060117100842.GA6271@code1.codespeak.net> Hi Holger, On Mon, Jan 16, 2006 at 07:49:31AM +0100, holger krekel wrote: > Hum, or should we post to comp.lang.python? Yes, I think so. I should also mentioning it on python-dev, in the thread of Brett discussing possible thesis ideas. A bientot, Armin From hpk at trillke.net Tue Jan 17 23:08:30 2006 From: hpk at trillke.net (holger krekel) Date: Tue, 17 Jan 2006 23:08:30 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback In-Reply-To: <20060117100842.GA6271@code1.codespeak.net> References: <20060114203130.GC23333@solar.trillke.net> <20060116064931.GQ23333@solar.trillke.net> <20060117100842.GA6271@code1.codespeak.net> Message-ID: <20060117220830.GF23333@solar.trillke.net> Hi Armin, On Tue, Jan 17, 2006 at 11:08 +0100, Armin Rigo wrote: > Hi Holger, > > On Mon, Jan 16, 2006 at 07:49:31AM +0100, holger krekel wrote: > > Hum, or should we post to comp.lang.python? > > Yes, I think so. I should also mentioning it on python-dev, in the > thread of Brett discussing possible thesis ideas. yes, let's do that. Note also that i got some private answers - all encouraging. Maybe we should try come up with a few example proposals. cheers, holger P.S.: to everyone: I am still interested in more feedback - post to pypy-dev preferably. From aurelien.campeas at logilab.fr Wed Jan 18 14:08:48 2006 From: aurelien.campeas at logilab.fr (=?ISO-8859-1?Q?Aur=E9lien_Camp=E9as?=) Date: Wed, 18 Jan 2006 14:08:48 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback In-Reply-To: <20060117220830.GF23333@solar.trillke.net> References: <20060114203130.GC23333@solar.trillke.net> <20060116064931.GQ23333@solar.trillke.net> <20060117100842.GA6271@code1.codespeak.net> <20060117220830.GF23333@solar.trillke.net> Message-ID: <1137589728.1510.2.camel@musca.logilab.fr> Le mardi 17 janvier 2006 ? 23:08 +0100, holger krekel a ?crit : > Hi Armin, > > On Tue, Jan 17, 2006 at 11:08 +0100, Armin Rigo wrote: > > Hi Holger, > > > > On Mon, Jan 16, 2006 at 07:49:31AM +0100, holger krekel wrote: > > > Hum, or should we post to comp.lang.python? > > > > Yes, I think so. I should also mentioning it on python-dev, in the > > thread of Brett discussing possible thesis ideas. > > yes, let's do that. Note also that i got some private answers - > all encouraging. Maybe we should try come up with a few > example proposals. And put them on a page on codespeak. I have two proposals (for things I haven't seen addressed in the WP's, but you'll correct me if I'm wrong): * add CLOS/Dylan generic functions to Py{Py|thon} (bags of methods that are selected according to the tuple of the types of their mandatory arguments), and method combinations (before, after and around methods) * add the Common Lisp "Condition System" (essentially HANDLER-BIND, RESTART-BIND, SIGNAL - like functionality) to PyPy Those are two things I miss currently in Python - especially generic functions - and would like to have and would gladly attempt to implement if I were mandated to :) (but I have interesting and difficult Oz stuff to think about right now). Cheers, Aur?lien. From aurelien.campeas at logilab.fr Wed Jan 18 17:32:34 2006 From: aurelien.campeas at logilab.fr (=?ISO-8859-1?Q?Aur=E9lien_Camp=E9as?=) Date: Wed, 18 Jan 2006 17:32:34 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback In-Reply-To: <799be8e70601180723w57b708e1i7d98f21dcad8c483@mail.gmail.com> References: <20060114203130.GC23333@solar.trillke.net> <20060116064931.GQ23333@solar.trillke.net> <20060117100842.GA6271@code1.codespeak.net> <20060117220830.GF23333@solar.trillke.net> <1137589728.1510.2.camel@musca.logilab.fr> <799be8e70601180723w57b708e1i7d98f21dcad8c483@mail.gmail.com> Message-ID: <1137601955.1512.9.camel@musca.logilab.fr> Le mercredi 18 janvier 2006 ? 10:23 -0500, Matt Revelle a ?crit : > Hi Aur?lien, > PEAK's dispatch provides generic function support for Python. > More info here: http://www-128.ibm.com/developerworks/library/l-cppeak2/ Thanks for the link. It still does not seem to really support multiple dispatch (only the funky "predicative" dispatch). David Mertz's own multimethods.py is more complete than that. Whatever. None of them is complete. I'm told there that it is not really something specific to PyPy, which may be very true ... (Anyway I tried ;-) Less sure about the condition system. Regards, Aur?lien From mwh at python.net Wed Jan 18 19:23:44 2006 From: mwh at python.net (Michael Hudson) Date: Wed, 18 Jan 2006 18:23:44 +0000 Subject: [pypy-dev] Re: idea for Summer of PyPy - call for feedback References: <20060114203130.GC23333@solar.trillke.net> <20060116064931.GQ23333@solar.trillke.net> <20060117100842.GA6271@code1.codespeak.net> <20060117220830.GF23333@solar.trillke.net> <1137589728.1510.2.camel@musca.logilab.fr> <799be8e70601180723w57b708e1i7d98f21dcad8c483@mail.gmail.com> <1137601955.1512.9.camel@musca.logilab.fr> Message-ID: <2mwtgxo0nj.fsf@starship.python.net> Aur?lien Camp?as writes: > Le mercredi 18 janvier 2006 ? 10:23 -0500, Matt Revelle a ?crit : >> Hi Aur?lien, >> PEAK's dispatch provides generic function support for Python. >> More info here: http://www-128.ibm.com/developerworks/library/l-cppeak2/ > > Thanks for the link. > > It still does not seem to really support multiple dispatch (only the > funky "predicative" dispatch). David Mertz's own multimethods.py is more > complete than that. Whatever. None of them is complete. > > I'm told there that it is not really something specific to PyPy, which > may be very true ... (Anyway I tried ;-) > > Less sure about the condition system. The condition system is more of a protocol -- or socialogical, perhaps -- thing than a technical thing. I talked about this at EuroPython last year, and am talking about it at ACCU again so if you're going to be in Mallorca I'll be happy to beta-test my talk on you there :) CHeers, mwh -- (Pdb) operationerr.w_value.w_value.w_value.w_value.w_value.w_value -- one of the clearer PyPy debugging sessions From michael.drumheller at boeing.com Wed Jan 18 19:43:58 2006 From: michael.drumheller at boeing.com (Drumheller, Michael) Date: Wed, 18 Jan 2006 10:43:58 -0800 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback (multimethods, actually) Message-ID: <716621DCB4468F46BBCC1BCFBED45C120129DB1D@XCH-NW-2V2.nw.nos.boeing.com> >>> -----Original Message----- >>> From: Aurelien Campeas [mailto:aurelien.campeas at logilab.fr] >>> Sent: Wednesday, January 18, 2006 8:33 AM >>> To: pypy-dev at codespeak.net >>> Subject: Re: [pypy-dev] idea for Summer of PyPy - call for feedback >>> It still does not seem to really support multiple dispatch >>> (only the funky "predicative" dispatch). David Mertz's own >>> multimethods.py is more complete than that. Whatever. None >>> of them is complete. It is nice to see that others are aware of David Mertz's multimethods.py. I have the impression that not enough people know about it. There is a decorator technique that you can use with it which gives it practically transparent syntax, which I also think is not very well known. Just curious: Can you say in what way multimethods.py is inadequate for your purposes? Michael >>> Regards, >>> Aur?lien From johahn2003 at home.se Wed Jan 18 21:05:09 2006 From: johahn2003 at home.se (Johan Hahn) Date: Wed, 18 Jan 2006 21:05:09 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback References: <20060114203130.GC23333@solar.trillke.net> Message-ID: <05da01c61c6a$7d50db80$0d00a8c0@MAINFRAME> [Holger] > We'd like to propose to the EU that we can fund > a Summer of PyPy (modelled after Google's Summer of Code > last year) ... > So what do you think about this whole idea? I think it's a great idea and I would love to see it take form. (speaking as an interested student...) ...johahn From aurelien.campeas at logilab.fr Thu Jan 19 10:29:07 2006 From: aurelien.campeas at logilab.fr (=?ISO-8859-1?Q?Aur=E9lien_Camp=E9as?=) Date: Thu, 19 Jan 2006 10:29:07 +0100 Subject: [pypy-dev] Re: idea for Summer of PyPy - call for feedback In-Reply-To: <2mwtgxo0nj.fsf@starship.python.net> References: <20060114203130.GC23333@solar.trillke.net> <20060116064931.GQ23333@solar.trillke.net> <20060117100842.GA6271@code1.codespeak.net> <20060117220830.GF23333@solar.trillke.net> <1137589728.1510.2.camel@musca.logilab.fr> <799be8e70601180723w57b708e1i7d98f21dcad8c483@mail.gmail.com> <1137601955.1512.9.camel@musca.logilab.fr> <2mwtgxo0nj.fsf@starship.python.net> Message-ID: <1137662947.1192.5.camel@musca.logilab.fr> Le mercredi 18 janvier 2006 ? 18:23 +0000, Michael Hudson a ?crit : > Aur?lien Camp?as writes: > > > Le mercredi 18 janvier 2006 ? 10:23 -0500, Matt Revelle a ?crit : > >> Hi Aur?lien, > >> PEAK's dispatch provides generic function support for Python. > >> More info here: http://www-128.ibm.com/developerworks/library/l-cppeak2/ > > > > Thanks for the link. > > > > It still does not seem to really support multiple dispatch (only the > > funky "predicative" dispatch). David Mertz's own multimethods.py is more > > complete than that. Whatever. None of them is complete. > > > > I'm told there that it is not really something specific to PyPy, which > > may be very true ... (Anyway I tried ;-) > > > > Less sure about the condition system. > > The condition system is more of a protocol -- or socialogical, perhaps > -- thing than a technical thing. I talked about this at EuroPython Yes, I have seen your slides. > last year, and am talking about it at ACCU again so if you're going to > be in Mallorca I'll be happy to beta-test my talk on you there :) I don't know if I'll be there, but good luck evangelizing peopple about conditions and restarts :) I guess that 'once upon a time' acceptance of 'function call' could have been said to be more of a protocol (or a sociological thing ?) than a technical thing ... to people who grew writing assembly ;-) (and what about that 'object oriented programming' thing ... ?) > > CHeers, > mwh > From aurelien.campeas at logilab.fr Thu Jan 19 11:14:07 2006 From: aurelien.campeas at logilab.fr (=?ISO-8859-1?Q?Aur=E9lien_Camp=E9as?=) Date: Thu, 19 Jan 2006 11:14:07 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback (multimethods, actually) In-Reply-To: <716621DCB4468F46BBCC1BCFBED45C120129DB1D@XCH-NW-2V2.nw.nos.boeing.com> References: <716621DCB4468F46BBCC1BCFBED45C120129DB1D@XCH-NW-2V2.nw.nos.boeing.com> Message-ID: <1137665647.1193.17.camel@musca.logilab.fr> Le mercredi 18 janvier 2006 ? 10:43 -0800, Drumheller, Michael a ?crit : > >>> -----Original Message----- > >>> From: Aurelien Campeas [mailto:aurelien.campeas at logilab.fr] > >>> Sent: Wednesday, January 18, 2006 8:33 AM > >>> To: pypy-dev at codespeak.net > >>> Subject: Re: [pypy-dev] idea for Summer of PyPy - call for feedback > > >>> It still does not seem to really support multiple dispatch > >>> (only the funky "predicative" dispatch). David Mertz's own > >>> multimethods.py is more complete than that. Whatever. None > >>> of them is complete. > > It is nice to see that others are aware of David Mertz's multimethods.py. > I have the impression that not enough people know about it. > There is a decorator technique that you can use with it which gives it > practically transparent syntax, which I also think is not very well known. I have seen Guido's "multimethods in 5 minutes" which is by-the-way more a showcase for decorators than for multimethods. > Just curious: Can you say in what way multimethods.py is inadequate for your purposes? For my immediate usage, they lack the decorator stuff (I don't know yet how to do it). For WP10 purposes ('aspects'), they lack around/before/after methods (I can't see them in http://gnosis.cx/download/gnosis/magic/multimethods.py anyway) ... but Adrien here told me that there is more in aspects than this stuff. Also having fast dispatch in PyPy could be nice (isn't PyPy a bit concerned by performance ... ?). > > Michael > > >>> Regards, > >>> Aur?lien > From mrevelle at gmail.com Thu Jan 19 15:22:09 2006 From: mrevelle at gmail.com (Matt Revelle) Date: Thu, 19 Jan 2006 09:22:09 -0500 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback (multimethods, actually) In-Reply-To: <1137665647.1193.17.camel@musca.logilab.fr> References: <716621DCB4468F46BBCC1BCFBED45C120129DB1D@XCH-NW-2V2.nw.nos.boeing.com> <1137665647.1193.17.camel@musca.logilab.fr> Message-ID: <799be8e70601190622l6812704bw565412a1dbf7772@mail.gmail.com> I'm not sure you looked closely enough at PyProtocols dispatch. Here's a good example from Bob Ippolito (make sure to read the comments): http://bob.pythonmac.org/archives/2005/03/30/five-minute-multimethods-in-python-using-dispatch/ Sorry if this discussion is bothering anyone on pypy-dev. Cheers, Matt On 1/19/06, Aur?lien Camp?as wrote: > Le mercredi 18 janvier 2006 ? 10:43 -0800, Drumheller, Michael a ?crit : > > >>> -----Original Message----- > > >>> From: Aurelien Campeas [mailto:aurelien.campeas at logilab.fr] > > >>> Sent: Wednesday, January 18, 2006 8:33 AM > > >>> To: pypy-dev at codespeak.net > > >>> Subject: Re: [pypy-dev] idea for Summer of PyPy - call for feedback > > > > >>> It still does not seem to really support multiple dispatch > > >>> (only the funky "predicative" dispatch). David Mertz's own > > >>> multimethods.py is more complete than that. Whatever. None > > >>> of them is complete. > > > > It is nice to see that others are aware of David Mertz's multimethods.py. > > I have the impression that not enough people know about it. > > There is a decorator technique that you can use with it which gives it > > practically transparent syntax, which I also think is not very well known. > > I have seen Guido's "multimethods in 5 minutes" which is by-the-way more > a showcase for decorators than for multimethods. > > > Just curious: Can you say in what way multimethods.py is inadequate for your purposes? > > For my immediate usage, they lack the decorator stuff (I don't know yet > how to do it). > > For WP10 purposes ('aspects'), they lack around/before/after methods (I > can't see them in http://gnosis.cx/download/gnosis/magic/multimethods.py > anyway) ... but Adrien here told me that there is more in aspects than > this stuff. > > Also having fast dispatch in PyPy could be nice (isn't PyPy a bit > concerned by performance ... ?). > > > > > Michael > > > > >>> Regards, > > >>> Aur?lien > > > > _______________________________________________ > pypy-dev at codespeak.net > http://codespeak.net/mailman/listinfo/pypy-dev > From aurelien.campeas at logilab.fr Fri Jan 20 10:49:46 2006 From: aurelien.campeas at logilab.fr (=?ISO-8859-1?Q?Aur=E9lien_Camp=E9as?=) Date: Fri, 20 Jan 2006 10:49:46 +0100 Subject: [pypy-dev] idea for Summer of PyPy - call for feedback (multimethods, actually) In-Reply-To: <799be8e70601190622l6812704bw565412a1dbf7772@mail.gmail.com> References: <716621DCB4468F46BBCC1BCFBED45C120129DB1D@XCH-NW-2V2.nw.nos.boeing.com> <1137665647.1193.17.camel@musca.logilab.fr> <799be8e70601190622l6812704bw565412a1dbf7772@mail.gmail.com> Message-ID: <1137750586.1248.3.camel@musca.logilab.fr> Le jeudi 19 janvier 2006 ? 09:22 -0500, Matt Revelle a ?crit : > I'm not sure you looked closely enough at PyProtocols dispatch. > Here's a good example from Bob Ippolito (make sure to read the comments): > http://bob.pythonmac.org/archives/2005/03/30/five-minute-multimethods-in-python-using-dispatch/ > Indeed I relied too much on a quick reading of the article on developperworks ... :) Thanks for the hint. Sometime in the future I'll take the time to see what's exactly available. > Sorry if this discussion is bothering anyone on pypy-dev. You shouldn't fear that. Cheers, Aurelien. From hpk at trillke.net Sat Jan 21 10:47:29 2006 From: hpk at trillke.net (holger krekel) Date: Sat, 21 Jan 2006 10:47:29 +0100 Subject: [pypy-dev] we passed the interim EU review! Message-ID: <20060121094729.GW23333@solar.trillke.net> Hey folks, in case you didn't hear about it already: yesterday the EU reviewers accepted the results and our general direction of the PyPy project! Cheers to everyone who helped to make this happen ... the last two months have involved some of us quite intensively on preparing reports and the review. Here are some more remarks from my side. First, i think that everybody from our presenting group performed really well. Second, the reviwers were also well prepared and had read our reports to some detail with specific questions to technical and non-technical topics. It was was a very interesting and intense session. Apart from accepting our results they provided 5-8 recommendations which we will receive as a report within a month. I am thankful that our Project Officer picked reviewers who really seem to have an interest in our project. It helped tremendously to meet for a rehearsal the day before the actual Review day. Basically we improved all of our talks and thus could present a coherent view of the project. This review was an interim review so there was not too much emphasis on financial aspects of the projects - although some questions were put forward there as well. As to the revision ideas regarding our EU work plan, i guess that they were well received. We presented the idea to work towards a separate RPython compiler that could be used more independently from translating PyPy itself. Also the Summer of PyPy idea got some support (although not as official feedback) and we will have to see now how/if we can put this to work. Regarding the JIT compiler it seems possible that we postpone a release (planned for May at the moment) to a later date. We have to discuss at project levels now how/if we want to tackle the revision ideas. Basically the EU wants us to meet our objectives and allows freedom on the means and plans to meet those objectives. Again, i got the impression that it is too easy to just blame the EU and its adminstration for problems that occur within a funded project. During the last two months i have met several such people and without exception they were very reasonable people - and one has to consider that they organise the spending billions of Euros and are confronted with some partners and organisations simply wanting to get the most money with spending the least effort - if not outright attempts at cheating. Anyway, sometimes it may also be our own organisational issues that delay things or make them more complicated. so far, feel free to ask any more questions, i am sure others can chime in as well and add their impressions ... cheers, holger P.S.: this is a cross-posting, when replying you may select only the developers or the consortium mailing list as appropriate. From lac at strakt.com Sat Jan 21 22:37:59 2006 From: lac at strakt.com (Laura Creighton) Date: Sat, 21 Jan 2006 22:37:59 +0100 Subject: [pypy-dev] which file is connected to http://pypy.org/? Message-ID: <200601212137.k0LLbx2R004881@theraft.strakt.com> In any event it says 'The PyPy project have been an ongoing' rather than 'has been' probably because it said 'We have been' at some point in its lifetime. I'd fix it if I could find it. Laura From lac at strakt.com Sat Jan 21 23:47:11 2006 From: lac at strakt.com (Laura Creighton) Date: Sat, 21 Jan 2006 23:47:11 +0100 Subject: [pypy-dev] Heard the EU review went very well. Message-ID: <200601212247.k0LMlBxj007642@theraft.strakt.com> Congratulations, all. Laura From hpk at trillke.net Sun Jan 22 03:22:17 2006 From: hpk at trillke.net (holger krekel) Date: Sun, 22 Jan 2006 03:22:17 +0100 Subject: [pypy-dev] which file is connected to http://pypy.org/? In-Reply-To: <200601212137.k0LLbx2R004881@theraft.strakt.com> References: <200601212137.k0LLbx2R004881@theraft.strakt.com> Message-ID: <20060122022217.GG23333@solar.trillke.net> On Sat, Jan 21, 2006 at 22:37 +0100, Laura Creighton wrote: > In any event it says 'The PyPy project have been an ongoing' rather > than 'has been' probably because it said 'We have been' at some point in > its lifetime. I'd fix it if I could find it. should be http://codespeak.net/svn/pypy/extradoc/pypy.org/index.txt or some other file in the extradoc/pypy.org directory. holger From fijal at genesilico.pl Sun Jan 22 19:35:01 2006 From: fijal at genesilico.pl (Maciek Fijalkowski) Date: Sun, 22 Jan 2006 19:35:01 +0100 Subject: [pypy-dev] Support for pure functional types. Message-ID: <43D3D055.5060809@genesilico.pl> I've been wondering for some time why there is no support for pure functional types. Like function int -> int. In most type inference techniques, there is. I know, side effects. But usually we can tell that function has no side effects at all, so it would be nice to reduce it to lambda type, not just remember to enter it's block. It would make some things much easier. Anyway: when calling some lambda or local function not all bindings are clear (depends on context), but we can leave it and got bidings later and use it normal way (not degenerate return value to some-object, which happens usually) From Ben.Young at risk.sungard.com Wed Jan 25 14:41:03 2006 From: Ben.Young at risk.sungard.com (Ben.Young at risk.sungard.com) Date: Wed, 25 Jan 2006 13:41:03 +0000 Subject: [pypy-dev] Re: [pypy-svn] r22640 - pypy/dist/pypy/lib/logic In-Reply-To: <20060125125029.48AFE27B44@code1.codespeak.net> Message-ID: Hi, Did you mean to put something GPL'd into PyPy? I thought PyPy has a licence equivalent to Python? Cheers, Ben pypy-svn-bounces at codespeak.net wrote on 25/01/2006 12:50:29: > Author: auc > Date: Wed Jan 25 13:50:25 2006 > New Revision: 22640 > > Added: > pypy/dist/pypy/lib/logic/distributor.py > Modified: > pypy/dist/pypy/lib/logic/computationspace.py > pypy/dist/pypy/lib/logic/test_computationspace.py > pypy/dist/pypy/lib/logic/test_unification.py > pypy/dist/pypy/lib/logic/test_variable.py > pypy/dist/pypy/lib/logic/unification.py > pypy/dist/pypy/lib/logic/variable.py > Log: > (ale, auc) > * add distributor from logilab constraint solver > * adapt it > * method to get vars by name > * tests > > > Modified: pypy/dist/pypy/lib/logic/computationspace.py > ============================================================================== > --- pypy/dist/pypy/lib/logic/computationspace.py (original) > +++ pypy/dist/pypy/lib/logic/computationspace.py Wed Jan 25 13:50:25 2006 > @@ -141,15 +141,15 @@ > ## Choose > ## ------ > > -## Y=choose(N) waits until the current space becomes stable, blocks the > -## current thread, and then creates a choice point with N alternatives > -## in the current space. The blocked choose call waits for an > -## alternative to be chosen by a commit operation on the space. The > -## choose call only defines how many alternatives there are; it does > -## not specify what to do for an alternative. Eventually, choose > -## continues its execution with Y=I when alternative I (1= -## chosen. A maximum of one choice point may exist in a space at any > -## time. > +## Y=choose(N) waits until the current space becomes stable, blocks > +## the current thread, and then creates a choice point with N > +## alternatives in the current space. The blocked choose call waits > +## for an alternative to be chosen by a commit operation on the > +## space. The choose call only defines how many alternatives there > +## are; it does not specify what to do for an alternative. Eventually, > +## choose continues its execution with Y=I when alternative I > +## (1= +## space at any time. > > ## Ask > ## --- > @@ -180,6 +180,9 @@ > class Unprocessed: > pass > > +class Working: > + pass > + > class Failed: > pass > > @@ -200,20 +203,30 @@ > self.store = Store() > self.status = Unprocessed > self.root = self.store.var('root') > - self.store.bind(self.root, program(self.store)) > + self.store.bind(self.root, program(self)) > + > + def _stable(self): > + #XXX: really ? > + return self.status in (Failed, Succeeded, Merged) > + > + def _distributable(self): > + pass > + #return not self._stable > + > + def set_distributor(self, dist): > + self.distributor = dist > > def ask(self): > # XXX: block on status being not stable for threads > if self._stable(): > return self.status > + #return self.store.nb_candidates() > else: > #TBD > return self.status > > - def _stable(self): > - return self.status in (Failed, Succeeded, Merged) > - > def process(self): > + self.status = Working > try: > self.store.satisfy_all() > except ConsistencyFailure: > @@ -221,9 +234,10 @@ > else: > self.status = Succeeded > > - > - def branch(self): > + def make_child(self): > return ComputationSpace(self.program, parent=self) > > -# def choose(self, alternative): > - > + def choose(self, alternative): > + """distribute the domains to new spaces > + create the spaces""" > + > > Added: pypy/dist/pypy/lib/logic/distributor.py > ============================================================================== > --- (empty file) > +++ pypy/dist/pypy/lib/logic/distributor.py Wed Jan 25 13:50:25 2006 > @@ -0,0 +1,172 @@ > +# (c) 2000-2001 LOGILAB S.A. (Paris, FRANCE). > +# http://www.logilab.fr/ -- mailto:contact at logilab.fr > +# > +# This program is free software; you can redistribute it and/or > modify it under > +# the terms of the GNU General Public License as published by the > Free Software > +# Foundation; either version 2 of the License, or (at your option) any later > +# version. > +# > +# This program is distributed in the hope that it will be useful, but WITHOUT > +# ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or FITNESS > +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for > more details. > +# > +# You should have received a copy of the GNU General Public Licensealong with > +# this program; if not, write to the Free Software Foundation, Inc., > +# 59 Temple Place - Suite 330, Boston, MA 02111-1307 > +# USA. > + > +""" > +distributors - part of Logilab's constraint satisfaction solver. > +""" > + > +__revision__ = '$Id: distributors.py,v 1.25 2005/01/14 15:16:21 alf Exp $' > + > +import math, random > + > +def make_new_domains(domains): > + """return a shallow copy of dict of domains passed in argument""" > + domain = {} > + for key, value in domains.items(): > + domain[key] = value.copy() > + return domain > + > +class AbstractDistributor(object): > + """_distribute is left unimplemented.""" > + > + def __init__(self, nb_subspaces=2): > + self.nb_subspaces = nb_subspaces > + self.verbose = 0 > + > + def findSmallestDomain(self, domains): > + """returns the variable having the smallest domain. > + (or one of such varibles if there is a tie) > + """ > + domlist = [(dom.size(), variable ) for variable, dom in > domains.items() > + if dom.size() > 1] > + domlist.sort() > + return domlist[0][1] > + > + def findLargestDomain(self, domains): > + """returns the variable having the largest domain. > + (or one of such variables if there is a tie) > + """ > + domlist = [(dom.size(), variable) for variable, dom in > domains.items() > + if dom.size() > 1] > + domlist.sort() > + return domlist[-1][1] > + > + def nb_subdomains(self, domains): > + """return number of sub domains to explore""" > + return self.nb_subspaces > + > + def distribute(self, domains, verbose=0): > + """do the minimal job and let concrete class distribute variables > + """ > + self.verbose = verbose > + replicas = [] > + for i in range(self.nb_subdomains(domains)): > + replicas.append(make_new_domains(domains)) > + modified_domains = self._distribute(*replicas) > + for domain in modified_domains: > + domain.reset_flags() > + return replicas > + > + def _distribute(self, *args): > + """ method to implement in concrete class > + > + take self.nb_subspaces copy of the original domains as argument > + distribute the domains and return each modified domain > + """ > + raise NotImplementedError("Use a concrete implementation of " > + "the Distributor interface") > + > +class NaiveDistributor(AbstractDistributor): > + """distributes domains by splitting the smallest domain in 2 new domains > + The first new domain has a size of one, > + and the second has all the other values""" > + > + def __init__(self): > + AbstractDistributor.__init__(self) > + > + def _distribute(self, dom1, dom2): > + """See AbstractDistributor""" > + variable = self.findSmallestDomain(dom1) > + values = dom1[variable].get_values() > + if self.verbose: > + print 'Distributing domain for variable', variable, \ > + 'at value', values[0] > + dom1[variable].remove_values(values[1:]) > + dom2[variable].remove_value(values[0]) > + return (dom1[variable], dom2[variable]) > + > + > +class RandomizingDistributor(AbstractDistributor): > + """distributes domains as the NaiveDistrutor, except that the unique > + value of the first domain is picked at random.""" > + > + def __init__(self): > + AbstractDistributor.__init__(self) > + > + def _distribute(self, dom1, dom2): > + """See AbstractDistributor""" > + variable = self.findSmallestDomain(dom1) > + values = dom1[variable].get_values() > + distval = random.choice(values) > + values.remove(distval) > + if self.verbose: > + print 'Distributing domain for variable', variable, \ > + 'at value', distval > + dom1[variable].remove_values(values) > + dom2[variable].remove_value(distval) > + return (dom1[variable], dom2[variable]) > + > + > +class SplitDistributor(AbstractDistributor): > + """distributes domains by splitting the smallest domain in > + nb_subspaces equal parts or as equal as possible. > + If nb_subspaces is 0, then the smallest domain is split in > + domains of size 1""" > + > + def __init__(self, nb_subspaces=3): > + AbstractDistributor.__init__(self, nb_subspaces) > + self.__to_split = None > + def nb_subdomains(self, domains): > + """See AbstractDistributor""" > + self.__to_split = self.findSmallestDomain(domains) > + if self.nb_subspaces: > + return min(self.nb_subspaces, domains[self.__to_split].size()) > + else: > + return domains[self.__to_split].size() > + > + def _distribute(self, *args): > + """See AbstractDistributor""" > + variable = self.__to_split > + nb_subspaces = len(args) > + values = args[0][variable].get_values() > + nb_elts = max(1, len(values)*1./nb_subspaces) > + slices = [(int(math.floor(index * nb_elts)), > + int(math.floor((index + 1) * nb_elts))) > + for index in range(nb_subspaces)] > + if self.verbose: > + print 'Distributing domain for variable', variable > + modified = [] > + for (dom, (end, start)) in zip(args, slices) : > + dom[variable].remove_values(values[:end]) > + dom[variable].remove_values(values[start:]) > + modified.append(dom[variable]) > + return modified > + > +class DichotomyDistributor(SplitDistributor): > + """distributes domains by splitting the smallest domain in > + two equal parts or as equal as possible""" > + def __init__(self): > + SplitDistributor.__init__(self, 2) > + > + > +class EnumeratorDistributor(SplitDistributor): > + """distributes domains by splitting the smallest domain > + in domains of size 1.""" > + def __init__(self): > + SplitDistributor.__init__(self, 0) > + > +DefaultDistributor = DichotomyDistributor > > Modified: pypy/dist/pypy/lib/logic/test_computationspace.py > ============================================================================== > --- pypy/dist/pypy/lib/logic/test_computationspace.py (original) > +++ pypy/dist/pypy/lib/logic/test_computationspace.py Wed Jan 25 > 13:50:25 2006 > @@ -2,24 +2,27 @@ > import variable as v > import constraint as c > import computationspace as cs > +import distributor as di > from py.test import raises > > -def satisfiable_problem(store): > - s = store # i'm lazy > +def satisfiable_problem(computation_space): > + cs = computation_space > + s = cs.store > x, y, z, w = (s.var('x'), s.var('y'), > s.var('z'), s.var('w')) > s.set_domain(x, c.FiniteDomain([2, 6])) > s.set_domain(y, c.FiniteDomain([2, 3])) > s.set_domain(z, c.FiniteDomain([4, 5])) > - s.set_domain(w, c.FiniteDomain([1, 4, 5])) > + s.set_domain(w, c.FiniteDomain([1, 4, 5, 6, 7])) > s.add_constraint(c.Expression([x, y, z], 'x == y + z')) > s.add_constraint(c.Expression([z, w], 'z < w')) > - # we don't know yet how to > # set up a distribution strategy > + cs.set_distributor(di.DichotomyDistributor()) > return (x, w, y) > > -def unsatisfiable_problem(store): > - s = store # i'm lazy > +def unsatisfiable_problem(computation_space): > + cs = computation_space > + s = cs.store > x, y, z, w = (s.var('x'), s.var('y'), > s.var('z'), s.var('w')) > s.set_domain(x, c.FiniteDomain([2, 6])) > @@ -28,8 +31,8 @@ > s.set_domain(w, c.FiniteDomain([1])) > s.add_constraint(c.Expression([x, y, z], 'x == y + z')) > s.add_constraint(c.Expression([z, w], 'z < w')) > - # we don't know yet how to > # set up a distribution strategy > + cs.set_distributor(di.DichotomyDistributor()) > return (x, w, y) > > > @@ -56,5 +59,23 @@ > assert spc.ask() == cs.Unprocessed > spc.process() > assert spc.ask() == cs.Failed > - > - > + > + def test_distribute(self): > + spc = cs.ComputationSpace(satisfiable_problem) > + spc.process() > + domains = dict([(var, var.dom) for var in spc.store.vars > + if var.dom]) > + new_domains = spc.distributor.distribute(domains) > + x, y, z, w = (spc.store.get_var_by_name('x'), > + spc.store.get_var_by_name('y'), > + spc.store.get_var_by_name('z'), > + spc.store.get_var_by_name('w')) > + assert new_domains == [{x: c.FiniteDomain([6]), > + y: c.FiniteDomain([2]), > + z: c.FiniteDomain([4]), > + w: c.FiniteDomain([5])}, > + {x: c.FiniteDomain([6]), > + y: c.FiniteDomain([2]), > + z: c.FiniteDomain([4]), > + w: c.FiniteDomain([6, 7])}] > + > > Modified: pypy/dist/pypy/lib/logic/test_unification.py > ============================================================================== > --- pypy/dist/pypy/lib/logic/test_unification.py (original) > +++ pypy/dist/pypy/lib/logic/test_unification.py Wed Jan 25 13:50:25 2006 > @@ -21,7 +21,7 @@ > > def test_already_in_store(self): > x = u.var('x') > - raises(v.AlreadyExists, u.var, 'x') > + raises(v.AlreadyInStore, u.var, 'x') > > def test_already_bound(self): > x = u.var('x') > > Modified: pypy/dist/pypy/lib/logic/test_variable.py > ============================================================================== > --- pypy/dist/pypy/lib/logic/test_variable.py (original) > +++ pypy/dist/pypy/lib/logic/test_variable.py Wed Jan 25 13:50:25 2006 > @@ -24,10 +24,14 @@ > def setup_method(self, meth): > u._store = u.Store() > > - > def test_no_same_name(self): > x = u.var('x') > - raises(v.AlreadyExists, u.var, 'x') > + raises(u.AlreadyInStore, u.var, 'x') > + > + def test_get_by_name(self): > + x = u.var('x') > + assert x == u._store.get_var_by_name('x') > + raises(u.NotInStore, u._store.get_var_by_name, 'y') > > def test_one_thread_reading_one_var(self): > cons = Consumer() > > Modified: pypy/dist/pypy/lib/logic/unification.py > ============================================================================== > --- pypy/dist/pypy/lib/logic/unification.py (original) > +++ pypy/dist/pypy/lib/logic/unification.py Wed Jan 25 13:50:25 2006 > @@ -120,7 +120,8 @@ > > import threading > > -from variable import EqSet, Var, VariableException, NotAVariable > +from variable import EqSet, Var, \ > + VariableException, NotAVariable, AlreadyInStore > from constraint import FiniteDomain, ConsistencyFailure > > #----------- Store Exceptions ---------------------------- > @@ -132,9 +133,9 @@ > def __str__(self): > return "%s is already bound" % self.name > > -class AlreadyInStore(VariableException): > +class NotInStore(VariableException): > def __str__(self): > - return "%s already in store" % self.name > + return "%s not in the store" % self.name > > class OutOfDomain(VariableException): > def __str__(self): > @@ -169,9 +170,9 @@ > (also called determined variables).""" > > def __init__(self): > - # mapping of names to vars (all of them) > self.vars = set() > - self.names = set() > + # mapping of names to vars (all of them) > + self.names = {} > # set of all constraints > self.constraints = set() > # consistency-preserving stuff > @@ -193,7 +194,7 @@ > raise AlreadyInStore(var.name) > print "adding %s to the store" % var > self.vars.add(var) > - self.names.add(var.name) > + self.names[var.name] = var > # put into new singleton equiv. set > var.val = EqSet([var]) > > @@ -203,6 +204,12 @@ > if var.is_bound(): > raise AlreadyBound > var.dom = FiniteDomain(dom) > + > + def get_var_by_name(self, name): > + try: > + return self.names[name] > + except KeyError: > + raise NotInStore(name) > > #-- Constraints ------------------------- > > > Modified: pypy/dist/pypy/lib/logic/variable.py > ============================================================================== > --- pypy/dist/pypy/lib/logic/variable.py (original) > +++ pypy/dist/pypy/lib/logic/variable.py Wed Jan 25 13:50:25 2006 > @@ -7,13 +7,13 @@ > def __init__(self, name): > self.name = name > > -class NotAVariable(VariableException): > +class AlreadyInStore(VariableException): > def __str__(self): > - return "%s is not a variable" % self.name > + return "%s already in store" % self.name > > -class AlreadyExists(VariableException): > +class NotAVariable(VariableException): > def __str__(self): > - return "%s already exists" % self.name > + return "%s is not a variable" % self.name > > #----------- Variables ---------------------------------- > class EqSet(set): > @@ -32,7 +32,7 @@ > > def __init__(self, name, store): > if name in store.names: > - raise AlreadyExists(name) > + raise AlreadyInStore(name) > self.name = name > self.store = store > # top-level 'commited' binding > @@ -98,16 +98,10 @@ > def add_constraint(self, constraint): > self.constraints.add(constraint) > > - #---- Concurrent public ops -------------------------- > + is_bound = _is_bound > > - def is_bound(self): > - try: > - self.mutex.acquire() > - res = self._is_bound() > - finally: > - self.mutex.release() > - return res > > + #---- Concurrent public ops -------------------------- > # should be used by threads that want to block on > # unbound variables > def get(self): > _______________________________________________ > pypy-svn mailing list > pypy-svn at codespeak.net > http://codespeak.net/mailman/listinfo/pypy-svn > From arigo at tunes.org Wed Jan 25 18:34:53 2006 From: arigo at tunes.org (Armin Rigo) Date: Wed, 25 Jan 2006 18:34:53 +0100 Subject: [pypy-dev] Re: [pypy-svn] r22640 - pypy/dist/pypy/lib/logic In-Reply-To: References: <20060125125029.48AFE27B44@code1.codespeak.net> Message-ID: <20060125173453.GA25463@code1.codespeak.net> Hi Ben, On Wed, Jan 25, 2006 at 01:41:03PM +0000, Ben.Young at risk.sungard.com wrote: > Did you mean to put something GPL'd into PyPy? I thought PyPy has a > licence equivalent to Python? Oups! I think this might be a problem. For sure, we agreed to work on MIT License terms during this PyPy project. I suppose this is just Logilab's existing logic library, which may or may not be used verbatim in Logilab's future contributions to PyPy; in any case, I would recommend that the GPL code be moved to a separate directory on codespeak with an explicit LICENSE.TXT, to avoid any confusion. A bientot, Armin From arigo at tunes.org Wed Jan 25 18:38:02 2006 From: arigo at tunes.org (Armin Rigo) Date: Wed, 25 Jan 2006 18:38:02 +0100 Subject: [pypy-dev] Re: [pypy-svn] r22640 - pypy/dist/pypy/lib/logic In-Reply-To: <20060125173453.GA25463@code1.codespeak.net> References: <20060125125029.48AFE27B44@code1.codespeak.net> <20060125173453.GA25463@code1.codespeak.net> Message-ID: <20060125173802.GB25463@code1.codespeak.net> Hi, On Wed, Jan 25, 2006 at 06:34:53PM +0100, Armin Rigo wrote: > > Did you mean to put something GPL'd into PyPy? I thought PyPy has a > > licence equivalent to Python? > > Oups! I think this might be a problem. Sorry, Carl Friederich just told me that this code has been removed already. Armin From arigo at tunes.org Wed Jan 25 18:39:32 2006 From: arigo at tunes.org (Armin Rigo) Date: Wed, 25 Jan 2006 18:39:32 +0100 Subject: [pypy-dev] Support for pure functional types. In-Reply-To: <43D3D055.5060809@genesilico.pl> References: <43D3D055.5060809@genesilico.pl> Message-ID: <20060125173932.GC25463@code1.codespeak.net> Hi Maciek, On Sun, Jan 22, 2006 at 07:35:01PM +0100, Maciek Fijalkowski wrote: > I've been wondering for some time why there is no support for pure > functional types. Like function int -> int. In most type inference > techniques, there is. I suppose you are referring to supporting dynamic closures in RPython. We don't support them mostly because we didn't need them so far. The first step in supporting them would be to figure out how they should be implemented at the C level. Everything else can be worked out upwards from there. A bientot, Armin From cfbolz at gmx.de Wed Jan 25 20:13:50 2006 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Wed, 25 Jan 2006 20:13:50 +0100 Subject: [pypy-dev] Mallorca sprint days 1 - 3 Message-ID: <43D7CDEE.8060505@gmx.de> Hi all! This is the first report of the challenging Mallorca sprint. On the one hand getting here proved to be quite an ordeal for some of the sprinters due to bad weather at airports and uncooperative ferry companies. On the other hand it seems that we have finally run out of even vaguely easy tasks to do and are thus involved in serious head-scratching and the making of strange noises as we contemplate what we have to do. The sprint is hosted in the GNU/Linux lab of the Universitat de les Illes Balears in Palma de Mallorca. We are very thankful to them for letting us disturb their undergraduates in their attempts to use the computers. On the first day some of the strangest noises were produced by Samuele who started together with Gerald and Stephan to work on a static version of ctypes for rpython. On Tuesday evening, after lots of tedious work on all levels of the translation toolchain, they managed (with some cheating) to got an example calling atoi to run. Michael and Arre started extending the l3interpreter to support operations involving heap-structures in a way that could be run on top of the llinterpreter and after translation to C. After some argument with Samuele, who, as usual, turned out to be right, they were successful in their goals. This means that the l3intepreter can now perform reasonably complex operations involving pointers but not subtract two integers. Carl Friedrich and Richard started refactoring the gc framework to use the new facilities Michael and Arre had written. Progress there was extreeeemely slow, so that in the evening of the first day only marginal progress was achieved. Christian, Eric and later Jacob started exposing PyPy's stackless features to application level. While doing this they found a few problems in the interp-level code and refactored it a bit. On the second and third day Christian and Jacob continued with this. They managed to expose simple coroutines on Wednesday and are now continuing to create nicer interfaces following the stackless module of stackless Python. One of the problems there turned out to be testing turnaround time, since the functionality can only be tested after a full translation has been run. There might be some ways around this involving slimy hacks. On the second day most pairs continued as before. Armin and Carl Friedrich worked on the JIT. They started defining an interface to generate code at runtime (see http://codespeak.net/svn/pypy/dist/pypy/doc/discussion/draft-jit-ideas.txt) and then using this same interface in the low level abstract interpreter. This turned out to be quite difficult in the sense that most of the time was spent re-redesigning the interface yet another time. On the third day Armin swapped with Samuele and continued with Gerald and Stephan to work on rctypes, with slow but steady progress. They are now able to annotate simple cases that use structures. Arre and Samuele tied themselves to the JIT treadmill and continued the work of Armin and Carl. A lot of "wuah!"'s and "arrgh!"'s can be heared from their direction -- we assume they are having fun. Carl Friedrich and Michael thought about how to integrate the currently only simulated GC framework with the backends. This looked and still looks like it will be *a lot of* work but they were able to at least clarify some issues and get somewhat started. Eric and Richard tried to finally remove the dependency on pyrex (!) in genllvm which is a relict from the old days of the first LLVM backend (which was pre-rtyper!). They are also working on removing some hand-written C code from genllvm. So while we're not seeing super-rapid progress there are still interesting changes continuously arriving. Tomorrow is a day off, but given the bunch of obsessives we are there might still be some checkins. There will still be three full days of sprinting afterwards. Cheers from sunny Palma, Michael & Carl Friedrich From sanxiyn at gmail.com Thu Jan 26 15:38:40 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 26 Jan 2006 23:38:40 +0900 Subject: [pypy-dev] Re: __new__ got multiple values for keyword argument 'type' In-Reply-To: <5b0248170601260628g5bca8601j@mail.gmail.com> References: <5b0248170601260628g5bca8601j@mail.gmail.com> Message-ID: <5b0248170601260638p14032e84p@mail.gmail.com> Reverting r22510 "fixes" this, but I don't know why. From sanxiyn at gmail.com Thu Jan 26 15:28:47 2006 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 26 Jan 2006 23:28:47 +0900 Subject: [pypy-dev] __new__ got multiple values for keyword argument 'type' Message-ID: <5b0248170601260628g5bca8601j@mail.gmail.com> With r22685, I get this error: $ py.py PyPy 0.8.0 in StdObjSpace on top of Python 2.3.5 (startuptime: 5.94 secs) >>>> class C: .... def __init__(self, **kw): .... pass .... >>>> c = C(type='test') Traceback (application-level): File "", line 1 in c = C(type='test') TypeError: __new__() got multiple values for keyword argument 'type' >>>> Any idea? Seo Sanghyeon From mwh at python.net Sat Jan 28 19:33:36 2006 From: mwh at python.net (Michael Hudson) Date: Sat, 28 Jan 2006 18:33:36 +0000 Subject: [pypy-dev] pypy mallorca sprint report 2 Message-ID: <2mbqxwi4n3.fsf@starship.python.net> We greet you once again from the Aula Linux lab of the UIB in Palma de Mallorca. There is one more day of sprinting, but as many people have had to leave slightly early, it's probably safe to attempt some kind of summary. Thursday was the break day, which didn't stop some mad people from doing a little work on rctypes and the JIT. The sane ones among us went hiking or to artists' studios instead :) Friday was not the most productive of days, partly becase we gave a talk to some people from the university and the local free software user group in the afternoon. Also contributing to the lack of results were the general difficulty of the tasks and some amazing getting-lost skills ("getting lost" here refers to the physical world for a change). Armin, Arre and Samuele worked on the JIT, the idea being to write an "abstract abstract interpreter", which would specialize an abstract interpreter of low-level graphs for a particular set of low-level graphs. At lunch they told a hilarious joke that they weren't going to do this at all and would instead re-use the annotator to extract the needed information. This then turned out to not be a joke at all, and is exactly what they did for the next two days (apparently they plan to re-use the rtyper as well, but this is just preposterous). Christian worked on coroutines and other stackless-like functionality, with good results: you can now build a version of pypy that can use and freely intermingle raw coroutines, tasklets and greenlets all at once. Apparently this is all fairly natural in the implementation, but must allow for the possibility of some *deeply* obscure user code... (obfuscated pypy contests, anyone?) Michael and Carl repeatedly bashed their heads onto the topic of gc integration, the desk, reference counting details, walls, genc and so on. The basic goal was to express the logic behind placing incref and decref operations as a nice and fairly clear transformation of the flow graphs, as opposed to backend-specific incomprehensible hacks. This task was made considerably harder by exceptions (who uses them, anyway?) but hopefully by the time we've finished writing this report we'll have built a pypy-c in the new style. This work should allow (finally) the integration of the GC framework Carl wrote as his Summer of Code project, and mere mortals to understand genc. Gerald and Stephan continued to work on "rctypes" -- a static version of ctypes for RPython. Reasonably complex ctypes declarations can now be annotated. Eric and Richard worked on a transformation to replace some of the operation that can raise exceptions with direct_call operations -- something that will be very useful for the GC work mentioned above, because operations that can raise an exception need special treatment -- so the fewer the better! And finally, some really interesting news: Armin plans to release Bub-n-Bros 1.5, the play testing of which delayed this morning's status meeting considerably :) To sum up, this sprint has seen a fair amount of work on very challenging tasks. As usual we all need to sleep for a week, so it's time to leave this wonderful island (also, it's raining). Cheers, mwh and Carl Friedrich -- > It might get my attention if you'd spin around in your chair, > spoke in tongues, and puked jets of green goblin goo. I can arrange for this. ;-) -- Barry Warsaw & Fred Drake From mwh at python.net Sat Jan 28 20:41:22 2006 From: mwh at python.net (Michael Hudson) Date: Sat, 28 Jan 2006 19:41:22 +0000 Subject: [pypy-dev] Re: pypy mallorca sprint report 2 References: <2mbqxwi4n3.fsf@starship.python.net> Message-ID: <2m7j8ki1i5.fsf@starship.python.net> Michael Hudson writes: > Michael and Carl repeatedly bashed their heads onto the topic of gc > integration, the desk, reference counting details, walls, genc and so > on. The basic goal was to express the logic behind placing incref and > decref operations as a nice and fairly clear transformation of the > flow graphs, as opposed to backend-specific incomprehensible hacks. > This task was made considerably harder by exceptions (who uses them, > anyway?) but hopefully by the time we've finished writing this report > we'll have built a pypy-c in the new style. It took a bit longer than that, but it worked :) Cheers, mwh -- 42. You can measure a programmer's perspective by noting his attitude on the continuing vitality of FORTRAN. -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html From jae at zhar.net Mon Jan 30 18:12:44 2006 From: jae at zhar.net (John Eikenberry) Date: Mon, 30 Jan 2006 12:12:44 -0500 Subject: [pypy-dev] lambda-the-ultimate pypy discussion Message-ID: <20060130171244.GI19863@kosh.zhar.net> In case anyone is interested and don't read lambda-the-ultimate.org, they have a pypy discussion on the front page right now. http://lambda-the-ultimate.org/ -- John Eikenberry [jae at zhar.net - http://zhar.net] ______________________________________________________________ "It is difficult to produce a television documentary that is both incisive and probing when every twelve minutes one is interrupted by twelve dancing rabbits singing about toilet paper." - Rod Serling From arigo at tunes.org Tue Jan 31 15:07:51 2006 From: arigo at tunes.org (Armin Rigo) Date: Tue, 31 Jan 2006 15:07:51 +0100 Subject: [pypy-dev] Snake server downtime Message-ID: <20060131140751.GA28149@code0.codespeak.net> Hi all, The "snake" server will be down during the next couple of days (Wed-Thu), apparently for a change of the cooling system of the server room. If anyone would really like the server around, I can try to negotiate to have other machines shut down in its place -- some machines can be left running, as long as the room doesn't heat up too much. A bientot, Armin From redorlik at googlemail.com Fri Jan 27 18:15:05 2006 From: redorlik at googlemail.com (Anders Lehmann) Date: Fri, 27 Jan 2006 17:15:05 -0000 Subject: [pypy-dev] Minisprint report Paris Message-ID: Hi Everyone! Here is a short report on how we spent our week in Paris Mini Sprint report Paris January 23-27 ================================ Logic programming ===================== Aurelien and Anders worked the whole week on trying to understand how Oz/Mozart works. After a lot of trials they achieved in implementing: Aurelien had already made basic single assignment store. The store was completed (with tests) They made the basic infrastructure for computation spaces based on the store. From Logilab they stole and adapted code for the FiniteDomain, Constraints and DichotomyDistributor. On the computation space they implemented the semantics of Choose, Commit, Ask and Clone. Some experiments on making these constructs concurrent were made (not finished). Aspects and contracts ======================== Annotation and cleanup/refactoring of the grammar/parser. Research of different implementations of aspects and contracts. One reference is here_ .. _here: http://aosd-europe.net/documents/aspLang.pdf Have a nice weekend/ Sprint Aurelien, Adrien, Ludovic, Nicolas, Anders