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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems with super() Hoespilaar 2 223 Apr-10-2024, 10:10 AM
Last Post: Hoespilaar
  super() in class akbarza 1 449 Dec-19-2023, 12:55 PM
Last Post: menator01
  Understanding Python super() for classes OmegaRed94 1 1,832 Jun-09-2021, 09:02 AM
Last Post: buran
  Examples of Customer requirements ComputerAstronaut 1 1,839 Dec-08-2020, 03:22 AM
Last Post: Larz60+
  Super Urgent, work related. Gimp Python tsurubaso 5 2,949 Oct-19-2020, 08:18 AM
Last Post: tsurubaso
  print() examples leodavinci1990 3 1,946 Aug-21-2020, 03:34 PM
Last Post: snippsat
  superclass and super() grkiran2011 1 1,727 Jun-20-2020, 04:37 AM
Last Post: deanhystad
  MRO About super() catlessness 1 2,032 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,398 May-04-2019, 08:30 PM
Last Post: Shafla
  mpi4py examples/tutorials MuntyScruntfundle 1 2,691 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