Re: [Zope-dev] an Interface expressing "a list of generator function"
Ok, If I attach an item_type to the the list, I do not think I will able to use the native Python list, and should use a subclass instead. It is a bit heavyweight, especially when the intent of the use of the interface was documentation. List and generators are very common in Python and are expressed in very few and clear characters, I thought there would be a shorter way to document their interfaces. Thank you, On Mon, Nov 8, 2010 at 2:24 PM, Tres Seaver wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 11/08/2010 04:40 AM, Jean-Daniel wrote: > > Hello, > > > > I have two objects which interoperate to solve a sudoku: the Sudoku class > > and a vector (a list actually) of generator functions. The Sudoku > interface > > is simple to write as it requires three functions and an attribute. > > > > class ISudoku: > > > > board = Attribute() > > > > def free(col, line): > > "frees the slot at position col, line" > > > > def set(col, line, value): > > "Sets the value in the slot at position col, line" > > > > def candidates(col, line): > > "Returns the candidate digits for the slot at position col,line" > > > > > > But how to express "vector of generator functions" with Zope interfaces? > I > > want to express the possibility to access the vector object with > > the [n] index notation, and this returns a function returning a > generator > > (an object with an iter and next function). > > > > Thank you for your help, > > > > > > PS: the vector of generator functions is the input of the algorithm > called > > "conjoin", used to solve the eight queen problem and knight's tour > problem. > > It is described in the Python sources > > (Python-2.6.5/Lib/test/test_generators.py). > > > > PPS: I say vector instead of list even when the vector is a list, because > > "list" usually implies the possibility to append elements dynamically > which > > is not pertinent in this problem. The length of the vector won't change > and > > is equal to the number of slots on a sudoku board. > > > I would specify the contracts omething like so:: > > > class IVector(Interface): > >item_type = Attribute(u"Interface of items.") > >def __len__(): >""" Fixed length of vector. >""" > >def __getitem__(index): >""" Return the 'index'th item. > >Items conform to 'item_type'. > >'index' must be an integer between 0 and __len__() - 1, >else raise IndexError. >""" > > class IIterable(Interface): > >def __iter__(): >""" Return an iterator for this object. >""" > > > > > - -- > === > Tres Seaver +1 540-429-0999 tsea...@palladion.com > Palladion Software "Excellence by Design"http://palladion.com > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkzX+ggACgkQ+gerLs4ltQ7WQwCeNu4lF+WysIjSYM86EjMhoPFH > 9ZsAnRB7T4Pz+bIVeVYxHbvRYaqN6iE7 > =U5bo > -END PGP SIGNATURE- > > ___ > Zope-Dev maillist - Zope-Dev@zope.org > https://mail.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > https://mail.zope.org/mailman/listinfo/zope-announce > https://mail.zope.org/mailman/listinfo/zope ) > ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] zope.interface memory optimization
On Tue, 2010-11-09 at 01:21 +0200, Marius Gedminas wrote: > On Mon, Nov 08, 2010 at 03:35:09PM +0100, Brian Sutherland wrote: > > I've committed 2 patches to a "jinty-mem" branch of zope.interface. > > Together these patches reduce the startup memory use of my ZTK based > > application by 3%. Is that enough to justify their risk/complexity? > > > > https://mail.zope.org/pipermail/checkins/2010-November/052516.html > > https://mail.zope.org/pipermail/checkins/2010-November/052517.html > > > > If no-one replies, I'll assume that 3% is just not enough to be > > interesting and do nothing;) I'm -1 on it for only 3%. ;-) - C > > It's so interesting I'm going to ask for even more numbers: how much is > that 3% in kilobytes, or objects? Is there any measurable speed impact > for application startup or test runs (faster/slower)? > > Otherwise I'm +1, assuming this doesn't somehow make the code 10% > slower. > > Marius Gedminas > ___ > Zope-Dev maillist - Zope-Dev@zope.org > https://mail.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > https://mail.zope.org/mailman/listinfo/zope-announce > https://mail.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] zope.interface memory optimization
On Mon, Nov 08, 2010 at 03:35:09PM +0100, Brian Sutherland wrote: > I've committed 2 patches to a "jinty-mem" branch of zope.interface. > Together these patches reduce the startup memory use of my ZTK based > application by 3%. Is that enough to justify their risk/complexity? > > https://mail.zope.org/pipermail/checkins/2010-November/052516.html > https://mail.zope.org/pipermail/checkins/2010-November/052517.html > > If no-one replies, I'll assume that 3% is just not enough to be > interesting and do nothing;) It's so interesting I'm going to ask for even more numbers: how much is that 3% in kilobytes, or objects? Is there any measurable speed impact for application startup or test runs (faster/slower)? Otherwise I'm +1, assuming this doesn't somehow make the code 10% slower. Marius Gedminas -- http://pov.lt/ -- Zope 3/BlueBream consulting and development signature.asc Description: Digital signature ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] zope.interface memory optimization
Hi. On Mon, Nov 8, 2010 at 3:35 PM, Brian Sutherland wrote: > I've committed 2 patches to a "jinty-mem" branch of zope.interface. > Together these patches reduce the startup memory use of my ZTK based > application by 3%. Is that enough to justify their risk/complexity? > > https://mail.zope.org/pipermail/checkins/2010-November/052516.html > https://mail.zope.org/pipermail/checkins/2010-November/052517.html > > If no-one replies, I'll assume that 3% is just not enough to be > interesting and do nothing;) The changes looked all low-risk to me. I see no reason, why we shouldn't put them in. There's some quite complex applications built with zope.interface that might benefit even more from this. Hanno ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] zope.interface memory optimization
I've committed 2 patches to a "jinty-mem" branch of zope.interface. Together these patches reduce the startup memory use of my ZTK based application by 3%. Is that enough to justify their risk/complexity? https://mail.zope.org/pipermail/checkins/2010-November/052516.html https://mail.zope.org/pipermail/checkins/2010-November/052517.html If no-one replies, I'll assume that 3% is just not enough to be interesting and do nothing;) -- Brian Sutherland ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] an Interface expressing "a list of generator function"
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/08/2010 04:40 AM, Jean-Daniel wrote: > Hello, > > I have two objects which interoperate to solve a sudoku: the Sudoku class > and a vector (a list actually) of generator functions. The Sudoku interface > is simple to write as it requires three functions and an attribute. > > class ISudoku: > > board = Attribute() > > def free(col, line): > "frees the slot at position col, line" > > def set(col, line, value): > "Sets the value in the slot at position col, line" > > def candidates(col, line): > "Returns the candidate digits for the slot at position col,line" > > > But how to express "vector of generator functions" with Zope interfaces? I > want to express the possibility to access the vector object with > the [n] index notation, and this returns a function returning a generator > (an object with an iter and next function). > > Thank you for your help, > > > PS: the vector of generator functions is the input of the algorithm called > "conjoin", used to solve the eight queen problem and knight's tour problem. > It is described in the Python sources > (Python-2.6.5/Lib/test/test_generators.py). > > PPS: I say vector instead of list even when the vector is a list, because > "list" usually implies the possibility to append elements dynamically which > is not pertinent in this problem. The length of the vector won't change and > is equal to the number of slots on a sudoku board. I would specify the contracts omething like so:: class IVector(Interface): item_type = Attribute(u"Interface of items.") def __len__(): """ Fixed length of vector. """ def __getitem__(index): """ Return the 'index'th item. Items conform to 'item_type'. 'index' must be an integer between 0 and __len__() - 1, else raise IndexError. """ class IIterable(Interface): def __iter__(): """ Return an iterator for this object. """ - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design"http://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkzX+ggACgkQ+gerLs4ltQ7WQwCeNu4lF+WysIjSYM86EjMhoPFH 9ZsAnRB7T4Pz+bIVeVYxHbvRYaqN6iE7 =U5bo -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Zope Tests: 63 OK, 7 Failed
Summary of messages to the zope-tests list. Period Sun Nov 7 13:00:00 2010 UTC to Mon Nov 8 13:00:00 2010 UTC. There were 70 messages: 6 from Zope Tests, 4 from buildbot at pov.lt, 19 from buildbot at winbot.zope.org, 8 from ccomb at free.fr, 33 from jdriessen at thehealthagency.com. Test failures - Subject: FAILED : Zope Buildbot / zope2.13-py2.7 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:35:09 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023344.html Subject: FAILED : Zope Buildbot / zope2.14-py2.7 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:38:50 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023346.html Subject: FAILED : Zope Buildbot / zope2.13-py2.7 slave-ubuntu32 From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:00:05 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023352.html Subject: FAILED : Zope Buildbot / zope2.14-py2.7 slave-ubuntu32 From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:03:59 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023355.html Subject: FAILED : Zope Buildbot / zopetoolkit-py2.7 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:11:50 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023358.html Subject: FAILED : Zope Buildbot / zopetoolkit-py2.7 slave-ubuntu32 From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:36:43 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023369.html Subject: FAILED : winbot / ztk_10 py_244_win32 From: buildbot at winbot.zope.org Date: Sun Nov 7 16:03:11 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023380.html Tests passed OK --- Subject: OK : Zope Buildbot / zope2.12-py2.6 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:31:35 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023342.html Subject: OK : Zope Buildbot / zope2.13-py2.6 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:33:22 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023343.html Subject: OK : Zope Buildbot / zope2.14-py2.6 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:37:02 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023345.html Subject: OK : Zope Buildbot / zopetoolkit-1.0-py2.4 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:44:22 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023347.html Subject: OK : Zope Buildbot / zopetoolkit-1.0-py2.5 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:50:16 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023348.html Subject: OK : Zope Buildbot / zope2.12-py2.6 slave-ubuntu32 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:56:12 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023349.html Subject: OK : Zope Buildbot / zope2.13-py2.6 slave-ubuntu32 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:58:08 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023350.html Subject: OK : Zope Buildbot / zopetoolkit-1.0-py2.6 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 12:59:42 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023351.html Subject: OK : Zope Buildbot / zope2.14-py2.6 slave-ubuntu32 From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:02:04 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023353.html Subject: OK : Zope Buildbot / zopetoolkit-py2.5 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:03:52 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023354.html Subject: OK : Zope Buildbot / zopetoolkit-py2.6 slave-ubuntu64 From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:08:04 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023356.html Subject: OK : Zope Buildbot / zopetoolkit-1.0-py2.4 slave-ubuntu32 From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:10:19 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023357.html Subject: OK : Zope Buildbot / zope2.12-py2.6 slave-osx From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:12:16 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023359.html Subject: OK : Zope Buildbot / zope2.13-py2.6 slave-osx From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:15:27 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023360.html Subject: OK : Zope Buildbot / zopetoolkit-1.0-py2.5 slave-ubuntu32 From: jdriessen at thehealthagency.com Date: Sun Nov 7 13:16:51 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-November/023361.html Subject: OK : Zope Buildbo
Re: [Zope-dev] Survey: most obscure errors
On Tue, Sep 14, 2010 at 12:00:58PM +0200, Marius Gedminas wrote: > What are the most obscure error conditions you've encountered while > developing Zopeish[1] applications? Trying to add a proxied object to the database gives an error that more or less clearly states this condition (proxies are unpickleable). Nevertheless, it might be confusing to newbies, and it does not give any clues about the place that caused the error, not even what was the proxied object. Albertas ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] an Interface expressing "a list of generator function"
Hello, I have two objects which interoperate to solve a sudoku: the Sudoku class and a vector (a list actually) of generator functions. The Sudoku interface is simple to write as it requires three functions and an attribute. class ISudoku: board = Attribute() def free(col, line): "frees the slot at position col, line" def set(col, line, value): "Sets the value in the slot at position col, line" def candidates(col, line): "Returns the candidate digits for the slot at position col,line" But how to express "vector of generator functions" with Zope interfaces? I want to express the possibility to access the vector object with the [n] index notation, and this returns a function returning a generator (an object with an iter and next function). Thank you for your help, PS: the vector of generator functions is the input of the algorithm called "conjoin", used to solve the eight queen problem and knight's tour problem. It is described in the Python sources (Python-2.6.5/Lib/test/test_generators.py). PPS: I say vector instead of list even when the vector is a list, because "list" usually implies the possibility to append elements dynamically which is not pertinent in this problem. The length of the vector won't change and is equal to the number of slots on a sudoku board. ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Survey: most obscure errors
On Tue, Sep 14, 2010 at 12:00, Marius Gedminas wrote: > What are the most obscure error conditions you've encountered while > developing Zopeish[1] applications? > > [1] ZTK, Grok, Bluebream, the old Zope 3.x KGSes all qualify. > > I'm talking about situations where the error message/traceback are > disconnected from the actual cause. Late answer: The really obscure ones are when there *is no error message*. Common in Plone (which may or may not be zopeish). ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )