Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#20691 closed Cleanup/optimization (fixed)

Documentation for "Choosing between __str__() and __unicode__()" is written for Python2 specifically

Reported by: Jim Garrison Owned by: nobody
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: timograham@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

At https://docs.djangoproject.com/en/dev/ref/unicode/#choosing-between-str-and-unicode it should be mentioned that __str__() is to be used instead of __unicode__() in Python3. And a note about Python2 compatibility for using __str__() should be provided.

Attachments (2)

20691.diff (690 bytes) - added by Tim Graham 3 years ago.
20691.2.diff (743 bytes) - added by Tim Graham 3 years ago.

Download all attachments as: .zip

Change History (9)

Changed 3 years ago by Tim Graham

Attachment: 20691.diff added

comment:1 Changed 3 years ago by Tim Graham

Cc: timograham@… added
Has patch: set
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization
Version: 1.5master

comment:2 Changed 3 years ago by Claude Paroz

Patch needs improvement: set

I think I would have written a note at the start of the subsection: If you are on Python 3, you can skip this section because you'll always create __str__().... This can prevent a Python 3 user to read the paragraph just to finally realize that he's not concerned.

Changed 3 years ago by Tim Graham

Attachment: 20691.2.diff added

comment:3 Changed 3 years ago by Tim Graham

Patch needs improvement: unset

comment:4 Changed 3 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin

LVGTM :-)

comment:5 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In 8a679386c3924026f8558f9cd0164890a9461e2c:

Fixed #20691 -- Added a note for str() vs. unicode() and Python 3.

Thanks garrison for the suggestion.

comment:6 Changed 3 years ago by Tim Graham <timograham@…>

In b36f55c5a5bc7e3dac8a811973c7f7ad1c92d7c5:

[1.6.x] Fixed #20691 -- Added a note for str() vs. unicode() and Python 3.

Thanks garrison for the suggestion.

Backport of 8a679386c3 from master.

comment:7 Changed 3 years ago by Tim Graham <timograham@…>

In 4453d8651af4579b3b83d873cadbda0707b7ab2a:

[1.5.x] Fixed #20691 -- Added a note for str() vs. unicode() and Python 3.

Thanks garrison for the suggestion.

Backport of 8a679386c3 from master.

Note: See TracTickets for help on using tickets.
Back to Top