#29278: FileResponse documentation should warn against using context managers
-------------------------------------+-------------------------------------
Reporter: Mike DePalatis | Owner: Windson
Type: | yang
Cleanup/optimization | Status: assigned
Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by andrei kulakov):
Replying to [comment:5 Mike DePalatis]:
>
> I don't think all Python features need to be documented. However, this
is a special case where the required way of opening a file goes against
the usual best practices and thus it makes sense that this should be
explicitly noted.
In theory, perhaps, but in this case someone using this best practice
needs to understand the reason for 'with' construct. It's a fairly common
construct and its
use is much more general than just file objects. Also the way it works is
neither very obscure nor complex to understand.
You could also argue that the best practice is "use with construct and
complete all work on file within the `with` block", and so this best
practice does not apply
here because obviously no work is completed in the example.
--
Ticket URL: <https://code.djangoproject.com/ticket/29278#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.42ec96952d2f1300ff7f1285fa61aee9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.