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
  [closed] check whether an integer is 32 or 64 bits paul18fr 4 5,809 May-27-2024, 04:55 PM
Last Post: deanhystad
  Is it possible to extract 1 or 2 bits of data from MS project files? cubangt 8 3,995 Feb-16-2024, 12:02 AM
Last Post: deanhystad
  Code works but doesn't give the right results colin_dent 2 1,476 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 3,374 Mar-27-2023, 07:38 AM
Last Post: buran
  How to rotate bits ? korenron 2 2,893 Mar-23-2022, 04:05 PM
Last Post: Larz60+
  From list of bits to PDF drimades 1 2,853 Nov-02-2021, 08:55 PM
Last Post: Gribouillis
  Sum similar items tester_V 3 3,006 Jun-29-2021, 06:58 AM
Last Post: tester_V
Exclamation Help in breaking bytes into bits through masking and shifting kamui123 9 8,030 Jan-11-2021, 07:42 AM
Last Post: kamui123
  Code giving same output no matter the input. Yort 2 4,881 Dec-20-2020, 05:59 AM
Last Post: buran
  Compiling Python 3.8.5 source code results in build error Deepan 0 2,806 Sep-14-2020, 04:11 AM
Last Post: Deepan

Forum Jump:

User Panel Messages

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