Re: CPython 2.7: Weakset data changing size during internal iteration

2012-06-01 Thread Terry Reedy
On 6/1/2012 7:40 PM, Temia Eszteri wrote: Given that len(weakset) is defined (sensibly) as the number of currently active members, it must count. weakset should really have .__bool__ method that uses any() instead of sum(). That might reduce, but not necessarily eliminate your problem. Think i

Re: DBF records API

2012-06-01 Thread Ethan Furman
Tim Chase wrote: On 06/01/12 19:05, Jon Clements wrote: On 01/06/12 23:13, Tim Chase wrote: dbf.scatter_fields *always* trump and refer to the method. I did think about *trumping* one way or the other, but both *ugh*. For the record, it sounded like the OP wanted to be able to use the do

Re: CPython 2.7: Weakset data changing size during internal iteration

2012-06-01 Thread Temia Eszteri
On 02 Jun 2012 03:05:01 GMT, Steven D'Aprano wrote: >I doubt that very much. If you are using threads, it is more likely your >code has a race condition where you are modifying a weak set at the same >time another thread is trying to iterate over it (in this case, to >determine it's length), a

Re: CPython 2.7: Weakset data changing size during internal iteration

2012-06-01 Thread Steven D'Aprano
On Fri, 01 Jun 2012 08:23:44 -0700, Temia Eszteri wrote: > I've got a bit of a problem - my project uses weak sets in multiple > areas, the problem case in particular being to indicate what objects are > using a particular texture, if any, so that its priority in OpenGL can > be adjusted to match

Re: DBF records API

2012-06-01 Thread Tim Chase
On 06/01/12 19:05, Jon Clements wrote: > On 01/06/12 23:13, Tim Chase wrote: >>dbf.scatter_fields >> >> *always* trump and refer to the method. > > I did think about *trumping* one way or the other, but both *ugh*. For the record, it sounded like the OP wanted to be able to use the dot-notati

Re: other languages API to python

2012-06-01 Thread Fabio Zadrozny
On Thu, May 24, 2012 at 9:25 AM, Chris Angelico wrote: > On Thu, May 24, 2012 at 9:58 PM, Rita wrote: >> Hello, >> >> A vendor provided a C, C++ and Java API for a application. They dont support >> python so I would like to create a library for it. My question is, how >> hard/easy would it be to

Re: DBF records API

2012-06-01 Thread Jon Clements
On 01/06/12 23:13, Tim Chase wrote: On 06/01/12 15:05, Ethan Furman wrote: MRAB wrote: I'd probably think of a record as being more like a dict (or an OrderedDict) with the fields accessed by key: record["name"] but: record.deleted Record fields are accessible both by key and by

Re: CPython 2.7: Weakset data changing size during internal iteration

2012-06-01 Thread Temia Eszteri
On Fri, 01 Jun 2012 18:42:22 -0400, Terry Reedy wrote: >I gather that the .references attribute is sometimes/always a weakset. >To determine its boolean value, it computes its length. For regular >sets, this is sensible as .__len__() returns a pre-computed value. Indeed. Back when I was using

Re: DBF records API

2012-06-01 Thread Tim Chase
On 06/01/12 15:05, Ethan Furman wrote: > MRAB wrote: >> I'd probably think of a record as being more like a dict (or an >> OrderedDict) >> with the fields accessed by key: >> >> record["name"] >> >> but: >> >> record.deleted > > Record fields are accessible both by key and by attribute --

Re: CPython 2.7: Weakset data changing size during internal iteration

2012-06-01 Thread Terry Reedy
On 6/1/2012 11:23 AM, Temia Eszteri wrote: I've got a bit of a problem - my project uses weak sets in multiple areas, the problem case in particular being to indicate what objects are using a particular texture, if any, so that its priority in OpenGL can be adjusted to match at the same time as i

Re: DBF records API

2012-06-01 Thread Ethan Furman
MRAB wrote: On 01/06/2012 18:50, Ethan Furman wrote: I'm getting towards an actual non-beta release, which means even more tests, polishings, cleaning up of various things, and actual documentation. :) However, I am wondering about my current record API: Currently, one does things like:

Re: understanding operator overloading

2012-06-01 Thread Chris Rebert
On Fri, Jun 1, 2012 at 9:39 AM, Josh Benner wrote: > > Is there a good way to trace what's going on under the hood wrt operator > overloading? > > I am trying to understand what is happening in the code and output listed > below. > > Why doesn't __getitem__ in mylist return the same result as the

Re: DBF records API

2012-06-01 Thread MRAB
On 01/06/2012 18:50, Ethan Furman wrote: I'm getting towards an actual non-beta release, which means even more tests, polishings, cleaning up of various things, and actual documentation. :) However, I am wondering about my current record API: Currently, one does things like: record.scatte

Re: While stack:

2012-06-01 Thread MRAB
On 01/06/2012 18:59, David Shi wrote: Can any one clarify what "while stack:" mean? By convention, an empty container is considered false and a non-empty container true in Boolean tests. Therefore, assuming that "stack" is a container, it means "while the stack isn't empty". -- http://mail.pyt

Re: While stack:

2012-06-01 Thread Chris Angelico
On Sat, Jun 2, 2012 at 3:59 AM, David Shi wrote: > Can any one clarify what "while stack:" mean? It iterates as long as 'stack' has something that evaluates as true. My guess is that stack is a list, and the loop is removing elements from that list, so it'll keep going as long as there's anything

Re: get latest from svn

2012-06-01 Thread Corey Richardson
On Fri, 1 Jun 2012 15:38:58 +0530 prakash jp wrote: > Hi All, > > Can some one suggest me a module to access SVN repository so that i > could download any given branch. > > Thanks Doing some basic googling, I found: http://pysvn.tigris.org/ I imagine you could also shell out. -- Corey Rich

Re: While stack:

2012-06-01 Thread Corey Richardson
On Fri, 1 Jun 2012 18:59:57 +0100 (BST) David Shi wrote: > Can any one clarify what "while stack:" mean? > > Regards, > > David > Formal explanation: http://docs.python.org/reference/compound_stmts.html#while Informal introduction: http://learnpythonthehardway.org/book/ex33.html Simplistic

Use a locally built Tk for Python?

2012-06-01 Thread Mark Summerfield
Hi, I have multiple Pythons locally installed so that I can test against different versions. (On a 64-bit Debian stable system.) All of them use the system's Tcl/Tk installation. However, I want to make some of them use a locally build Tcl/Tk that has a small customization. There doesn't seem to

CPython 2.7: Weakset data changing size during internal iteration

2012-06-01 Thread Temia Eszteri
I've got a bit of a problem - my project uses weak sets in multiple areas, the problem case in particular being to indicate what objects are using a particular texture, if any, so that its priority in OpenGL can be adjusted to match at the same time as it being (de)referenced by any explicit calls.

While stack:

2012-06-01 Thread David Shi
Can any one clarify what "while stack:" mean? Regards, David -- http://mail.python.org/mailman/listinfo/python-list

Re: How to suppress exception printing to console?

2012-06-01 Thread Qi
On 2012-6-1 15:46, Ulrich Eckhardt wrote: Don't use PyRun_SimpleString() or catch the exception there. The point is that it runs the whole string as a module, like running a script from the commandline, and a pending exception on exit is then reported to stdout. Good hint, thanks. -- WQ -- h

DBF records API

2012-06-01 Thread Ethan Furman
I'm getting towards an actual non-beta release, which means even more tests, polishings, cleaning up of various things, and actual documentation. :) However, I am wondering about my current record API: Currently, one does things like: record.scatter_fields() or record.has_been_deleted

understanding operator overloading

2012-06-01 Thread Josh Benner
Is there a good way to trace what's going on under the hood wrt operator overloading? I am trying to understand what is happening in the code and output listed below. Why doesn't __getitem__ in mylist return the same result as the builtin list object? Does it have something to do with the start a

Re: wxpython using variable with wx.statictext ignores \n

2012-06-01 Thread MRAB
On 01/06/2012 07:24, Simon Cropper wrote: Hi, I have some wxPython code created with wxGlade that I am customizing. I have a label created under the def __init__() section of the Frame Class. It states... self.Question = wx.StaticText(self, -1, "My question...") if I insert a new li

get latest from svn

2012-06-01 Thread prakash jp
Hi All, Can some one suggest me a module to access SVN repository so that i could download any given branch. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter deadlock on graceful exit

2012-06-01 Thread Matteo Landi
On Thu, May 31, 2012 at 3:02 PM, Matteo Landi wrote: > On Thu, May 31, 2012 at 3:42 AM, Terry Reedy wrote: >> On 5/30/2012 6:19 PM, Matteo Landi wrote: >>> >>> On May/28, Matteo Landi wrote: Hi list, recently I started to work on an application [1] which makes use of the Tkint

Re: How to suppress exception printing to console?

2012-06-01 Thread Ulrich Eckhardt
Am 01.06.2012 05:06, schrieb Qi: > On 2012-5-31 23:01, Ulrich Eckhardt wrote: >> I can only guess what you are doing, maybe you should provide a simple >> piece of code (or, rather, one C++ piece and a Python piece) that >> demonstrates the issue. What I could imagine is that the Python >> interpre

wxpython using variable with wx.statictext ignores \n

2012-06-01 Thread Simon Cropper
Hi, I have some wxPython code created with wxGlade that I am customizing. I have a label created under the def __init__() section of the Frame Class. It states... self.Question = wx.StaticText(self, -1, "My question...") if I insert a new line character in this string like this then