| | |
Inherit Calendar
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
I'm not very certain on classes and stuff like that myself but i'm guessing and from what i've read i think if you do
can't guarantee it will work (not on my computer so i can't get at python to try it)
but it's just an idea
Python Syntax (Toggle Plain Text)
class namehere(calender_name): stuff here
but it's just an idea
You can only inherit another class. The module calendar contains a function calendar, but you can't inherit a function. This small code might explain a few basic things ...
Note: A class name by convention starts with a capital letter, this can be a hint!
python Syntax (Toggle Plain Text)
import calendar import Cookie import inspect if inspect.isclass(calendar): print "calendar is a class" else: print "calendar is not a class" # this would give you an error since calendar is not a class, but a module # there is a function (not a class) calendar within module calendar # you can use functions like calendar.calendar(), but not inherit them """ class MyCalendar(calendar): pass """ if inspect.isclass(Cookie.Morsel): print "Cookie.Morsel is a class" else: print "Cookie.Morsel is not a class" # this will work, since Morsel is a class in module Cookie class MyCookie(Cookie.Morsel): "now do something more than pass" pass print type(calendar) # <type 'module'> print type(calendar.calendar) # <type 'function'> print type(Cookie) # <type 'module'> print type(Cookie.Morsel) # <type 'type'> hint of class
Last edited by vegaseat; Oct 1st, 2009 at 4:59 pm.
May 'the Google' be with you!
![]() |
Similar Threads
- MAC OS 9.x calendar program (OS 7 / 8 / 9)
- help with polymorphism and inheritance...getting null values (Java)
- help with sort using Calendar class getting null pointer exception (Java)
- New Calendar !! (DaniWeb Community Feedback)
Other Threads in the Python Forum
- Previous Thread: Python's Profiler
- Next Thread: see my errors :-(
| Thread Tools | Search this Thread |
Tag cloud for Python
accessdenied apache application argv beginner book change code color dictionary dynamic edit editing enter examples excel file filename float format ftp function gui homework import inches input java keyboard lapse library line lines linux list lists loop microphone mouse movingimageswithpygame mysql newb number numbers numeric output parameters parsing path port prime program programming projects py2exe pygame pyopengl pyqt python random recursion recursive redirect remote reverse rpg scrolledtext search server session simple smtp software sprite ssh statictext string strings syntax table tennis terminal text thread threading time tkinter tlapse trick tuple tutorial ubuntu unicode unit urllib urllib2 variable windows wordgame wxpython






