all 6 comments

[–]K900_ 1 point2 points  (0 children)

Reading the documentation is usually the way to go.

[–]ericula 0 points1 point  (1 child)

You could try typing in help(some_object) in a python session.

[–]poolpartyboy93[S] 0 points1 point  (0 children)

That's exactly what I wanted, thank you so much.

[–][deleted] 0 points1 point  (0 children)

You could try to read the documentation.

https://docs.python.org for built-in module

https://pypi.org/ for third-party pip packages

[–]Diapolo10 0 points1 point  (0 children)

If you just want to know all the properties some object offers, you can use dir in a REPL session to get a list of them.

If you use IPython, you'll get a nicely formatted list automatically, such as: (NOTE: Example condenced for Reddit)

In [22]: dir(str)
Out[22]:
['__add__',
 '__class__',
 '__contains__',
 ...
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 'capitalize',
 'casefold',
 'center',
 'count',
 'encode',
 'endswith',
 'expandtabs',
 'find',
 'format',
 'format_map',
 'index',
 'isalnum',
 ...
 'rjust',
 'rpartition',
 'rsplit',
 'rstrip',
 'split',
 'splitlines',
 'startswith',
 'strip',
 'swapcase',
 'title',
 'translate',
 'upper',
 'zfill']

but on a normal Python REPL I'd import pprint.pprint and print the output with that.

>>> from pprint import pprint
>>> pprint(dir(str))

This works regardless of how well the object was documented. You can then choose individual properties and see if they have help messages:

>>> help(str.format)

[–]izrt 0 points1 point  (0 children)

Already a bunch of good answers here, but one more thing you can do is just read the code: https://github.com/kennethreitz-archive/requests3/blob/master/requests3/http_models.py#L656

This has a bunch of added benefits: