₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,324,998 members, 8,419,863 topics. Date: Thursday, 04 June 2026 at 04:18 AM

Toggle theme

How Do I Implement This In Python ?? - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHow Do I Implement This In Python ?? (870 Views)

1 Reply (Go Down)

How Do I Implement This In Python ?? by shegzhkn(op): 1:53pm On Aug 04, 2020
Python is an object oriented programming language along side language like Java, C++, C#, etc

one of the concept of OOP is polymorphism allowing object to be created in different form.

Now here is the real deal, Java support Constructor overloading the same for C# but you have to be creative to do that in python say use of default value in the init method.

But i needed to create an object of a class in different form and using default value will not cut it or make it work the way i wanted it to.

So can I create another class with similar logic with slight discrepancies from the former and i am considering efficiency here.

Thanks
Re: How Do I Implement This In Python ?? by Shepherdd(m): 2:53pm On Aug 04, 2020
shegzhkn:
Python is an object oriented programming language along side language like Java, C++, C#, etc

one of the concept of OOP is polymorphism allowing object to be created in different form.

Now here is the real deal, Java support Constructor overloading the same for C# but you have to be creative to do that in python say use of default value in the init method.

But i needed to create an object of a class in different form and using default value will not cut it or make it work the way i wanted it to.

So can I create another class with similar logic with slight discrepancies from the former and i am considering efficiency here.

Thanks
Python supports polymorphism very well (almost), could you post a snippet of what you are trying to do in java or elaborate further.
Re: How Do I Implement This In Python ?? by shegzhkn(op): 3:02pm On Aug 04, 2020
Shepherdd:
Python supports polymorphism very well (almost), could you post a snippet of what you are trying to do in java or elaborate further.
How ?, elaborate.
Re: How Do I Implement This In Python ?? by Shepherdd(m): 3:17pm On Aug 04, 2020
shegzhkn:
How ?, elaborate.
Most of the time **kwargs will be sufficient, and if you need overloading based on compile time differentiation of objects, read about python single dispatch on Google.
Re: How Do I Implement This In Python ?? by shegzhkn(op): 3:56pm On Aug 04, 2020
Shepherdd:
Most of the time **kwargs will be sufficient, and if you need overloading based on compile time differentiation of objects, read about python single dispatch on Google.
Tried that my friend, thanks i appreciate your input.
Gracias
Re: How Do I Implement This In Python ?? by Shepherdd(m):
shegzhkn:
Tried that my friend, thanks i appreciate your input.
Gracias
Ok. This library could also be of help if you need something similar to Java's overloading. https://github.com/mrocklin/multipledispatch
Re: How Do I Implement This In Python ?? by shegzhkn(op): 11:03am On Aug 05, 2020
Shepherdd:
Ok. This library could also be of help if you need something similar to Java's overloading. https://github.com/mrocklin/multipledispatch
Thanks boss i really appreciate.
1 Reply

How Can I Implement Previous And Next Page In HandlebarsWho Wants To Learn Programming In Python Easily Without Stress? READ THISHow Do I Implement A Contact Page In ASP.NET/C#?234

How Can I Integrate Paystack Or Flutterwave To An Already Existing Script?How Long Does It Take To Learn HTML For Job?Custom Elearning Development