How Do I Implement This In Python ?? - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › How Do I Implement This In Python ?? (870 Views)
| 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 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:How ?, elaborate. |
| Re: How Do I Implement This In Python ?? by Shepherdd(m): 3:17pm On Aug 04, 2020 |
shegzhkn: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:Tried that my friend, thanks i appreciate your input. Gracias |
| Re: How Do I Implement This In Python ?? by Shepherdd(m): 6:05pm On Aug 04, 2020*. Modified: 7:21pm On Aug 04, 2020 |
shegzhkn: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:Thanks boss i really appreciate. |
How Can I Implement Previous And Next Page In Handlebars • Who Wants To Learn Programming In Python Easily Without Stress? READ THIS • How Do I Implement A Contact Page In ASP.NET/C#? • 2 • 3 • 4
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