Re: introspection question: get return type

2009-05-15 Thread Aahz
In article <4a0d2e07$0$9422$426a7...@news.free.fr>, Bruno Desthuilliers wrote: >Aahz a écrit : >> In article <4a0c6e42$0$12031$426a7...@news.free.fr>, >> Bruno Desthuilliers wrote: >>> Marco Mariani a écrit : Bruno Desthuilliers wrote: > Oh, you meant the "return type" ? Nope, no way.

Re: introspection question: get return type

2009-05-15 Thread Bruno Desthuilliers
Aahz a écrit : In article <4a0c6e42$0$12031$426a7...@news.free.fr>, Bruno Desthuilliers wrote: Marco Mariani a écrit : Bruno Desthuilliers wrote: Oh, you meant the "return type" ? Nope, no way. It just doesn't make sense given Python's dynamic typing. Unless he's really trying to write in N

Re: introspection question: get return type

2009-05-14 Thread George Sakkis
On May 14, 3:55 pm, a...@pythoncraft.com (Aahz) wrote: > In article <4a0c6e42$0$12031$426a7...@news.free.fr>, > Bruno Desthuilliers   wrote: > > >Marco Mariani a écrit : > >> Bruno Desthuilliers wrote: > > >>> Oh, you meant the "return type" ? Nope, no way. It just doesn't make > >>> sense given Py

Re: introspection question: get return type

2009-05-14 Thread Terry Reedy
Aahz wrote: In article <4a0c6e42$0$12031$426a7...@news.free.fr>, Bruno Desthuilliers wrote: Marco Mariani a �crit : Bruno Desthuilliers wrote: Oh, you meant the "return type" ? Nope, no way. It just doesn't make sense given Python's dynamic typing. Unless he's really trying to write in Noht

Re: introspection question: get return type

2009-05-14 Thread Aahz
In article <4a0c6e42$0$12031$426a7...@news.free.fr>, Bruno Desthuilliers wrote: >Marco Mariani a écrit : >> Bruno Desthuilliers wrote: >>> >>> Oh, you meant the "return type" ? Nope, no way. It just doesn't make >>> sense given Python's dynamic typing. >> >> Unless he's really trying to write i

Re: introspection question: get return type

2009-05-14 Thread Bruno Desthuilliers
Marco Mariani a écrit : Bruno Desthuilliers wrote: Oh, you meant the "return type" ? Nope, no way. It just doesn't make sense given Python's dynamic typing. I thought that the OP was writing a tool to document not-very-dynamic code. Unless he's really trying to write in Nohtyp, You mean

Re: introspection question: get return type

2009-05-14 Thread Marco Mariani
Bruno Desthuilliers wrote: Oh, you meant the "return type" ? Nope, no way. It just doesn't make sense given Python's dynamic typing. I thought that the OP was writing a tool to document not-very-dynamic code. Unless he's really trying to write in Nohtyp, the language where value types are mo

Re: introspection question: get return type

2009-05-14 Thread bearophileHUGS
On the other hand, generally good programming practice suggests you to write functions that have a constant return type. And in most programs most functions are like this. This is why ShedSkin can indeed infer the return type of functions in "good behaved" programs. To do this ShedSkin uses a quite

Re: introspection question: get return type

2009-05-14 Thread Bruno Desthuilliers
flam...@gmail.com a écrit : Hello, I am wondering if it's possible to get the return value of a method *without* calling it Getting the return *value* without calling the function ? heck, that would be really helpful - we'd save quiet a lot on function call overhead and function execution tim

Re: introspection question: get return type

2009-05-14 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > flam...@gmail.com wrote: > >> Hello, >> I am wondering if it's possible to get the return value of a method >> *without* calling it using introspection? > > Nope. All that's possible to see if there is a implicit or explicit return > through dis.disassemble - if you fin

Re: introspection question: get return type

2009-05-14 Thread bearophileHUGS
flam...@gmail.com: > I am wondering if it's possible to get the return value of a method > *without* calling it using introspection? Python is dynamically typed, so you can create a function like this: >>> foo = lambda x: "x" if x else 1 >>> foo(1) 'x' >>> foo(0) 1 The return type of foo() chang

Re: introspection question: get return type

2009-05-14 Thread Diez B. Roggisch
flam...@gmail.com wrote: > Hello, > I am wondering if it's possible to get the return value of a method > *without* calling it using introspection? Nope. All that's possible to see if there is a implicit or explicit return through dis.disassemble - if you find "LOAD_CONST None" before any return-

introspection question: get return type

2009-05-14 Thread flamz3d
Hello, I am wondering if it's possible to get the return value of a method *without* calling it using introspection? something like this, suppose I want to know the type of the return value for the method "getsomething". Is it possible to get it without actually calling 'getsomething'? ex: import

Re: introspection question

2008-01-07 Thread Peter Otten
Alex K wrote: Please don't top-post. > On 07/01/2008, Peter Otten <[EMAIL PROTECTED]> wrote: >> Alex K wrote: >> >> > What would be the simplest way of enumerating all methods and members >> > (including inherited) of a given object? Thank you. >> >> inspect.getmembers() > Nice thank you. But an

Re: introspection question

2008-01-07 Thread Guilherme Polo
2008/1/7, Alex K <[EMAIL PROTECTED]>: > Nice thank you. But anyway to make it look pretty? > pprint.pprint(inspect.getmembers(someobject)) > On 07/01/2008, Peter Otten <[EMAIL PROTECTED]> wrote: > > Alex K wrote: > > > > > What would be the simplest way of enumerating all methods and members > >

Re: introspection question

2008-01-07 Thread Alex K
Nice thank you. But anyway to make it look pretty? On 07/01/2008, Peter Otten <[EMAIL PROTECTED]> wrote: > Alex K wrote: > > > What would be the simplest way of enumerating all methods and members > > (including inherited) of a given object? Thank you. > > inspect.getmembers() > > Peter > -- > htt

Re: introspection question

2008-01-07 Thread Peter Otten
Alex K wrote: > What would be the simplest way of enumerating all methods and members > (including inherited) of a given object? Thank you. inspect.getmembers() Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: introspection question

2008-01-07 Thread Guilherme Polo
2008/1/7, Alex K <[EMAIL PROTECTED]>: > Hi Guys, > > What would be the simplest way of enumerating all methods and members > (including inherited) of a given object? Thank you. > > Alex > -- > http://mail.python.org/mailman/listinfo/python-list > import inspect inspect.getmembers(yourobject) --

introspection question

2008-01-07 Thread Alex K
Hi Guys, What would be the simplest way of enumerating all methods and members (including inherited) of a given object? Thank you. Alex -- http://mail.python.org/mailman/listinfo/python-list