[issue32696] Fix pickling exceptions with multiple arguments

2022-01-14 Thread Ziga Seilnacht
Change by Ziga Seilnacht : -- nosy: -zseil ___ Python tracker <https://bugs.python.org/issue32696> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2008-11-17 Thread Ziga Seilnacht
Ziga Seilnacht [EMAIL PROTECTED] added the comment: Sorry for the long silence. I think that this patch is not relevant anymore. The code that uses exception pickling already had to be adapted to changes in Python 2.5, so there is no need to change the pickling again and risk breaking user code

[issue1694663] Overloading int.__pow__ does not work

2008-11-17 Thread Ziga Seilnacht
Ziga Seilnacht [EMAIL PROTECTED] added the comment: Hi Raymond, The signature matters because the current code in update_one_slot() forgets to set the use_generic flag when slots have different wrappers. This causes that the slot from the base class is left in the new type. Slots have different

[issue1694663] Overloading int.__pow__ does not work

2008-11-17 Thread Ziga Seilnacht
Changes by Ziga Seilnacht [EMAIL PROTECTED]: Added file: http://bugs.python.org/file12029/time_slot_inheritance.py ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1694663

[issue4230] __getattr__ can't be a descriptor

2008-11-17 Thread Ziga Seilnacht
Ziga Seilnacht [EMAIL PROTECTED] added the comment: Here is a patch for trunk and 2.5 version. It also contains a fix for another crasher (see the tests). I only tested the 2.5 patch, because I don't have the tools for the trunk installed. -- keywords: +patch nosy: +zseil Added file

[issue4230] __getattr__ can't be a descriptor

2008-11-17 Thread Ziga Seilnacht
Changes by Ziga Seilnacht [EMAIL PROTECTED]: Added file: http://bugs.python.org/file12034/getattr_hooks_trunk.diff ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4230

[issue1982] Feature: extend strftime to accept milliseconds

2008-11-17 Thread Ziga Seilnacht
Ziga Seilnacht [EMAIL PROTECTED] added the comment: Do you require millisecond support or would microsecond support be enough? r61402, which is included in Python 2.6, added support for %f format to datetime.strftime() and datetime.strptime(). See also #1158. -- nosy: +zseil

[issue4230] __getattr__ can't be a descriptor

2008-11-17 Thread Ziga Seilnacht
Ziga Seilnacht [EMAIL PROTECTED] added the comment: Here is another patch, for Python 2.4, which contains only the security fix. Benjamin, will you also commit these backports? Added file: http://bugs.python.org/file12036/getattr_hooks_24.diff ___ Python

Re: How to better pickle an extension type

2007-04-17 Thread Ziga Seilnacht
dgdev wrote: I would like to pickle an extension type (written in pyrex). I have it working thus far by defining three methods: class C: # for pickling __getstate__(self): ... # make 'state_obj' return state_obj __reduce__(self):

Re: operator overloading

2007-04-04 Thread Ziga Seilnacht
looping wrote: Hi, for the fun I try operator overloading experiences and I didn't exactly understand how it works. Here is my try: class myint(int): def __pow__(self, value): return self.__add__(value) a = myint(3) a ** 3 6 OK, it works. Now I try

Re: PyImport_ImportModule/embedding: surprising behaviors

2007-03-24 Thread Ziga Seilnacht
David Abrahams wrote: I'm seeing highly surprising (and different!) behaviors of PyImport_ImportModule on Linux and Windows when used in a program with python embedding. On Linux, when attempting to import a module xxx that's in the current directory, I get ImportError: No module named

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Ziga Seilnacht
John Nagle wrote: That's fascinating. Is that a documented feature of the language, or a quirk of the CPython interpreter? Its a documented feature of the language. From the Reference Manual: An assignment statement evaluates the expression list (remember that this can be a single

Re: How to set docstrings for extensions supporting PyNumberMethods?

2007-03-04 Thread Ziga Seilnacht
Nick Alexander wrote: Hello, I am writing a python extension (compiled C code) that defines an extension type with PyNumberMethods. Everything works swimmingly, except I can't deduce a clean way to set the docstring for tp_* methods. That is, I always have type.__long__.__doc__ ==

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: Hello all, I'm using the metaclass trick for automatic reloading of class member functions, found at:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 My problem is that if I 1) pickle an object that inherits from AutoReloader 2) unpickle the object 3)

Re: gmpy moving to code.google.com

2007-02-27 Thread Ziga Seilnacht
Alex Martelli wrote: On Feb 27, 2007, at 2:59 AM, Daniel Nogradi wrote: Hi Alex, I did another test, this time with python 2.4 on suse and things are worse than in the previous case (which was python 2.5 on fedora 3), ouput of 'python gmp_test.py' follows: Interesting! gmpy interacts

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: Thanks Ziga. I use pickle protocol 2 and binary file types with the command: cPickle.dump(obj, file, 2) I did your suggestion, i commented out the __call__ function of MetaInstanceTracker and copied the text to the __new__ function of AutoReloader (code appended). I

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: I pasted the code into mine and replaced the old. It seems not to work for either unpickled objects or new objects. I add methods to a class that inherits from AutoReloader and reload the module, but the new methods are not callable on the old objects. Man! It seems

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: Thanks for checking. I think I narrowed the problem down to inheritance. I inherit from list or some other container first: class PointList( list, AutoReloader ): def PrintHi1(self): print Hi2 class MyPrintingClass( AutoReloader ): def

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread Ziga Seilnacht
zefciu wrote: Ok. Now I do it this way: c_real = PyFloat_AsDouble(PyTuple_GetItem(coord,0)); c_imag = PyFloat_AsDouble(PyTuple_GetItem(coord,1)); And it worked... once. The problem is really funny - in the interactive the function fails every second time. mandelpixel((1.5, 1.5), 9,

Re: 2.4-2.5 current directory change?

2007-02-26 Thread Ziga Seilnacht
On Feb 26, 7:44 pm, Chris Mellon [EMAIL PROTECTED] wrote: This appears to be a change in behavior from Python 2.4 to Python 2.5, which I can't find documented anywhere. It may be windows only, or related to Windows behavior. In 2.4, the current directory (os.curdir) was on sys.path. In 2.5,

Re: 2.4-2.5 current directory change?

2007-02-26 Thread Ziga Seilnacht
Chris Mellon wrote: Considering that it's a backwards incompatible breaking change (although I understand why it was done), you'd think it deserved mention in the more prominent Whats new in Python 2.5 section on the website, in addition to a one-liner in the NEWS file. Ah well, while I'm

Re: pickle problem - frexp() out of range

2007-02-26 Thread Ziga Seilnacht
ahaldar wrote: Hi: I have some large data structure objects in memory, and when I attempt to pickle them, I get the following error: SystemError: frexp() out of range Are there some objects that are just too large to serialize, and if so, is there an easy workaround without breaking up

Re: Bypassing __setattr__ for changing special attributes

2007-02-19 Thread Ziga Seilnacht
George Sakkis wrote: I was kinda surprised that setting __class__ or __dict__ goes through the __setattr__ mechanism, like a normal attribute: class Foo(object): def __setattr__(self, attr, value): pass class Bar(object): pass f = Foo() f.__class__ = Bar print

Re: cmath, __float__ and __complex__

2007-02-16 Thread Ziga Seilnacht
Mark Dickinson wrote: Does anyone know of a good reason for the above behaviour? Would a patch to complexobject.c that `fixes' this be of any interest to anyone but me? Or would it likely break something else? I think this is a bug in the PyComplex_AsCComplex function. To get more feedback,

Re: Partial 1.0 - Partial classes for Python

2007-02-07 Thread Ziga Seilnacht
Thomas Heller wrote: Do you have a pointer to that post? I think that he was refering to this post: http://mail.python.org/pipermail/python-list/2006-December/416241.html If you are interested in various implementations there is also this:

Re: Conditional expressions - PEP 308

2007-01-31 Thread Ziga Seilnacht
Colin J. Williams wrote: It would be helpful if the rules of the game were spelled out more clearly. The conditional expression is defined as X if C else Y. We don't know the precedence of the if operator. From the little test below, it seem to have a lower precedence than or. The rules are

Re: xml.dom.minidom.parseString segmentation fault on mod_python

2007-01-26 Thread Ziga Seilnacht
On Jan 26, 10:41 am, [EMAIL PROTECTED] wrote: Python 2.4.4 mod_python 3.2.10 + Apache 2.0 def index( req, **params ): from xml.dom.minidom import parseString doc = parseString( whatever ) = blank screen, _no_any_exception_; Apache error_log: [Fri Jan 26 10:18:48 2007] [notice]

Re: Number methods

2007-01-21 Thread Ziga Seilnacht
Nick Maclaren wrote: I can't find any description of these. Most are obvious, but some are not. Note that this is from the point of view of IMPLEMENTING them, not USING them. Specifically: The Python equivalents of these methods are described in the reference manual:

Re: Class data members in C

2007-01-16 Thread Ziga Seilnacht
Nick Maclaren wrote: Hmm. The extensions documentation describes how to add instance members to a class (PyMemberDef), but I want to add a class member. Yes, this is constant for all instances of the class. Any pointers? Add something like this to your PyMODINIT_FUNC after you have

Re: Conflicting needs for __init__ method

2007-01-14 Thread Ziga Seilnacht
Mark wrote: [a lot of valid, but long concerns about types that return an object of their own type from some of their methods] I think that the best solution is to use an alternative constructor in your arithmetic methods. That way users don't have to learn about two different factories for the

Re: Bizarre floating-point output

2007-01-08 Thread Ziga Seilnacht
Nick Maclaren wrote: I think that you should. Where does it say that tuple's __str__ is the same as its __repr__? The obvious interpretation of the documentation is that a sequence type's __str__ would call __str__ on each sub-object, and its __repr__ would call __repr__. How would you

Re: Bizarre floating-point output

2007-01-08 Thread Ziga Seilnacht
Nick Maclaren wrote: Well, it's not felt necessary to distinguish those at top level, so why should it be when they are in a sequence? Well, this probably wasn't the best example, see the links below for a better one. But this whole thing is getting ridiculous. The current implementation

Re: Python embedded interpreter: how to initialize the interpreter ?

2007-01-02 Thread Ziga Seilnacht
[EMAIL PROTECTED] wrote: Hello, I've written a C embedded application. I want to open a python gui application in my C program but when I do : PyRun_String( import gui.py, file_input, pDictionary, pDictionary ); the interpreter emits an error: tkinter module not defined What script must

Re: Has comparison of instancemethods changed between python 2.5 and 2.4?

2006-12-16 Thread Ziga Seilnacht
Frank Niessink wrote: I tried to lookup the python source code where the actual comparison happens. I think it is in methodobject.c (I'm not familiar with the python source so please correct me if I'm wrong), meth_compare. That function did not change between python 2.4.4 and 2.5. Moreover,

Re: Overriding traceback print_exc()?

2006-10-31 Thread Ziga Seilnacht
Bob Greschke wrote: I want to cause any traceback output from my applications to show up in one of my dialog boxes, instead of in the command or terminal window (between running on Solaris, Linux, OSX and Windows systems there might not be any command window or terminal window to show the

Re: Efficiently iterating over part of a list

2006-10-13 Thread Ziga Seilnacht
Steven D'Aprano wrote: [snip] The important thing to notice is that alist[1:] makes a copy. What if the list has millions of items and duplicating it is expensive? What do people do in that case? Are there better or more Pythonic alternatives to this obvious C-like idiom? for i in range(1,

Re: Dumping the state of a deadlocked process

2006-10-07 Thread Ziga Seilnacht
[EMAIL PROTECTED] wrote: Hi all I'm currently having some issues with a process getting deadlocked. The problem is that the only way I can seem to find information about where it deadlocks is by making a wild guess, insert a pdb.set_trace() before this point, and then step until it locks up,

Re: PyOpenGL pour python 2.5 ???

2006-09-25 Thread Ziga Seilnacht
Sébastien Ramage wrote: oh! sorry, I made some search on comp.lang.python and fr.comp.lang.python and finally I forgot where I was... My question is : how use pyopengl with python 2.5 ?? it seems that pyopengl was stop on 2005 PyOpenGL is still maintained, but most of the development is

Re: Leaks in subprocess.Popen

2006-09-20 Thread Ziga Seilnacht
zloster wrote: I'm using Python 2.4.3 for Win32. I was trying to run a few child processes simultaneously in separate threads and get their STDOUT, but the program was leaking memory and I found that it was because of subprocess operating in another thread. The following code works fine, but

Re: efficient memoize decorator?

2006-08-19 Thread Ziga Seilnacht
[EMAIL PROTECTED] wrote: im plugging away at the problems at http://www.mathschallenge.net/index.php?section=project im trying to use them as a motivator to get into advanced topics in python. one thing that Structure And Interpretation Of Computer Programs teaches is that memoisation is

Re: Error with: pickle.dumps(numpy.float32)

2006-08-16 Thread Ziga Seilnacht
Iljya wrote: I have reproduced the error with Numpy 1.0b1 The output with v.1.0b1 reads: PicklingError: Can't pickle type 'float32scalar': it's not found as __builtin__.float32scalar Has anyone else encountered this? Thanks, Iljya Iljya wrote: Hello, I need to pickle the type

Re: Class attributes, instances and metaclass __getattribute__

2006-08-08 Thread Ziga Seilnacht
Pedro Werneck wrote: Hi [snip] Well... I'm not talking about metaclass attributes... that's perfectly consistent, agreed. I'm saying that when the class implements a custom __getattribute__, when you try to access the instance attributes from itself, it uses it. But if the class is a

Re: Python Projects Continuous Integration

2006-08-07 Thread Ziga Seilnacht
Dave Potts wrote: Hi, I'm just starting a development project in Python having spent time in the Java world. I was wondering what tool advice you could give me about setting up a continuous integration environment for the python code: get the latest source, run all the tests, package up,

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Ziga Seilnacht
Martin Höfling wrote: Hi there, is it possible to put the methods of a class in different files? I just want to order them and try to keep the files small. Regards Martin You could use something like this: Example usage: class Person(object): ... def __init__(self, first,

Re: Finding the name of a class

2006-08-01 Thread Ziga Seilnacht
Kirk Strauser wrote: [snip] OK, now for the good stuff. In the code below, how can I find the name of the class that 'bar' belongs to: class Foo(object): ... def bar(self): ... pass ... b = Foo.bar print b.im_class.__name__ Foo But if you are writing a decorator, you

Re: .dll and .pyd

2006-07-26 Thread Ziga Seilnacht
[EMAIL PROTECTED] wrote: Please, confirm me one thing. According to Python documentation for Windows the objects .pyd and .dll have the same characteristics. I observed that in Python24 it does not produce errors when importing xx.dll or xx.pyd, however in python25b2, it only accepts nto

Re: PyPy and constraints

2006-07-02 Thread Ziga Seilnacht
Paddy wrote: I followed the recent anouncement of version 0.9 of PyPi and found out that there was work included on adding constraint satisfaction solvers to PyPy: http://codespeak.net/pypy/dist/pypy/doc/howto-logicobjspace-0.9.html I was wondering if this was a possibiity for mainstream

Re: Traversing Inheritance Model

2006-06-26 Thread Ziga Seilnacht
[EMAIL PROTECTED] wrote: What's the best way to traverse the web of inheritance? I want to take a class and traverse its bases and then the bases' bases etc looking for a particular class. What first came to mind was nested for loops. However, I want to know if there's some pre-existing

Re: __getattribute__ doesn't work on 'type' type for '__class__'

2006-06-20 Thread Ziga Seilnacht
Barry Kelly wrote: [snipped] Yet when I try this with the 'type' type, it doesn't work: ---8--- x.__class__.__class__ type 'type' x.__class__.__getattribute__('__class__') Traceback (most recent call last): File stdin, line 1, in ? TypeError: descriptor '__getattribute__' requires a

Re: tp_richcompare

2006-06-02 Thread Ziga Seilnacht
Sreeram Kandallu wrote: I'm writing an extension type, for which i'd like to implement only == and !=, but not the other comparison operators like ,=,,=. What is the right way to do this? I currently have a tp_richcompare function, which handles Py_EQ, and Py_NE, but raises a TypeError for

Re: how to change sys.path?

2006-05-25 Thread Ziga Seilnacht
Michael Yanowitz wrote: Is there something like a .pythoninitrc which can run whenever we start Python that can load a file with many sys.path.append(), etc? If not is there some way to modify the Python shell constructor and destructor? Thanks in advance: Michael yanowitz Yes, there is

Re: Finding defining class in a decorator

2006-05-09 Thread Ziga Seilnacht
lcaamano wrote: We have a tracing decorator that automatically logs enter/exits to/from functions and methods and it also figures out by itself the function call arguments values and the class or module the function/method is defined on. Finding the name of the class where the method we just

Re: list*list

2006-05-01 Thread Ziga Seilnacht
BBands wrote: There must be a better way to multiply the elements of one list by another: [snipped] Perhaps a list comprehension or is this better addressed by NumPy? If you have a large amount of numerical code, it is definetly better to use numpy, since it is intended just for that

Re: are docstrings for variables a bad idea?

2006-04-21 Thread Ziga Seilnacht
jelle wrote: Hi Michele, Thanks for pointing that out, cool! I would argue -even- that is too much programming effort. Like method docstring, variables docstrings should be effortless to write. I don't know what exactly do you mean with variable docstrings, but if you just want to add

Re: __reduce__(1) vs __reduce__(2)

2006-04-20 Thread Ziga Seilnacht
Kirill Simonov wrote: Could someone explain why __reduce__(2) works for files while __reduce__(1) doesn't? I think it is a bug. Both should raise an error. __reduce__ and __reduce_ex__ are part of the pickle protocol. Files are not meant to be pickable, since they are already persistent. With

Re: good style guides for python-style documentation ?

2006-04-06 Thread Ziga Seilnacht
Fredrik Lundh wrote: (reposted from doc-sig, which seems to be mostly dead these days). over at the pytut wiki, carndt asked: Are there any guidelines about conventions concerning punctuation, text styles and language style (e.g. how to address the reader)? any suggestions

Re: Comparisons and singletons

2006-03-25 Thread Ziga Seilnacht
Steven Watanabe wrote: PEP 8 says, Comparisons to singletons like None should always be done with 'is' or 'is not', never the equality operators. I know that is is an identity operator, == and != are the equality operators, but I'm not sure what other singletons are being referred to here.

Re: Comparisons and singletons

2006-03-25 Thread Ziga Seilnacht
David Isaac wrote: Ziga Seilnacht [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] a = 1 b = 1 a == b True a is b False Two follow up questions: 1. I wondered about your example, and noticed a = 10 b = 10 a is b True Why the difference? Python has

Re: Strange metaclass behaviour

2006-03-24 Thread Ziga Seilnacht
Michele Simionato wrote: snip There is a minor bug in your code: def thisclass(proc, *args, **kw): Example: def register(cls): print 'registered' ... class C: ...thisclass(register) ... registered # basic idea stolen from zope.interface, which

Re: property docstrings

2006-03-24 Thread Ziga Seilnacht
Darren Dale wrote: I am trying to work with properties, using python 2.4.2. I can't get the docstrings to work, can someone suggest what I'm doing wrong? I think the following script should print This is the doc string., but instead it prints: float(x) - floating point number Convert a

Re: __slots__

2006-03-23 Thread Ziga Seilnacht
David Isaac wrote: 1. Without a __dict__ variable, instances cannot be assigned new variables not listed in the __slots__ definition. So this seemed an interesting restriction to impose in some instances, but I've noticed that this behavior is being called by some a side effect the reliance

Re: Strange metaclass behaviour

2006-03-23 Thread Ziga Seilnacht
Christian Eder wrote: Hi, I think I have discovered a problem in context of metaclasses and multiple inheritance in python 2.4, which I could finally reduce to a simple example: I don't know if this is a bug; but I will try to expain what is happening; here is an example similar to yours:

Re: Per instance descriptors ?

2006-03-22 Thread Ziga Seilnacht
bruno at modulix wrote: Hi I'm currently playing with some (possibly weird...) code, and I'd have a use for per-instance descriptors, ie (dummy code): snip Now the question: is there any obvious (or non-obvious) drawback with this approach ? Staticmethods won't work anymore: class

Re: user-supplied locals dict for function execution?

2006-03-21 Thread Ziga Seilnacht
Lonnie Princehouse wrote: Occaisionally, the first two lines of The Zen of Python conflict with one another. An API I'm working on involves a custom namespace implementation using dictionaries, and I want a pretty syntax for initializing the custom namespaces. The fact that these namespaces

Re: ** Operator

2006-03-20 Thread Ziga Seilnacht
Christoph Zwerschke wrote: Alex Martelli wrote: Sathyaish wrote: I tried it on the interpreter and it looks like it is the to the power of operator symbol/function. Can you please point me to the formal definition of this operator in the docs? http://docs.python.org/ref/power.html

Re: apache config file parser

2006-03-18 Thread Ziga Seilnacht
David Bear wrote: I was wondering if anyone has written an apache config file parser in python. There seem to be a number of perl mods to do this. But I don't seem to be able to find anything in python. -- David Bear -- let me buy your intellectual property, I want to own your thoughts --

Re: __dict__ strangeness

2006-03-18 Thread Ziga Seilnacht
Georg Brandl wrote: Hi, can someone please tell me that this is correct and why: class C(object): ... pass ... c = C() c.a = 1 c.__dict__ {'a': 1} c.__dict__ = {} c.a Traceback (most recent call last): File stdin, line 1, in ? AttributeError: 'C' object has no

Re: Trace dynamically compiled code?

2006-03-14 Thread Ziga Seilnacht
-- http://dabodev.com Ziga Seilnacht -- http://mail.python.org/mailman/listinfo/python-list

Re: Req. for module style/organization

2006-02-19 Thread Ziga Seilnacht
RayS wrote: I've begun a Python module to provide a complete interface to the Meade LX200 command set, and have searched for a style/development guide for Python Lib/site-packages type modules, but only saw guides for C-modules. I realize that I need to make some changes to follow

Re: representing physical units

2006-02-09 Thread Ziga Seilnacht
Russ wrote: I know that python packages are available for representing physical units, but I am getting frustrated trying to find them and determine which is the best. Where can I find a good package that does this? Thanks. Unum is a special package just for this purpose:

Re: [Python for .NET] Any plans for supporting CLR2.0?

2006-01-22 Thread Ziga Seilnacht
. Ziga Seilnacht -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting better traceback info on exec and execfile - introspection?

2006-01-15 Thread Ziga Seilnacht
R. Bernstein wrote: . . . which is perhaps is a little more honest since one is not really in a file called string. However the way the debugger gets this *is* still a little hoaky in that it looks for something in the frame's f_code.co_filename *called* string. And from that it *assumes* this

Re: Detecting Python Installs from the Windows Registry

2006-01-09 Thread Ziga Seilnacht
Fuzzyman wrote: Does anyone know how to use _winreg to get path information (location of install) for all versions of Python installed (and also which is the most recent) ? This should probably work: import _winreg def get_subkey_names(reg_key): index = 0 L = [] while True:

Re: Calling foreign functions from Python? ctypes?

2006-01-09 Thread Ziga Seilnacht
Sorry, the previous post is wrong. I mixed the function names. -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling foreign functions from Python? ctypes?

2006-01-09 Thread Ziga Seilnacht
Paul Watson wrote: . . . I need to call GetVersionInfo() and handle VERSIONINFO information. I thought that distutils might have something, but I do not see it yet. Any suggestions? This information is provided with sys.getwindowsversion(). --

Re: new-style classes multiplication error message isn't very informative

2005-12-30 Thread ziga . seilnacht
Jon Guyer wrote: This is a fake line to confuse the stupid top-posting filter at gmane We have a rather complicated class that, under certain circumstances, knows that it cannot perform various arithmetic operations, and so returns NotImplemented. As a trivial example: class my:

Re: Adding methods to instances

2005-12-16 Thread ziga . seilnacht
You can also just use: t.dynamic = dynamic.__get__(t) -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with emulation of numeric types and coercion rules

2005-11-02 Thread ziga . seilnacht
Never mind, I forgot that class inheritance tree is a tree. Resulting type of adding Broken and Working from previous example would also depend on the order of operands. Ziga -- http://mail.python.org/mailman/listinfo/python-list

Problems with emulation of numeric types and coercion rules

2005-11-01 Thread ziga . seilnacht
I am trying to write some classes representing the quaternion number. I wrote a base class, which implements only the numerical interface, and a few subclasses, which provide methods for their specific domain. Since the operator methods will be the same for all these classes, the base class