list in ListModelMixin could overwrite the builtins list method of python and causes error #9159
Answered
by
carltongibson
ghostinthefingers
asked this question in
Potential Issue
-
list in ListModelMixin could overwrite the builtins list method of python and causes error, isn't it better to change the name of class SomeViewSet(viewsets.ModelViewSet):
def list(self, request, *args, **kwargs):
return Response(
{"message": "List function is not offered in this path"},
status.HTTP_405_METHOD_NOT_ALLOWED
) then wanna use the builtins list function of python in my code and I get an error, because I already overwrote it: def create(...):
return list('123') |
Beta Was this translation helpful? Give feedback.
Answered by
carltongibson
Nov 21, 2023
Replies: 2 comments 2 replies
-
@encode/django-rest-framework team, what is your thoughts? |
Beta Was this translation helpful? Give feedback.
2 replies
-
Also, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
auvipy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also,
list
is a bound method so it's accessed asself.list
notlist
, so there's no shadowing.