On Sat, Jul 2, 2016 at 12:49 AM, BartC <[email protected]> wrote:
> Why not just extend the capabilities of a class? I actually thought this
> would work until I tried it and it didn't:
>
> class C():
> def fn():
> print ("Hi!")
>
> C.fn()
>
> The error message suggests Python knows what's going on. So why not just
> make it work?
rosuav@sikorsky:~$ python3
Python 3.6.0a2+ (default:57f3514564f6, Jun 29 2016, 16:27:34)
[GCC 5.3.1 20160528] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class C():
... def fn():
... print ("Hi!")
...
>>> C.fn()
Hi!
>>>
But if you have two such functions, they can't call each other without
the namespace marker.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list