python - how to find up-to-date documentation? [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am new to Python, and keep running into the same problem: I can't find up-to-date examples of common Python solutions.
For example, googling "python html parser" gives me this as first result:
http://docs.python.org/2/library/htmlparser.html
The problem is that the code in this official doc is not working on Python 3.3.2 on windows, which is the latest download.
For example:
from HTMLParser import HTMLParser # does NOT work for Python 3.3
is not working. Instead, one should use:
from html.parser import HTMLParser # works for Python 3.3
This is just one example. Also a significant number of Stackoverflow Python codes answers do not work straight; for example:
print "text" # does NOT work for Python 3.3
is now:
print ("text") # works for Python 3.3
So my question is: how can I find up-to-date documentation and code examples that work for Python 3.3 on windows?

You tell Google the version of Python: python 3.3 html parser
First result: http://docs.python.org/3/library/html.parser.html
Note that a lot of support libraries don't fully support Python 3.x at this time. Which is why Python 2 still is the default for many projects.
If you plan to stay on 3.3, you may want to read "What's New in Python", especially "What's New In Python 3.0".

If you see on the top left of the documentation page, there's 2.7.5, the latest version for Python under version 3. You can click it and choose your version for the most up to date documentation.
On the example you gave, the top mentions that the module has been renamed in Python 3. If we go to a module that works in both 2 and 3, such as itertools, changing the number will redirect you to the updated documentation on itertools.

here you can find Python 3 documentation: http://docs.python.org/3/

Related

Best practice for Testing with Python in VSC [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed last year.
Improve this question
I would like to ask for your recommendation about coding in Python, mainly with VSC. I have read several Python standards but I have several doubts about testing. I have found some good extensions in VSC marketplace and (to me) the more relevant are installed with Python Official Extension.
I have little experience with testing and I have only used unittest, but reading here I believe Pytest is far more complete, should I change to it?
A "basic" test extension is installed with Python Official Extension from VSC, but I don't know if there are better extensions for this. I suppose it is compatible with unittest, pytest and nose. What I don't is how to do test in several Python version with VSC, I believe is a good practice, but I don't know if I must have installed all the other Python versions to do this.
I have find some good extensions in VSC marketplace and (to me) the more relevant are installed with Python Official Extension
Yes this is correct. Most packages needed for basic python programming are included in the official extension. Ofcourse there are some great packages out there that aren't included but still can be quite usefull.
I have little experience with test and I have only use the unittest, but reading here I believe Pytest is far more complete, should I change to it?
Pytest is very easy to use and definatly a recommender, I use it myself and never thaught of changing.
What I don't is how to do test in several Python version with VSC
I recommend tox, their readme even has an example of exactly what you want to do, testing (with pytest) on multiple python versions.
Hope this clears things up.

Why Matplotlib 3.0? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I just discovered that Matplotlib 3.0 has been released. As the 2.0 release is still fresh in my memory (well, it's about one and a half year ago) and the fact that we are still just at 2.2, I wonder what made the developers opt for an increase to the major version number? The docs does not seem to hint at an explanation.
Edit
Since this question has been flagged as being "primarily opinion-based", let me add that I would like a link to some official explanation by the Matplotlib developers.
It is true that matplotlib 3.0 does not provide many new features that would usually require a major version number change.
The main point of version 3.0 is that it is python 3 only.
Dropping python 2.7 constitutes an API change and thus required a major version bump. While for people using python 3 anyways this API change may seem rather minor, people using python 2 will care a lot.
The step to go to python 3 only allowed the developpers to get rid of all the code that was needed to maintain compatibility between python 2 and python 3. Most of this is not seen from the outside, but cleaning up the codebase will now allow to move forward with new features a bit quicker. Also bugfixing is simplified a good bit, since no workarounds for python2/3 are needed any more.
More new features are to expected for the first minor version 3.1.
To summarize we now have
matplotlib 2.2.x which still supports python 2.7 and which will receive bugfixes until the official python 2 development ends in 2020, but which will not contain any more new features.
matplotlib 3.x which will be continuously developped from now on and supports python 3.5 or greater.
Because the question asks for some "official" statement, this mailing list entry initiated the versioning, which was then resceduled in this message. (note that in contrast to those, python 3.5 is still supported in matplotlib 3.0)

Why is there a python 3.x branch when we have continued development on the 2.x branch? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
The Python 2.x environment is stable and well-utilized by the current python community. And yet there is also a python 3.x branch of the language.
Why have we started a python 3.x branch? Does that imply that we are going to deprecate the 2.x branch anytime soon?
Can an experienced python developer explain the differences between the two and offer the best choice for a newbie who wants to learn the language?
If python 3.x is gonna be used longer, Are we solving the existing problems in 2.x like,
GIL issue for multithreading support?
Sorry if this question seems really basic but I would really like to learn!
Yes, the 2.x series is already deprecated in the sense that there will be no version 2.8 - 2.7 was the last 2.x major version.
The reason for the 2 to 3 change is because the 3.x branch makes certain backwards-incompatible changes (e.g. differentiating bytes and str, making print() a function rather than a statement, et cetera). This breaks compatibility with programs written for Python 2.x and as such requires special handling.
All new feature development is occurring in the 3.x branch. Some changes are being backported to 2.7.x versions, but that will only happen for so long - eventually, Python 2.7 will stop being maintained.
Python 3 breaks compatibility with Python 2.
This is pretty normal release management. When incompatible changes are introduced, previous major release branch is maintained for a period of time, sometimes a long one, alongside the new branch.

Is there an equivalent of PyMongo for Python 3.2? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I attempted to install pymongo to my Windows box with Python 3.2 through easy_install, only to find that it will not install due to incompatibilities with Python 3.2.
Therefore, is there an equivalent to pymongo that will work with Python 3.2? MongoDB is an integral part of the application I was developing on Python 2.7, and to move to Python 3.2 I will need to retain this interactivity.
Thanks!
Edit: this answer is outdated. PyMongo now officially supports Python 3.
The answer was already given in comments, but I'll provide a comprehensive summary nontheless:
As of May 2011, Python 3 is not officially supported by MongoDB
Ticket for "Support for Python 3" has been some years ago (https://jira.mongodb.org/browse/PYTHON-84) so the MongoDB developers are aware of this need.
As already told by Adam, there is a port of PyMongo for Python 3 in PyPi (http://pypi.python.org/pypi/pymongo3) which could be used and is defined as "semi-official"
Source codes for the Python 3 fork are available at https://github.com/sovnarkom/mongo-python3-driver
If you want make on impact on making this fork official make an upvote to its ticket (https://jira.mongodb.org/browse/PYTHON-84)
With enough upvotes/user requests, I would expect to get an official Python 3 driver someday
Starting with the 2.2 release PyMongo supports python 3.x where x >= 1.
http://pypi.python.org/pypi/pymongo
http://api.mongodb.org/python/current/python3.html
Via freenode and #web.

Alternative ways to browse the python api [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Is it just me, or the python standard library documentation is extremely difficult to browse through?
http://docs.python.org/3.1/library/index.html
http://docs.python.org/3.1/modindex.html
Java has its brilliant Javadocs, Ruby has its helpful Ruby-Docs, only in python I cannot find a good way to navigate through the standard library documentation.
There's the Epydoc project, which looks nice, but does anyone know if it is actually being used on the standard library, so we can all go through it? If not, what are the alternatives people are using to browse python documentation.
I usually use the built-in pydoc, if you are on windows it should be called Module Docs if you are on linux use pydoc -p 8000 and connect through browser.
pydoc from the command line, help() from the interactive interpreter prompt.
pydoc -p 8080
The python community is semi-hostile to automatically generated documentation, especially if it's Object-Orientated. Python isn't just object-orientated (it's a multi-paradigm language), so Python developers generally prefer human-written documentation. Sometimes the functions are important, sometimes the Class structure is important.
you can go to here and download the chm version of Python 3.1. With that, searching through the docs should be easy.
I used to use the python sidebar from Edgewall a long time ago.
These days, I google for the python function (the standard docs almost always show up as the first link).If I want to browse the source of the module (useful sometimes), I use this little shell function I wrote.
epy () {
cmd="import $1 as a ; print a.__file__.endswith('.pyc') and a.__file__[:-1] or a.__file__"
file=$(/usr/bin/env python -c $cmd)
echo $file
emacsclient --no-wait $file
}
I guess I'm going to get downvoted but I find nothing wrong with the Sphinx docs and I find them way way better than the java alternative.

Categories

Resources