Opened 18 years ago
Closed 18 years ago
#5761 closed (invalid)
Use random.sample, don't reimplement it
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Contrib apps | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | 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 (last modified by )
Python's standard library since 2.3 has had random.sample for choosing random elements of a sequence. In contrib/auth/models.py, the implementor was unaware of this and wrote a bit more code than needed.
Attachments (2)
Change History (5)
by , 18 years ago
| Attachment: | password.diff added |
|---|
comment:1 by , 18 years ago
| Component: | Uncategorized → Contrib apps |
|---|---|
| Description: | modified (diff) |
| Has patch: | set |
| Summary: | Minor refactoring → Use random.sample, don't reimplement it |
| Triage Stage: | Unreviewed → Accepted |
| Version: | 0.96 → SVN |
I changed the title and description to be clearer, and updated it to Django-SVN, since 0.96 won't get patched for this, and it's still there in trunk.
comment:2 by , 18 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:3 by , 18 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
random.sample samples without replacement. The existing code is equivalent to sampling with replacement.
Note:
See TracTickets
for help on using tickets.
patch