4 ms·
Getting Help [in Python]
- notso411 3y ago[dead]
- ericra 3y agoI think that help() is great too, but I'm not a fan of the interactive nature of it. I'd rather the raw text just get dumped to a file so I can browse it more easily, so I do something like this[1] to print the output of both the help() and dir() functions on any Python object to a text file in the current directory. That way it's a bit easier to search through if it's a lot of info. [1] https://github.com/EricRa/python-scripts/blob/main/modules/print_help/print_help.py https://github.com/EricRa/python-scripts/blob/main/modules/p...
- SushiHippie 3y agoYou could also make use of the pydoc command either dump the help text via python -m pydoc requests.Request > req_help.txt or open a web server to browse the modules and their help texts via python -m pydoc -b
- worik 3y agoWhy is Python so popular? I do not understand * It has syntax from hell. Significant white-space, tabs are not spaces... I used to configure emacs to convert tabs to spaces... Silly me * It is achingly slow (and often a memory hog, thinking of Django requiring 2GB to install). This might not matter if it were only used as a script glue, but larger and larger applications keep getting built in python. Why? * It does not maintain backward compatibility. I recently moved to Debian-12, and two important, to me, big python systems failed: Yocto and mod-ui. It was the difference between 3.10 and 3.27(?what ever is on Debian 12) It looks like a complete mess from where I sit. That last point, lack of backward compatibility is, IMO, a reason to *not* use python for anything that is expected to be around for a while. And it is hugely popular. Why?
- deleted 3y ago[deleted]
- chrismcb 3y agoI'm not sure what converting tabs to spaces had to do with Python. I convert tabs to spaces and python runs just fine. Yes there enforcing of whitespace is one thing I don't like. Django is not Python. Django is a nice framework, but not a requirement. What other syntax don't you like. There have been breaking changes, especially going from 2.x to 3.x. you also can't go backwards. Not aware of issues going forward from 3.x. On the other hand it is fairly easy to migrate from 2.x to 3.x.
- worik 3y ago> There have been breaking changes, especially going from 2.x to 3.x. That would be tolerable. That is what major version changes are for. Crudly put Debian 11 to Debian 12 introduced breaking changes that I (from memory) tracked down to things introduced in 3.10 or 3.11 > I'm not sure what converting tabs to spaces had to do with Python. This is a minor gripe but I do not like tabs, I like tab stops, so I convert tabs to the spaces required to reach a tab stop. Tabs are the syntax required for Python. A bunch of spaces are not enough. Or do I have that horribly wrong (would not be the first time) It is the breaking changes in version 3 that have made me an anti evangelist for Python. Not being able to run `mod-ui`, and friends in particular. I dug around trying to make it work, and it was a mess. (Not mod-ui, love your work, but the Python).
- BerislavLopac 3y ago> Tabs are the syntax required for Python. A bunch of spaces are not enough. Yes, you got this very wrong. Yes, whitespace is significant in Python, but it can be either tabs or spaces, as long as it's consistent; although PEP8 [0] recommends using 4 spaces per level of indentation. It's hard to tell what your issue with backward compatibility was exactly without examples. You are not wrong, Python does occasionally introduces backward incompatible changes - but in most cases they follow a clear deprecation process, announcing a change long before it is eventually introduced. [0] https://pep8.org/ https://pep8.org/
- zem 3y agounfortunately, the `help` system also has no provision for finding out where `sleep()` is defined. (google finds it easily, of course)