This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author berker.peksag
Recipients berker.peksag, brett.cannon, docs@python, matrixise, mdk, ned.deily, serhiy.storchaka, vstinner
Date 2019-05-10.08:00:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> I looked at other examples: they are nice but far from a "real application".

You can use the same argument for pretty much every example in the stdlib documentation :)

wsgiref is a low level module, users should use projects like WebOb instead. Also, a complete example would need to contain basic routing and middleware support (which is not easy to implement correctly)

> Would you mind to elaborate? I don't understand what you mean by "naming convention" here, sorry.

For example, the response() callable in the example is explicitly documented as start_response() in PEP 3333:

You can read PEP 3333 for more details.

> Do you mean that app() must not return FileWrapper? How do you return file content in that case?
> Maybe FileWrapper API should be clarified? It's surprising to read Python 3.8 mentioning compatibility with Python 2.1 :-)

The whole point of the API was to support both __getitem__ and __iter__ protocols at the same time without breaking user code. I've already deprecated the support for __getitem__ protocol (84a13fbda0d79789e3c9efcc9f64752261ce1e8d) because it wasn't working as expected (it ignores its 'index' argument)

Its only valid use case is to read a file chunk by chunk by using its blksize argument, but there are much better ways to achieve the same thing (use os.sendfile() or nginx :))

> Which kind of exceptions do you expect? The example checks if the file exists for example.

I'm talking about exceptions that can be raised by the application code, such as the one that I've mentioned (i.e. mimetypes) in my earlier comment.

Sorry, but it's not really a good example to put into documentation and it would be much better if we could save our bikeshedding bandwidth to other issues :)
Date User Action Args
2019-05-10 08:00:27berker.peksagsetrecipients: + berker.peksag, brett.cannon, vstinner, ned.deily, docs@python, serhiy.storchaka, matrixise, mdk
2019-05-10 08:00:27berker.peksagsetmessageid: <>
2019-05-10 08:00:27berker.peksaglinkissue36345 messages
2019-05-10 08:00:26berker.peksagcreate