Re: Adding an interface to existing classes

2012-01-05 Thread Spencer Pearson
(I'm sorry for my delayed response -- I've been travelling and not had reliable Internet access.) Spencer, i would re-think this entire project from the beginning. You are trying to make an object out of everything. You don't need to make an object of EVERYTHING. Very true. I'm not sure I

Re: Adding an interface to existing classes

2012-01-05 Thread Spencer Pearson
On Dec 25 2011, 2:58 pm, Terry Reedy tjre...@udel.edu wrote: On 12/24/2011 6:49 PM,SpencerPearsonwrote: On Dec 23, 9:13 am, Terry Reedytjre...@udel.edu  wrote: On 12/22/2011 3:21 AM,SpencerPearsonwrote: I'm writing a geometry package, with Points and Lines and Circles and so on, and

Re: Adding an interface to existing classes

2012-01-05 Thread Spencer Pearson
(I'm sorry for my delayed response -- I've been travelling and not had reliable Internet access.) On 2011-12-25, Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, Dec 22, 2011 at 1:21 AM, Spencer Pearson speeze.pear...@gmail.com wrote: I see a problem with this, though. The intersection of two

Re: Adding an interface to existing classes

2011-12-24 Thread Spencer Pearson
On Dec 23, 9:13 am, Terry Reedy tjre...@udel.edu wrote: On 12/22/2011 3:21 AM, Spencer Pearson wrote: I'm writing a geometry package, with Points and Lines and Circles and so on, and eventually I want to be able to draw these things on the screen. I have two options so far for how

Adding an interface to existing classes

2011-12-22 Thread Spencer Pearson
I'm writing a geometry package, with Points and Lines and Circles and so on, and eventually I want to be able to draw these things on the screen. I have two options so far for how to accomplish this, but neither of them sits quite right with me, and I'd like the opinion of comp.lang.python's

Instances' __setitem__ methods

2011-06-20 Thread Spencer Pearson
I was recently trying to implement a dict-like object which would do some fancy stuff when it was modified, and found that overriding the __setitem__ method of an instance did not act the way I expected. The help documentation (from help(dict.__setitem__)) claims that d.__setitem__(k,v) is

Re: Class changes in circular imports when __name__ == '__main__'

2010-09-08 Thread Spencer Pearson
All right, thank you for helping! I'd had a little voice in the back of my mind nagging me that it might not be logical to include a bunch of classes and function definitions in my startup file, but I never got around to splitting it up. The module/script distinction makes sense, and it seems more

Class changes in circular imports when __name__ == '__main__'

2010-09-05 Thread Spencer Pearson
Hi! I'm writing a package with several files in it, and I've found that isinstance doesn't work the way I expect under certain circumstances. Short example: here are two files. # fileone.py import filetwo class AClass( object ): pass if __name__ == '__main__': a = AClass()

Tuples vs. variable-length argument lists

2010-03-19 Thread Spencer Pearson
Hi! This might be more of a personal-preference question than anything, but here goes: when is it appropriate for a function to take a list or tuple as input, and when should it allow a varying number of arguments? It seems as though the two are always interchangeable. For a simple example...