[IronPython] Static methods that look similar to instance methods?

Simon Dahlbacka simon.dahlbacka at gmail.com
Mon May 8 12:37:57 CEST 2006


I suppose the problem is that the following is valid (and even used) python
code

C:\>python
ActivePython 2.3.2 Build 232 (ActiveState Corp.) based on
Python 2.3.2 (#49, Nov 13 2003, 10:34:54) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class C(object):
...     def foo(self):
...             print self
...
>>> inst = C()
>>> inst.foo()
<__main__.C object at 0x00944FF0>
>>> C.foo(inst)
<__main__.C object at 0x00944FF0>
>>>

/Simon

Btw, why do you need both a static and a non-static method with the same
name?

On 5/8/06, Jonathan Jacobs <korpse-ironpython at kaydash.za.net> wrote:
>
> J. Merrill wrote:
> > In C# you could use   Vector3.Unproject    but that might not work in
> IP.  Have you tried it?
>
> I guess I neglected to mention the part where I explained what I was
> doing. :)
>
> Calling Vector3.Unproject (in an attempt to call the static method)
> results in
> a "None" return value, while the first parameter is modified, essentially
> behaving like the instance method version rather than the static method
> version. Either IP thinks this is something like obj.method(objInstance,
> *args) or it will only try and match the static signature later, which it
> never gets around to.
>
> --
> Jonathan
>
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060508/5139f1c2/attachment.html>


More information about the Ironpython-users mailing list