Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialYiyang Tang
2,655 PointsIs treehouse python complier python2 or 3?
I've been practicing with the super() function but found out that the treehouse compiler doesn't accept super().method() since python2 requires format like super(ChildClass, self).method.
Why is that and is treehouse using the old python?
2 Answers
Steven Parker
231,261 PointsTreehouse uses Python 3. One obvious way to tell is that in Python 3, "print" is implemented as a function, but it is a keyword in Python 2.
Python 3 also uses "super", and it is covered in the courses. If you're having a specific problem with it, try starting a new question and be sure to include your code and a link to the course page (if any).
Chris Freeman
Treehouse Moderator 68,441 PointsThe Treehouse workspaces are using Python 3.5.0 by default.
treehouse:~/workspace$ python
Python 3.5.0 (default, Nov 28 2017, 19:33:11)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
treehouse:~/workspace$ python -V
Python 3.5.0
Example code:
class Sup:
def __init__(self, name="foo"):
self.name = name
class Dep(Sup):
def __init__(self):
super().__init__(name="Depster")
Results:
treehouse:~/workspace$ python
Python 3.5.0 (default, Nov 28 2017, 19:33:11)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from super_test import Sup, Dep
>>> d = Dep()
>>> d.name
'Depster'
>>> s = Sup()
>>> s.name
'foo'
Can you give a larger example of code that is not working for you? Perhaps snapshot your workspace and share the link.