Bit about Bytes: Understanding Python Bytecode See James BennettWriting more efficient Python code.
I hereby solicit suggestions for the video of the day. Please email me your ideas with explanations. Selected entries will win 5 homework points. If your video is played at the beginning of class, you must also briefly explain something about the video and something about yourself — in person.
https://pollev.com/slade You may also download the app to your phone. Use the "slade" poll id.
DSAC would like to invite you to attend this year's DSAC-Faculty joint advising session on Tuesday, 12 November @ 6p in Davies Auditorium. This is an opportunity during the Yale College Advising Period to hear from faculty about the different paths in Computer Science. We'll also advertise new courses, ULA Hiring for Spring 2025, the BS/MS program, and your class + peer advisors.This event will be a live, in-person event with a recording posted afterwards. A zoom-in option is not available during the session.
Please RSVP here if you plan to attend.
There will be a UNIX question, as in the first midterm. Here is a sample UNIX transcript (solutions) UNIX will cover through principle 3.
Review session: Today at 6pm on zoom. Check Ed Discussions for deets and slides.
From Rudy:
You can tell them that I also updated the original message with detailed answers - for those that can't (or don't want to) attend the session.Note: Rudy ran out of time and did not cover decorators. I will discuss them today. Rudy's slides
The version of Python on the zoo is 3.10. That is the version used by this assignment and the autograder. There were some major changes to byte codes in version 3.11, and for that matter, in version 3.9. See dis.html and specify version 3.10.
>>> def f(): ... a = 3 + 4 ... >>> dis.dis(f) 2 0 LOAD_CONST 1 (7) 2 STORE_FAST 0 (a) 4 LOAD_CONST 0 (None) 6 RETURN_VALUE >>> def f2(): ... a = 3 + 4 ... return a ... >>> dis.dis(f2) 2 0 LOAD_CONST 1 (7) 2 STORE_FAST 0 (a) 3 4 LOAD_FAST 0 (a) 6 RETURN_VALUE