Python Forum
Super flexibility in python, examples
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Super flexibility in python, examples
#11
i did something like that, long ago, but first made a conversion function. this function tried to convert the given argument to int. if that succeeded then it returned the result. if it failed then it tried to convert the given argument to float. if that succeeded then it returned the result. if it failed it finally just returned the original given argument. this allowed input like "1.2" which would be greater than "1". code that uses that will need to understand how to work with different types, correctly, which could make that code be ugly.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
Super flexibility in python, examples - by Kakha - Jan-06-2021, 07:34 PM
RE: Super flexibility in python, examples - by Skaperen - Jan-08-2021, 12:40 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems with super() Hoespilaar 3 531 Jun-11-2024, 02:15 AM
Last Post: kanetracy
  super() in class akbarza 1 710 Dec-19-2023, 12:55 PM
Last Post: menator01
  Understanding Python super() for classes OmegaRed94 1 1,958 Jun-09-2021, 09:02 AM
Last Post: buran
  Examples of Customer requirements ComputerAstronaut 1 1,942 Dec-08-2020, 03:22 AM
Last Post: Larz60+
  Super Urgent, work related. Gimp Python tsurubaso 5 3,152 Oct-19-2020, 08:18 AM
Last Post: tsurubaso
  print() examples leodavinci1990 3 2,083 Aug-21-2020, 03:34 PM
Last Post: snippsat
  superclass and super() grkiran2011 1 1,845 Jun-20-2020, 04:37 AM
Last Post: deanhystad
  MRO About super() catlessness 1 2,152 Jan-12-2020, 07:54 AM
Last Post: Gribouillis
  Super with Sublime Text - TypeError: super() takes at least 1 argument (0 given) Shafla 6 7,724 May-04-2019, 08:30 PM
Last Post: Shafla
  mpi4py examples/tutorials MuntyScruntfundle 1 2,792 Dec-01-2018, 10:22 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020