chess: (geek)
Currently, every page of Yahoo Mail makes Opera spit three errors at me. I could banish that dialog box forever, but sometimes I *want* to know when the script on the page has screwed up. Telling it to stop running scripts on the page stops everything from working. Wonderful.

Over the last couple of nights I've made quite a bit more progress on 'Kali', my random RPG thingamy. Now I can get it to show a certain bit of the map to start with, and you can move Kali around the map. I'm working on the scrolling code atm (it *should* spit out another bit of map for the screen, re-centering you, whenever you get within two tiles of the edge. currently it does this, and reverts back to the old map when you move next. prolly I'll figure it out when I quit procrastinating with LJ and get on with it, though.)

'is' is *not* equivalent to '=='. I still can't quite work out how or why, or why it worked for the 'esc' key with the 'is' statement and not any of the other keys... but as this is my first major solo Python project, I shouldn't be surprised at finding random bits I don't understand really.

Anyway, that was your random techie-type updateness for today.

is and ==

Date: 2002-06-20 10:57 am (UTC)From: [identity profile] joncooper.livejournal.com
== tests value equivalence, whereas is tests object equivalence. So == will tell you if 2 objects have the same value, whereas is will tell you if they're actually the same object, ie live at the same address.

As an example:
L1 = [1, ('a', 3)]
L2 = [1, ('a', 3)]

then L1 == L2 evaluates to 1 (true) but L1 is L2 evaluates to 0.

(Taken from Learning Python.)

Re: is and ==

Date: 2002-06-20 10:58 am (UTC)From: [identity profile] jaq.livejournal.com
Doh, you beat me ;-)

Re: is and ==

Date: 2002-06-20 11:00 am (UTC)From: [identity profile] joncooper.livejournal.com
*grin*

Date: 2002-06-20 10:57 am (UTC)From: [identity profile] jaq.livejournal.com
I don't know Python, but I recognise the same problem from Java (although it's the other way round, confusingly). 'is' tests if the arguments are the same object, whereas '==' tests if the arguments have the same value.

Profile

chess: (Default)
Michelle Taylor

January 2025

S M T W T F S
   1234
567891011
12131415161718
19202122232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 2nd, 2026 04:41 am
Powered by Dreamwidth Studios