4 ms·
But. to do `help(thing)` you need to know what the _thing_ is. With Python, many times I vaguely know something but dunno what it is exactly. This cheatsheet s
by legends2k 8y ago
But. to do `help(thing)` you need to know what the _thing_ is.
With Python, many times I vaguely know something but dunno what it is exactly. This cheatsheet solves that!
- avip 8y agoYou can call help on anything. Here I am asking for help on something I have no clue about: >>> from server.db import db >>> help(db) help on Client in module google.cloud.firestore_v1beta1.client object: class Client(google.cloud.client.ClientWithProject) | Client(project=None, credentials=None, database='(default)') | | Client for interacting with Google Cloud Firestore API. | | .. note:: | | Since the Cloud Firestore API requires the gRPC transport, no | ``_http`` argument is accepted by this class. ...
- projectramo 8y agoI think legends 2k means you may not know the name of a function you need to use in something you are trying to implement. Example: Suppose you didn't know that re was what you needed for regular expression, or suppose you forgot how iterators work etc.
- avip 8y agoSure, that's why it's #2 on "2 Hard things in CS". Should probably be #1.
- billfruit 8y agoIs there some way to list all modules available for importing? Some times you don't know which modules are available to ask the help for it.
- avip 8y ago>>> help('modules')
- vram22 8y agoRelated post on my blog: Get names and types of a Python module's attributes: https://jugad2.blogspot.com/2016/10/get-names-and-types-of-python-modules.html https://jugad2.blogspot.com/2016/10/get-names-and-types-of-p... and the same recipe on ActiveState Code (from where you can download the Python code for the recipe): https://code.activestate.com/recipes/580705-get-names-and-types-of-all-attributes-of-a-python-/?in=user-4173351 https://code.activestate.com/recipes/580705-get-names-and-ty...