docs
docs copied to clipboard
[New Entry/ Edits] Python Builtin-Functions: `super()`/ Inheritance
Description
Closes #586
Type of Change
- Adding a new entry
- Editing an existing entry (fixing a typo, bug, issues, etc)
Checklist
- [x] All writings are my own.
- [x] My entry follows the Codecademy Docs style guide.
- [x] My changes generate no new warnings.
- [x] I have performed a self-review of my own writing and code.
- [x] I have checked my entry and corrected any misspellings.
- [x] I have made corresponding changes to the documentation if needed.
- [x] I have confirmed my changes are not being pushed from my forked
main
branch. - [x] I have confirmed that I'm pushing from a new branch named after the changes I'm making.
- [x] Under "Development" on the right, I have linked any issues that are relevant to this PR (write "Closes #
in the "Description" above).
Added the super() term as discussed in issue #586
- created super.md under python/concepts/built-in-functions/terms/super
- removed super() from python inheritance entry
Added the super() term as discussed in issue #586
- created super.md under python/concepts/built-in-functions/terms/super
- removed super() from python inheritance entry
@beverand Thanks for submitting this PR! I'm looking forward to conducting the first review for this 😄
Quick tip: For your next PR, if you write "Closes #[this issue number]" (per the GitHub docs) in the "Description" near the top of the PR, the related issue will be linked to the PR. (No worries for this one, though; just edited the description 😎)
Thank you so much for the review. I didn't think it was going to be perfect so I was fully anticipating that corrections would need to be made. I will try to get these modifications in tonight and resubmit.
On Fri, Sep 16, 2022 at 2:27 PM Brandon Dusch @.***> wrote:
@.**** requested changes on this pull request.
@beverand https://github.com/beverand Finished with my review and just left some comments/suggestions for you to check out. I might have more later but I wanted to give you a chance to look at what I have so far. Let me know if you have any questions. 😄
In content/python/concepts/built-in-functions/terms/super/super.md https://github.com/Codecademy/docs/pull/1008#discussion_r973391079:
@@ -0,0 +1,53 @@
+---
+Title: 'super()'
+Description: 'implicitly refer to the superclass'
+Subjects:
- 'Computer Science'
⬇️ Suggested change
- 'Computer Science'
- 'Computer Science'
- 'Data Science'
Since Python is commonly used in data science.
In content/python/concepts/built-in-functions/terms/super/super.md https://github.com/Codecademy/docs/pull/1008#discussion_r973394614:
@@ -0,0 +1,53 @@
+---
+Title: 'super()'
+Description: 'implicitly refer to the superclass'
+Subjects:
- 'Computer Science'
+Tags:
- 'Functions'
- 'Objects'
- 'Inheritance'
+CatalogContent:
- 'learn-python-3'
- 'paths/computer-science'
+---
+The
super()
function is built into python and is used to refer to the the superclass of an object without specifically using the parent name.⬇️ Suggested change
-The
super()
function is built into python and is used to refer to the the superclass of an object without specifically using the parent name.+The
super()
function returns a temporary object that allows a given class to inherit the methods and properties of a parent or sibling class.
In content/python/concepts/built-in-functions/terms/super/super.md https://github.com/Codecademy/docs/pull/1008#discussion_r973397461:
+---
+The
super()
function is built into python and is used to refer to the the superclass of an object without specifically using the parent name.
+## Syntax
+```pseudo
+super().function()
+super(type)
+```
+##
super()
+
super()
returns a temporary object of the superclass, allowing the superclass’s methods to be called. This comes in handy when using multiple inheritance.
+## Example
⬇️ Suggested change
-## Example
+## Codebyte Example
Let's allow one empty line above and below each header.
In content/python/concepts/built-in-functions/terms/super/super.md https://github.com/Codecademy/docs/pull/1008#discussion_r973399307:
+## Syntax
+```pseudo
+super().function()
+super(type)
+```
+##
super()
+
super()
returns a temporary object of the superclass, allowing the superclass’s methods to be called. This comes in handy when using multiple inheritance.
+## Example
+In this case, the
.say_hi()
method is implemented utilizingsuper()
inside.intro()
:
+```py
⬇️ Suggested change
-```py
+```codebyte/python
In content/python/concepts/built-in-functions/terms/super/super.md https://github.com/Codecademy/docs/pull/1008#discussion_r973399720:
+The output would be:
+```shell
+Hi! I am a Programming Language.
+Python here!
+```
⬇️ Suggested change
-The output would be:
-```shell
-Hi! I am a Programming Language.
-Python here!
-```
If we choose to go with a Codebyte example, then these lines can be omitted; the output will appear on the screen after the code is run.
In content/python/concepts/inheritance/inheritance.md https://github.com/Codecademy/docs/pull/1008#discussion_r973400620:
@@ -68,28 +68,6 @@ Python here!
Note: Inside the child class, the same number and type of arguments need to be passed into the parent class' method.
⬇️ Suggested change
-Note: Inside the child class, the same number and type of arguments need to be passed into the parent class' method.
+> Note: Inside the child class, the same number and type of arguments need to be passed into the parent class' method.
In content/python/concepts/built-in-functions/terms/super/super.md https://github.com/Codecademy/docs/pull/1008#discussion_r973401467:
- 'Functions'
- 'Objects'
- 'Inheritance'
⬇️ Suggested change
- 'Functions'
- 'Objects'
- 'Inheritance'
- 'Classes'
- 'Functions'
- 'Inheritance'
- 'Methods'
- 'Objects'
- 'OOP'
In content/python/concepts/built-in-functions/terms/super/super.md https://github.com/Codecademy/docs/pull/1008#discussion_r973401977:
@@ -0,0 +1,53 @@
+---
+Title: 'super()'
+Description: 'implicitly refer to the superclass'
⬇️ Suggested change
-Description: 'implicitly refer to the superclass'
+Description: 'Returns a temporary object that allows a given class to inherit the methods and properties of a parent or sibling class.'
Let's make sure to use capitalization and punctuation. 😄
In content/python/concepts/built-in-functions/terms/super/super.md https://github.com/Codecademy/docs/pull/1008#discussion_r973399213:
+---
+The
super()
function is built into python and is used to refer to the the superclass of an object without specifically using the parent name.
+## Syntax
+```pseudo
+super().function()
+super(type)
+```
+##
super()
+
super()
returns a temporary object of the superclass, allowing the superclass’s methods to be called. This comes in handy when using multiple inheritance.
+## Example
Also let's rename this to "Codebyte Example" since Python is a supported language for runnable code snippets https://help.codecademy.com/hc/en-us/articles/1260806285369-Codebytes (which is compatible with Codecademy Docs 😄)
In content/python/concepts/inheritance/inheritance.md https://github.com/Codecademy/docs/pull/1008#discussion_r973400845:
@@ -68,28 +68,6 @@ Python here!
Note: Inside the child class, the same number and type of arguments need to be passed into the parent class' method.
Also, near the top on line # 16, can we bold the word "Inheritance"?
— Reply to this email directly, view it on GitHub https://github.com/Codecademy/docs/pull/1008#pullrequestreview-1111220391, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZUG6WHXZNSDMRI3GVT4E3V6TQ5VANCNFSM6AAAAAAQOCNCAQ . You are receiving this because you were mentioned.Message ID: @.***>
@beverand I would undo the changes in 4e8541efd800092196ecd3ce0448fe31d8a83597. When I suggested bolding "Inheritance" I meant the edit should happen in line # 16 in the inheritance.md
file (not the super.md
file). Content in the meta-information (first 13-15 lines of the file) should not be emphasized in any way.
Thank you for your patience helping me. I admit, I'm using vi in the terminal for all of my edits.
Thank you for your patience helping me. I admit, I'm using vi in the terminal for all of my edits.
I'm always happy to help 😄 and kudos for working with the repo through the vi
editor!
@beverand Would you be open to trying to format the entry on your side with the following command when you get a chance?
yarn format content/python/concepts/built-in-functions/terms/super/super.md content/python/concepts/inheritance/inheritance.md
@beverand Would you be open to trying to format the entry on your side with the following command when you get a chance?
yarn format content/python/concepts/built-in-functions/terms/super/super.md content/python/concepts/inheritance/inheritance.md
And then add
, commit
, and push
the changes like you normally would?
I think there are things I have to install to make that work
On Fri, Sep 16, 2022 at 4:21 PM Brandon Dusch @.***> wrote:
@beverand https://github.com/beverand Would you be open to trying to format the entry on your side with the following command when you get a chance?
yarn format content/python/concepts/built-in-functions/terms/super/super.md content/python/concepts/inheritance/inheritance.md
— Reply to this email directly, view it on GitHub https://github.com/Codecademy/docs/pull/1008#issuecomment-1249931669, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZUG6XITOB5UZ2QZW3QWLTV6T6F7ANCNFSM6AAAAAAQOCNCAQ . You are receiving this because you were mentioned.Message ID: @.***>
I am getting errors. Something with prettier or something with Arborist.
On Fri, Sep 16, 2022 at 4:31 PM Beverly Andrews @.***> wrote:
I think there are things I have to install to make that work
On Fri, Sep 16, 2022 at 4:21 PM Brandon Dusch @.***> wrote:
@beverand https://github.com/beverand Would you be open to trying to format the entry on your side with the following command when you get a chance?
yarn format content/python/concepts/built-in-functions/terms/super/super.md content/python/concepts/inheritance/inheritance.md
— Reply to this email directly, view it on GitHub https://github.com/Codecademy/docs/pull/1008#issuecomment-1249931669, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZUG6XITOB5UZ2QZW3QWLTV6T6F7ANCNFSM6AAAAAAQOCNCAQ . You are receiving this because you were mentioned.Message ID: @.***>
I am getting errors. Something with prettier or something with Arborist. On Fri, Sep 16, 2022 at 4:31 PM Beverly Andrews @.> wrote: … I think there are things I have to install to make that work On Fri, Sep 16, 2022 at 4:21 PM Brandon Dusch @.> wrote: > @beverand https://github.com/beverand Would you be open to trying to > format the entry on your side with the following command when you get a > chance? > > yarn format content/python/concepts/built-in-functions/terms/super/super.md content/python/concepts/inheritance/inheritance.md > > — > Reply to this email directly, view it on GitHub > <#1008 (comment)>, > or unsubscribe > https://github.com/notifications/unsubscribe-auth/AEZUG6XITOB5UZ2QZW3QWLTV6T6F7ANCNFSM6AAAAAAQOCNCAQ > . > You are receiving this because you were mentioned.Message ID: > @.***> >
Any chance you could copy/paste the exact error message here?
I've tried running yarn format super.md and also npm run format super. It's telling me jest: not found
On Fri, Sep 16, 2022 at 4:42 PM Beverly Andrews @.***> wrote:
I am getting errors. Something with prettier or something with Arborist.
On Fri, Sep 16, 2022 at 4:31 PM Beverly Andrews @.***> wrote:
I think there are things I have to install to make that work
On Fri, Sep 16, 2022 at 4:21 PM Brandon Dusch @.***> wrote:
@beverand https://github.com/beverand Would you be open to trying to format the entry on your side with the following command when you get a chance?
yarn format content/python/concepts/built-in-functions/terms/super/super.md content/python/concepts/inheritance/inheritance.md
— Reply to this email directly, view it on GitHub https://github.com/Codecademy/docs/pull/1008#issuecomment-1249931669, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZUG6XITOB5UZ2QZW3QWLTV6T6F7ANCNFSM6AAAAAAQOCNCAQ . You are receiving this because you were mentioned.Message ID: @.***>
Will this do?
[image: image.png]
On Fri, Sep 16, 2022 at 4:43 PM Brandon Dusch @.***> wrote:
I am getting errors. Something with prettier or something with Arborist. On Fri, Sep 16, 2022 at 4:31 PM Beverly Andrews @.
> wrote: … <#m_5599583300834726542_> I think there are things I have to install to make that work On Fri, Sep 16, 2022 at 4:21 PM Brandon Dusch @.> wrote: > @beverand https://github.com/beverand https://github.com/beverand Would you be open to trying to > format the entry on your side with the following command when you get a > chance? > > yarn format content/python/concepts/built-in-functions/terms/super/super.md content/python/concepts/inheritance/inheritance.md > > — > Reply to this email directly, view it on GitHub > <#1008 (comment) https://github.com/Codecademy/docs/pull/1008#issuecomment-1249931669>,
or unsubscribe > https://github.com/notifications/unsubscribe-auth/AEZUG6XITOB5UZ2QZW3QWLTV6T6F7ANCNFSM6AAAAAAQOCNCAQ . > You are receiving this because you were mentioned.Message ID: > @.***>
Any chance you could copy/paste the exact error message here?
— Reply to this email directly, view it on GitHub https://github.com/Codecademy/docs/pull/1008#issuecomment-1249939127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZUG6WPRDM5UXOPQKPMLZTV6UA2BANCNFSM6AAAAAAQOCNCAQ . You are receiving this because you were mentioned.Message ID: @.***>
I'm doing npm install --force Maybe that will fix it...
On Fri, Sep 16, 2022 at 4:49 PM Beverly Andrews @.***> wrote:
Will this do?
[image: image.png]
On Fri, Sep 16, 2022 at 4:43 PM Brandon Dusch @.***> wrote:
I am getting errors. Something with prettier or something with Arborist. On Fri, Sep 16, 2022 at 4:31 PM Beverly Andrews @.
> wrote: … <#m_-356230180408197519_m_5599583300834726542_> I think there are things I have to install to make that work On Fri, Sep 16, 2022 at 4:21 PM Brandon Dusch @.> wrote: > @beverand https://github.com/beverand https://github.com/beverand Would you be open to trying to > format the entry on your side with the following command when you get a > chance? > > yarn format content/python/concepts/built-in-functions/terms/super/super.md content/python/concepts/inheritance/inheritance.md > > — > Reply to this email directly, view it on GitHub > <#1008 (comment) https://github.com/Codecademy/docs/pull/1008#issuecomment-1249931669>,
or unsubscribe > https://github.com/notifications/unsubscribe-auth/AEZUG6XITOB5UZ2QZW3QWLTV6T6F7ANCNFSM6AAAAAAQOCNCAQ . > You are receiving this because you were mentioned.Message ID: > @.***>
Any chance you could copy/paste the exact error message here?
— Reply to this email directly, view it on GitHub https://github.com/Codecademy/docs/pull/1008#issuecomment-1249939127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZUG6WPRDM5UXOPQKPMLZTV6UA2BANCNFSM6AAAAAAQOCNCAQ . You are receiving this because you were mentioned.Message ID: @.***>
It looks like it worked.
On Fri, Sep 16, 2022 at 4:53 PM Beverly Andrews @.***> wrote:
I'm doing npm install --force Maybe that will fix it...
On Fri, Sep 16, 2022 at 4:49 PM Beverly Andrews @.***> wrote:
Will this do?
[image: image.png]
On Fri, Sep 16, 2022 at 4:43 PM Brandon Dusch @.***> wrote:
I am getting errors. Something with prettier or something with Arborist. On Fri, Sep 16, 2022 at 4:31 PM Beverly Andrews @.
> wrote: … <#m_-801615125820641623_m_-356230180408197519_m_5599583300834726542_> I think there are things I have to install to make that work On Fri, Sep 16, 2022 at 4:21 PM Brandon Dusch @.> wrote: > @beverand https://github.com/beverand https://github.com/beverand Would you be open to trying to > format the entry on your side with the following command when you get a > chance? > > yarn format content/python/concepts/built-in-functions/terms/super/super.md content/python/concepts/inheritance/inheritance.md > > — > Reply to this email directly, view it on GitHub > <#1008 (comment) https://github.com/Codecademy/docs/pull/1008#issuecomment-1249931669>,
or unsubscribe > https://github.com/notifications/unsubscribe-auth/AEZUG6XITOB5UZ2QZW3QWLTV6T6F7ANCNFSM6AAAAAAQOCNCAQ . > You are receiving this because you were mentioned.Message ID: > @.***> >
Any chance you could copy/paste the exact error message here?
— Reply to this email directly, view it on GitHub https://github.com/Codecademy/docs/pull/1008#issuecomment-1249939127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZUG6WPRDM5UXOPQKPMLZTV6UA2BANCNFSM6AAAAAAQOCNCAQ . You are receiving this because you were mentioned.Message ID: @.***>
@beverand Yup that did it, thanks!
Closes #586
I'm not sure what to do now.
Yay!
On Tue, Sep 20, 2022 at 9:28 AM Brandon Dusch @.***> wrote:
@.**** approved this pull request.
Hey @beverand https://github.com/beverand, sorry for the delay! These changes look good to me from my end, so let's have the next reviewer take a look at this. 😄
— Reply to this email directly, view it on GitHub https://github.com/Codecademy/docs/pull/1008#pullrequestreview-1114143394, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZUG6QLBCAY7YRTFYOT5ETV7HQ33ANCNFSM6AAAAAAQOCNCAQ . You are receiving this because you were mentioned.Message ID: @.***>
@beverand Taking a look at this now. I will leave my review when I'm done.
I removed the lock file, but now the actions are failing? Please advise.
@beverand I'm wondering if after you made the changes in 868517bfb8277450e44d2e1faca6c34c2754faa9, the yarn.lock
file was removed from the repo altogether (under your docsuper
branch)?
If so, can we regenerate the file by running either yarn
or yarn install
, push it back up here, and I'll try something on my end?
Hey @beverand my team and I were able to rectify the failing checks over a few commits by doing the following:
- Replaced the diff'd state of the
yarn.lock
file with it's current state underCodecademy/docs:main
. - Caught your PR up with recent changes in
Codecademy/docs:main
😄
@KTom101 How are things looking with this? Everything good to go for merge?
@Dusch4593 thank you so much for fixing the lock file thing.
Live links are up!
super()
: https://www.codecademy.com/resources/docs/python/built-in-functions/super
Inheritance : https://www.codecademy.com/resources/docs/python/inheritance
Thanks for posting those, @KTom101!
Hey @beverand I noticed that your Codecademy profile isn't appearing on the page for super()
?

Have you connected your Codecademy profile with your GitHub account? Happy to help with the steps so you receive credit as a contributor this content. 😄