curly-brace-aphobic?

Cliff Crawford cjc26 at nospam.cornell.edu
Thu Feb 1 10:00:24 EST 2001


* Greg Ewing <greg at cosc.canterbury.ac.nz> menulis:
| Grant Griffin wrote:
| > 
| > However, the rule that I seem to want to apply is "All indexers are indexed
| > using the style of brace used to bind them."
| 
| But tuples and strings aren't constructed using any
| kind of brackets at all:
| 
|    t = 1,2,3
|    s = "parrot"
| 
| How do you propose to index those, using your rule?

Well, >obviously<, you would do the following:

>>> t 2
2
>>> s"4"
r

Of course, you have to be careful with tuples, because sometimes
parentheses are used when creating them:

>>> t2 = (4, 5, 6)
>>> t2(3)
6


-- 
Cliff Crawford               http://www.people.cornell.edu/pages/cjc26/
                             print "Just another Python hacker"



More information about the Python-list mailing list