[Django] #22712: Consider not using built-in functions as parameters

42 views
Skip to first unread message

Django

unread,
May 27, 2014, 1:57:03 PM5/27/14
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+--------------------
Reporter: Naddiseo | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.staticfiles | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+--------------------
Currently the staticfiles finders' `find` function has a paramter `all`
which is also a built-in function. Personally, I consider using built-ins
as parameters/variables to be bad form, and would usually just rename the
parameter in my subclasses. Unfortunately, `find` is explicitly called
with `all=all` in `django.contrib.staticfiles.finders.find()`. So, to use
the built in `all()` one needs to use `from __builtin__ import all as
all_`.

There are probably more examples throughout the codebase, but this is the
one I've run into.

--
Ticket URL: <https://code.djangoproject.com/ticket/22712>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 28, 2014, 7:38:36 PM5/28/14
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------

Reporter: Naddiseo | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.staticfiles | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timo):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Unfortunately, I think changing this is not going to be worth it,
backwards compatibility wise. Will leave it open for a second opinion
though.

--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:1>

Django

unread,
May 29, 2014, 1:13:22 PM5/29/14
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------

Reporter: Naddiseo | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.staticfiles | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Naddiseo):

* cc: Naddiseo (added)


Comment:

Couldn't the arguments undergo the normal django deprecation cycle? For
two version accept both, but issue a warning if the builtin version is
used.

--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:2>

Django

unread,
Jun 6, 2014, 12:07:17 PM6/6/14
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
--------------------------------------+------------------------------------
Reporter: Naddiseo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.staticfiles | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

The `all` kwarg is a private API, so we can change it. However, we should
check whether this is going to break popular third-party addons. (I don't
know the staticfiles landscape very well.)

--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:3>

Django

unread,
Jan 17, 2017, 4:37:25 PM1/17/17
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
--------------------------------------+------------------------------------
Reporter: Richard Eames | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.staticfiles | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Description changed by Anton Samarchyan:

Old description:

> Currently the staticfiles finders' `find` function has a paramter `all`
> which is also a built-in function. Personally, I consider using built-ins
> as parameters/variables to be bad form, and would usually just rename the
> parameter in my subclasses. Unfortunately, `find` is explicitly called
> with `all=all` in `django.contrib.staticfiles.finders.find()`. So, to use
> the built in `all()` one needs to use `from __builtin__ import all as
> all_`.
>
> There are probably more examples throughout the codebase, but this is the
> one I've run into.

New description:

Currently the staticfiles finders' `find` function has a parameter `all`


which is also a built-in function. Personally, I consider using built-ins
as parameters/variables to be bad form, and would usually just rename the
parameter in my subclasses. Unfortunately, `find` is explicitly called
with `all=all` in `django.contrib.staticfiles.finders.find()`. So, to use
the built in `all()` one needs to use `from __builtin__ import all as
all_`.

There are probably more examples throughout the codebase, but this is the
one I've run into.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:4>

Django

unread,
Jun 8, 2024, 6:51:21 PM6/8/24
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------
Reporter: Richard Eames | Owner: avallbona
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.staticfiles | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by avallbona):

* owner: nobody => avallbona
* status: new => assigned

Comment:

I think I can work on this ticket. I've created a draft pull request
[https://github.com/django/django/pull/18259 PR] Let me know what do you
think about it.
--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:5>

Django

unread,
Jun 8, 2024, 6:56:03 PM6/8/24
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------
Reporter: Richard Eames | Owner: avallbona
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.staticfiles | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by avallbona):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:6>

Django

unread,
Jun 20, 2024, 12:59:36 PM6/20/24
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------
Reporter: Richard Eames | Owner: Andreu
Type: | Vallbona
Cleanup/optimization | Status: assigned
Component: contrib.staticfiles | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1
* needs_docs: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:7>

Django

unread,
Jun 27, 2024, 10:01:11 PM6/27/24
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------
Reporter: Richard Eames | Owner: Andreu
Type: | Vallbona
Cleanup/optimization | Status: assigned
Component: contrib.staticfiles | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 1 => 0
* needs_docs: 1 => 0
* stage: Accepted => Ready for checkin
* version: 1.6 => dev

--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:8>

Django

unread,
Jun 27, 2024, 10:37:23 PM6/27/24
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------
Reporter: Richard Eames | Owner: Andreu
Type: | Vallbona
Cleanup/optimization | Status: closed
Component: contrib.staticfiles | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nessita <124304+nessita@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"0fdcf1029cea2d43bd68c5270f48e0f7deab5e47" 0fdcf102]:
{{{#!CommitTicketReference repository=""
revision="0fdcf1029cea2d43bd68c5270f48e0f7deab5e47"
Fixed #22712 -- Avoided name shadowing of "all" in
django.contrib.staticfiles.finders.

Co-authored-by: Natalia <124304+...@users.noreply.github.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:9>

Django

unread,
Jun 28, 2024, 8:37:41 AM6/28/24
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------
Reporter: Richard Eames | Owner: Andreu
Type: | Vallbona
Cleanup/optimization | Status: closed
Component: contrib.staticfiles | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia Bidart):

8719a6181ee6e81282822598e7f14d2d5c9b4c3c is a correction of the
deprecation, features deprecated in Django 5.2 should be removed in Django
6.1.
--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:10>

Django

unread,
Aug 28, 2024, 10:44:14 AM8/28/24
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------
Reporter: no | Owner: Andreu
Type: | Vallbona
Cleanup/optimization | Status: closed
Component: contrib.staticfiles | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"6bd5d4f7055c999e5ef1f51f08bc48c8853a4e0a" 6bd5d4f]:
{{{#!CommitTicketReference repository=""
revision="6bd5d4f7055c999e5ef1f51f08bc48c8853a4e0a"
Refs #22712 -- Adjusted deprecation warning stacklevel in staticfiles
finders.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:11>

Django

unread,
Sep 17, 2025, 2:17:17 PM9/17/25
to django-...@googlegroups.com
#22712: Consider not using built-in functions as parameters
-------------------------------------+-------------------------------------
Reporter: no | Owner: Andreu
Type: | Vallbona
Cleanup/optimization | Status: closed
Component: contrib.staticfiles | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"a146fe293099d7f860ba13e4b3a571bbda55af22" a146fe29]:
{{{#!CommitTicketReference repository=""
revision="a146fe293099d7f860ba13e4b3a571bbda55af22"
Refs #22712 -- Removed all parameter from
django.contrib.staticfiles.finders.find().

Per deprecation timeline.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22712#comment:12>
Reply all
Reply to author
Forward
0 new messages