[issue10438] list an example for calling static methods from WITHIN classes

Ian report at bugs.python.org
Tue Nov 16 21:23:32 CET 2010


New submission from Ian <ifreecarve at gmail.com>:

Concerning this section of the docs:
http://docs.python.org/library/functions.html#staticmethod

There is no example for calling a static method from another static method within the same class.

As I discovered later, it's simple: C.f() -- from inside the class or outside it.

A total newbie will accept this and move on... but in other programming languages, it's frowned upon to the class name from within the class.  For example, in PHP you use the "self::" prefix and Java you don't need a prefix at all.  

So, even though I had it right the first time, it didn't SEEM right... so I went on a wild goose chase, for nothing.  Googling "java call static method" will get you java documentation that lists both cases, as does "c++ call static method" and "php call static method".  

I feel that by adding "Note: you must also use the C.f() syntax when calling from within the class", the documentation will be more complete.

----------
assignee: docs at python
components: Documentation
messages: 121314
nosy: docs at python, ifreecarve
priority: normal
severity: normal
status: open
title: list an example for calling static methods from WITHIN classes
type: feature request

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10438>
_______________________________________


More information about the Python-bugs-list mailing list