Python OOP Tutorial 3: classmethods and staticmethods

Corey Schafer July 11, 2016
Video Thumbnail
Corey Schafer Logo

Corey Schafer

@coreyms

About

Welcome to my Channel. This channel is focused on creating tutorials and walkthroughs for software developers, programmers, and engineers. We cover topics for all different skill levels, so whether you are a beginner or have many years of experience, this channel will have something for you. We've already released a wide variety of videos on topics that include: Python, Git, Development Environments, Terminal Commands, SQL, Programming Terms, JavaScript, Computer Science Fundamentals, and plenty of other tips and tricks which will help you in your career. If you enjoy these videos and would like to support my channel, I would greatly appreciate any assistance through my Patreon account: https://www.patreon.com/coreyms You can find me on: My website - http://coreyms.com/ Facebook - https://www.facebook.com/CoreyMSchafer Twitter - https://twitter.com/CoreyMSchafer Google Plus - https://plus.google.com/+CoreySchafer44/posts Tumblr - https://www.tumblr.com/blog/mycms

Video Description

In this Python Object-Oriented Tutorial, we will be learning about classmethods and staticmethods. Class methods are methods that automatically take the class as the first argument. Class methods can also be used as alternative constructors. Static methods do not take the instance or the class as the first argument. They behave just like normal functions, yet they should have some logical connection to our class. We will look at some examples of both of these in order to understand both in depth. Let's get started. Python OOP 1 - Classes and Instances - https://youtu.be/ZDa-Z5JzLYM Python OOP 2 - Class Variables - https://youtu.be/BJ-VvGyQxho Python OOP 3 - Classmethods and Staticmethods - https://youtu.be/rq8cL2XMM5M Python OOP 4 - Inheritance - https://youtu.be/RSl87lqOXDE Python OOP 5 - Special (Magic/Dunder) Methods - https://youtu.be/3ohzBxoFHAY Python OOP 6 - Property Decorators - https://youtu.be/jCzT9XFZ5bw The code from this video can be found at: https://github.com/CoreyMSchafer/code_snippets/tree/master/Object-Oriented ✅ Support My Channel Through Patreon: https://www.patreon.com/coreyms ✅ Become a Channel Member: https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join ✅ One-Time Contribution Through PayPal: https://goo.gl/649HFY ✅ Cryptocurrency Donations: Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3 Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33 Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot ✅ Corey's Public Amazon Wishlist http://a.co/inIyro1 ✅ Equipment I Use and Books I Recommend: https://www.amazon.com/shop/coreyschafer ▶️ You Can Find Me On: My Website - http://coreyms.com/ My Second Channel - https://www.youtube.com/c/coreymschafer Facebook - https://www.facebook.com/CoreyMSchafer Twitter - https://twitter.com/CoreyMSchafer Instagram - https://www.instagram.com/coreymschafer/ #Python

You May Also Like

Essential Slime-Making Kit

AI-recommended products based on this video

Loading...
Elmer's Disappearing Purple School Glue Stick, 20G, 0.7-Ounce Each, 3-Pack (61666Q)

Elmer's Disappearing Purple School Glue Stick, 20G, 0.7-Ounce Each, 3-Pack (61666Q)

(2,547)
$5.59
FREE delivery Mon, Sep 15 on your first order
10K+ bought in past month
Loading...
ESR for iPhone 16 Case, Military-Grade Protection, Shockproof Air Guard Corners, Yellowing-Resistant Acrylic Back, Phone Case for iPhone 16, Air Armor Series, New Clear Blue

ESR for iPhone 16 Case, Military-Grade Protection, Shockproof Air Guard Corners, Yellowing-Resistant Acrylic Back, Phone Case for iPhone 16, Air Armor Series, New Clear Blue

(657)
$12.99
FREE delivery Sat, Jun 14 on your first order
Loading...
Yarxiawin Phone Case for Samsung S25 Case with Ring Stand Magnetic Compatible with Magsafe Wireless Charger, Pink Bumper Cover Samsung Galaxy S25 Case Clear Shockproof (Blue)

Yarxiawin Phone Case for Samsung S25 Case with Ring Stand Magnetic Compatible with Magsafe Wireless Charger, Pink Bumper Cover Samsung Galaxy S25 Case Clear Shockproof (Blue)

(0)
$20.23
FREE delivery Sat, Jun 14 on your first order
Loading...
Face Bowl for Ice with Built-in Icetray, Collapsible Silicone Bowl for Face Ice Bath, Space Saving Wash Basin for Cold Plunge Therapy, Skin Tightening & Acne Relief, Portable Spa Tool for Home Travel

Face Bowl for Ice with Built-in Icetray, Collapsible Silicone Bowl for Face Ice Bath, Space Saving Wash Basin for Cold Plunge Therapy, Skin Tightening & Acne Relief, Portable Spa Tool for Home Travel

(0)
$10.99
$5.99 delivery Jun 25 - Jul 7
Loading...
INSFIT Silicone Travel Bottles Set, 17 Pack Travel Size Toiletries, BPA Free Leak Proof Squeezable Silicone Tubes for Shampoo Conditioner Lotion Soap with Labels

INSFIT Silicone Travel Bottles Set, 17 Pack Travel Size Toiletries, BPA Free Leak Proof Squeezable Silicone Tubes for Shampoo Conditioner Lotion Soap with Labels

(455)
$14.99
FREE delivery Sat, Jun 14 on your first order
700+ bought in past month
Loading...
AMVR Lens Protector Set Compatible with Meta/Oculus Quest 3 Accessories,Glasses Spacer for Quest 3 Lenses,Soft Silicone Rings Protect Prescription Glasses

AMVR Lens Protector Set Compatible with Meta/Oculus Quest 3 Accessories,Glasses Spacer for Quest 3 Lenses,Soft Silicone Rings Protect Prescription Glasses

(316)
$37.99
FREE delivery Tue, Jun 17
Loading...
Magnetic Nasal Strips Starter Kit: Comfortable Nasal Breathing Support for Sleep, Helps Reduce Snoring Noise, Includes 60 Tabs (30 Uses) with 4 Sizes

Magnetic Nasal Strips Starter Kit: Comfortable Nasal Breathing Support for Sleep, Helps Reduce Snoring Noise, Includes 60 Tabs (30 Uses) with 4 Sizes

(40)
$17.99
FREE delivery Wed, Mar 18 on your first orderOnly 7 left in stock.
1K+ bought in past month
Loading...
Environet Hydroponic Growing Kit, Self-Watering Mason Jar Herb Garden Starter Kit Indoor, Windowsill Herb Garden, Grow Your Own Herbs from Organic Seeds (Basil)

Environet Hydroponic Growing Kit, Self-Watering Mason Jar Herb Garden Starter Kit Indoor, Windowsill Herb Garden, Grow Your Own Herbs from Organic Seeds (Basil)

(786)
$69.15$33.51
FREE delivery Jun 13 - 17
Loading...
Herb Garden Planter Indoor Kit 21Pcs Kitchen Herb Garden Starter Kit Growing Kit Including Wooden Box Burlap Pots Soil Discs Gardening Tools Unique Easter Birthday Christmas Gift Ideas for Women Mom

Herb Garden Planter Indoor Kit 21Pcs Kitchen Herb Garden Starter Kit Growing Kit Including Wooden Box Burlap Pots Soil Discs Gardening Tools Unique Easter Birthday Christmas Gift Ideas for Women Mom

(0)
$30.99
FREE delivery Jun 19 - Jul 3
Loading...
Bonsai Starter Kit – 1x Bonsai Tree | Complete Indoor Starter Kit for Growing Plants with Bonsai Seeds, Tools & Planters – Gardening Gifts for Women & Men
Best Seller

Bonsai Starter Kit – 1x Bonsai Tree | Complete Indoor Starter Kit for Growing Plants with Bonsai Seeds, Tools & Planters – Gardening Gifts for Women & Men

(243)
$19.99
FREE delivery Sat, Jun 14 on your first order
300+ bought in past month
Loading...
Full Bed Frame, BedStory 12 inch Metal Bed Frame with Headboard, Velvet Fabric, Duty Steel Slat Support Platform Bedframe with Large Storage Space No Box Spring Needed Easy Assembly(White, Full)

Full Bed Frame, BedStory 12 inch Metal Bed Frame with Headboard, Velvet Fabric, Duty Steel Slat Support Platform Bedframe with Large Storage Space No Box Spring Needed Easy Assembly(White, Full)

(36)
$129.99
FREE delivery Wed, Jun 25
Loading...
ITIMIDI 12 Inch White Queen Bed Frame, Heavy Duty Steel Support 3500 LBS, Metal Platform Bed Frame Queen Size with Large Storage Space, No Box Spring Needed, Noiseless, Easy Assembly

ITIMIDI 12 Inch White Queen Bed Frame, Heavy Duty Steel Support 3500 LBS, Metal Platform Bed Frame Queen Size with Large Storage Space, No Box Spring Needed, Noiseless, Easy Assembly

(99)
$145.28
FREE delivery Wed, Jun 25
Loading...
VASAGLE Bathroom Storage Cabinet with Drawer, 2 Open Shelves, Large Floor Cabinet White UBBC69WT

VASAGLE Bathroom Storage Cabinet with Drawer, 2 Open Shelves, Large Floor Cabinet White UBBC69WT

(1,240)
$109.99
FREE delivery Jun 20 - 30
50+ bought in past month
Loading...
GOLDCHAMP Portable 4 Gas Monitor for H2S, CO, LEL & O2 with High-Sensitivity Sensor, Data Storage, Triple Alarms, Large-Capacity Battery, Triple-Proof Design & Large LCD Display for Industrial Safety

GOLDCHAMP Portable 4 Gas Monitor for H2S, CO, LEL & O2 with High-Sensitivity Sensor, Data Storage, Triple Alarms, Large-Capacity Battery, Triple-Proof Design & Large LCD Display for Industrial Safety

(0)
$111.14
FREE delivery Tue, Aug 12
Loading...
Clip in Hair Tinsel, Clips on Hair Tensile Champagne Gold, Pack of 12Pcs, 20 inch Glitter Tinsel Extensions, Festival Fairy (Champagne)

Clip in Hair Tinsel, Clips on Hair Tensile Champagne Gold, Pack of 12Pcs, 20 inch Glitter Tinsel Extensions, Festival Fairy (Champagne)

(0)
$16.95
$7.95 delivery Jan 7 - 16
Loading...
Floral Beads Kit 50000pcs & 300pcs Giant Large Colorful Gel Jelly Balls, Non Toxic Beads for Vase Filler, Plant, Floating Candles, Wedding and Home Decoration

Floral Beads Kit 50000pcs & 300pcs Giant Large Colorful Gel Jelly Balls, Non Toxic Beads for Vase Filler, Plant, Floating Candles, Wedding and Home Decoration

(2)
$15.99
FREE delivery Sat, Nov 22 on your first order
Loading...
Gifts 5-12 Years Old Girls, Bracelet Making Kit, Unicorn Toys, Gifts for Teen Girls, Beads for Making Jewellery, Crafts for Kids 6-8, Arts and Crafts for Kids Age 4 5 6 7 8 9 10 11

Gifts 5-12 Years Old Girls, Bracelet Making Kit, Unicorn Toys, Gifts for Teen Girls, Beads for Making Jewellery, Crafts for Kids 6-8, Arts and Crafts for Kids Age 4 5 6 7 8 9 10 11

(455)
$19.98
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
Hbnlai 5300 Pcs Clay Beads Bracelet Making Kit, Flat Preppy Beads for Friendship Jewelry Making, Polymer Heishi with Charms Gifts for Teen Girls Crafts for Girls Ages 8-12
Best Seller

Hbnlai 5300 Pcs Clay Beads Bracelet Making Kit, Flat Preppy Beads for Friendship Jewelry Making, Polymer Heishi with Charms Gifts for Teen Girls Crafts for Girls Ages 8-12

(2,416)
$12.99
FREE delivery Sat, Jun 14 on your first order
2K+ bought in past month
Loading...
EnvoGif Mens Leather Bracelet Personalized Name Bracelet for Men Engraved 1-6 Names Leather Braid Bracelets with Stainless Beads for Dad Husband Grandpa

EnvoGif Mens Leather Bracelet Personalized Name Bracelet for Men Engraved 1-6 Names Leather Braid Bracelets with Stainless Beads for Dad Husband Grandpa

(7)
$23.99
$2.99 delivery Jun 20 - Jul 4