Python Forum
Efficiency with regard to nested conditionals or and statements
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Efficiency with regard to nested conditionals or and statements
#12
Quote:The program generates a results file with different trade statistics and parameters. That is where I got a lot of unnecessary decimal output that I figured I could clean up by converting to int so there would be no decimals.

But you are not doing that here. Calling int(float(datalist[2])) does not replace the contents of datalist[2] with an integer, it creates an integer object using the float value of datalist[2]. The integer object is used in the comparison and deleted. datalist[2] is unchanged.
Reply


Messages In This Thread
RE: Efficiency with regard to nested conditionals or and statements - by deanhystad - Apr-29-2022, 08:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Doubt about conditionals in Python. Carmazum 6 1,729 Apr-01-2023, 12:01 AM
Last Post: Carmazum
  Numpy Structure and Efficiency garynewport 2 756 Oct-19-2022, 10:11 PM
Last Post: paul18fr
  conditionals based on data frame mbrown009 1 956 Aug-12-2022, 08:18 AM
Last Post: Larz60+
  Nested conditionals vs conditionals connected by operators dboxall123 8 3,209 Feb-18-2022, 09:34 PM
Last Post: dboxall123
  Nested Conditionals shen123 3 2,706 Jul-28-2021, 08:24 AM
Last Post: Yoriz
  How to use vectorization instead of for loop to improve efficiency in python? PJLEMZ 4 2,517 Feb-06-2021, 09:45 AM
Last Post: paul18fr
  Invalid syntax using conditionals if - else jperezqu 1 2,394 Jan-13-2021, 07:32 PM
Last Post: bowlofred
  conditionals with boolean logic?? ridgerunnersjw 3 2,062 Sep-26-2020, 02:13 PM
Last Post: deanhystad
  two conditionals with intermediate code Skaperen 5 2,906 Jul-12-2020, 07:18 PM
Last Post: Skaperen
  Conditionals, while loops, continue, break (PyBite 102) Drone4four 2 3,075 Jun-04-2020, 12:08 PM
Last Post: Drone4four

Forum Jump:

User Panel Messages

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