| | |
Static functions in 2.5
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2008
Posts: 11
Reputation:
Solved Threads: 0
Could somebody give me a snippet of code, where two classes that exist in different files, with one is calling a user defined static method of the other.
All I can find on the internet is examples where they only work with the static method being called with in the class file. I cannot call that method from another class.
Thanks
All I can find on the internet is examples where they only work with the static method being called with in the class file. I cannot call that method from another class.
Thanks
•
•
Join Date: Jun 2008
Posts: 11
Reputation:
Solved Threads: 0
This is my predicament
Within another file
Error that I am getting :-
ATTRIBUTEERROR: 'module' object has no attribute 'printDamnIT'
Python Syntax (Toggle Plain Text)
class Object1: @staticmethod def printDamnIT(): print 'PRINT DAMN IT!' # You can see I'm getting very frustrated
Within another file
Python Syntax (Toggle Plain Text)
import sys sys.path.append('C:\') import Object1 Object1.printDamnIT()
Error that I am getting :-
ATTRIBUTEERROR: 'module' object has no attribute 'printDamnIT'
![]() |
Similar Threads
- Static use (C#)
- Static virtual functions - Reasons (C++)
- What is Static functions (C)
- static function (C)
- What is Static Friend function (C)
- static friend function (C)
- Practical application of static member function (C++)
- accessing private data members (C++)
Other Threads in the Python Forum
- Previous Thread: turtle.setup(width=800,height=600,startx=400,starty=300)
- Next Thread: Newbie Question
| Thread Tools | Search this Thread |
abrupt ansi anti approximation assignment avogadro backend beginner binary bluetooth calculator character cmd code customdialog data decimals dictionaries dictionary directory drive dynamic error examples exe file float format function gnu graphics gui heads homework http ideas import input java launcher leftmouse line linux list lists logging loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule script scrolledtext sqlite statistics stdout string strings sudokusolver sum table terminal text thread threading time tlapse tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable ventrilo wikipedia windows write wxpython xlib






