Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#20691 closed Cleanup/optimization (fixed)

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

Reported by: 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 timo 2 years ago.
20691.2.diff (743 bytes) - added by timo 2 years ago.

Download all attachments as: .zip

Change History (9)

Changed 2 years ago by timo

comment:1 Changed 2 years ago by timo

  • Cc timograham@… added
  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization
  • Version changed from 1.5 to master

comment:2 Changed 2 years ago by claudep

  • 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 2 years ago by timo

comment:3 Changed 2 years ago by timo

  • Patch needs improvement unset

comment:4 Changed 2 years ago by claudep

  • Triage Stage changed from Accepted to Ready for checkin

LVGTM :-)

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

  • Resolution set to fixed
  • Status changed from new to closed

In 8a679386c3924026f8558f9cd0164890a9461e2c:

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

Thanks garrison for the suggestion.

comment:6 Changed 2 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 2 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