Python Forum
Why are two similar bits of code giving different results?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why are two similar bits of code giving different results?
#11
the one-line case is doing evaluations of all the expressions before any assignments change any variables.  this let's us do an easy swap:
a,b = b,a
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
  Is it possible to extract 1 or 2 bits of data from MS project files? cubangt 8 1,072 Feb-16-2024, 12:02 AM
Last Post: deanhystad
  Code works but doesn't give the right results colin_dent 2 728 Jun-22-2023, 06:04 PM
Last Post: jefsummers
  Compiles Python code with no error but giving out no output - what's wrong with it? pythonflea 6 1,586 Mar-27-2023, 07:38 AM
Last Post: buran
  How to rotate bits ? korenron 2 1,640 Mar-23-2022, 04:05 PM
Last Post: Larz60+
  From list of bits to PDF drimades 1 1,922 Nov-02-2021, 08:55 PM
Last Post: Gribouillis
  Sum similar items tester_V 3 1,986 Jun-29-2021, 06:58 AM
Last Post: tester_V
Exclamation Help in breaking bytes into bits through masking and shifting kamui123 9 4,591 Jan-11-2021, 07:42 AM
Last Post: kamui123
  Code giving same output no matter the input. Yort 2 2,564 Dec-20-2020, 05:59 AM
Last Post: buran
  Compiling Python 3.8.5 source code results in build error Deepan 0 2,194 Sep-14-2020, 04:11 AM
Last Post: Deepan
  Search Results Web results Printing the number of days in a given month and year afefDXCTN 1 2,245 Aug-21-2020, 12:20 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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