And now for something completely different. Was: String.join revisited (URGENT for 1.6)

Peter Schneider-Kamp petersc at stud.ntnu.no
Fri Jun 2 15:10:11 EDT 2000


James Logajan wrote:
> 
> var = 2["abc"];
> 
> Points awarded for determining the type of "var" and the value assigned to
> it. Extra credit points for explaining why this is valid C/C++. (Hint: this
> has been valid C for as long as the language has been around.)

Okay, it is a char. The corresponding Python expression is
"abc"[2], so the value has to be 'c' (or as it is C 99).

I like it, but I did not know it was legal C. Why?

hoping-there-is-no-slice-operator-too-ly y'rs
Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter at schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de




More information about the Python-list mailing list