Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

how to display the return type of an os method?

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


rpjday at crashcourse

Nov 7, 2009, 10:12 AM

Post #1 of 3 (255 views)
Permalink
how to display the return type of an os method?

once again, a thoroughly newbie question but what's the quickest way
to display the return type of, say, os.stat()? i can obviously do
this in two steps:

>>> x=os.stat('/etc/passwd')
>>> type(x)
<class 'posix.stat_result'>
>>>

i'd just like to see that os.stat() returns a posix.stat_result
object in one line. how dumb a question is that?

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================
--
http://mail.python.org/mailman/listinfo/python-list


bdesth.quelquechose at free

Nov 7, 2009, 9:29 AM

Post #2 of 3 (227 views)
Permalink
Re: how to display the return type of an os method? [In reply to]

Robert P. J. Day a écrit :
> once again, a thoroughly newbie question but what's the quickest way
> to display the return type of, say, os.stat()? i can obviously do
> this in two steps:
>
>>>> x=os.stat('/etc/passwd')
>>>> type(x)
> <class 'posix.stat_result'>
>
> i'd just like to see that os.stat() returns a posix.stat_result
> object in one line.

=> type(os.stat('/etc/passwd'))

But reading the doc might help too:

=> help(os.stat)

--
http://mail.python.org/mailman/listinfo/python-list


rpjday at crashcourse

Nov 7, 2009, 10:50 AM

Post #3 of 3 (225 views)
Permalink
Re: how to display the return type of an os method? [In reply to]

On Sat, 7 Nov 2009, Bruno Desthuilliers wrote:

> Robert P. J. Day a écrit :
> > once again, a thoroughly newbie question but what's the quickest way
> > to display the return type of, say, os.stat()? i can obviously do
> > this in two steps:
> >
> >>>> x=os.stat('/etc/passwd')
> >>>> type(x)
> > <class 'posix.stat_result'>
> >
> > i'd just like to see that os.stat() returns a posix.stat_result
> > object in one line.
>
> => type(os.stat('/etc/passwd'))
>
> But reading the doc might help too:
>
> => help(os.stat)

never mind, i realize now it was a dumb question since the return
type is based on the routine logic, of course. argh. carry on.

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.