<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I have a proposal to resolve the issue<div><br></div><div><div>class List(list):</div><div> """ </div><div> >>> a=List() </div><div> >>> for i in range(100000): a.append(i) </div><div> >>> print a.first </div><div> 0 </div><div> >>> print a.second </div><div> 1 </div><div> >>> print a.third </div><div> 2 </div><div> >>> print a.twentieth </div><div> 19 </div><div> >>> print a.twentysecond </div><div> 21 </div><div> >>> print a.onehundredthirtyfifth </div><div> 134 </div><div> >>> print a.onethousandfivehundredandthirtyeighth </div><div> 1537 </div><div> """</div><div> def __getattr__(self,name):</div><div> import re</div><div> if name.endswith('first'): name = name[:-5]+'one'</div><div> elif name.endswith('second'): name = name[:-6]+'two'</div><div> elif name.endswith('third'): name = name[:-5]+'three'</div><div> elif name.endswith('fth'): name = name[:-3]+'ve'</div><div> elif name.endswith('hth'): name = name[:-3]+'th'</div><div> elif name.endswith('ieth'): name = name[:-4]+'y'</div><div> elif name.endswith('th'): name = name[:-2]</div><div> subs = {</div><div> 'one':'+1',</div><div> 'two':'+2',</div><div> 'three':'+3',</div><div> 'four':'+4',</div><div> 'five':'+5',</div><div> 'six':'+6',</div><div> 'seven':'+7',</div><div> 'eigth':'+8',</div><div> 'nine':'+9',</div><div> 'ten':'+10',</div><div> 'eleven':'+11',</div><div> 'twelve':'+12',</div><div> 'thirteen':'+13',</div><div> 'fourteen':'+14',</div><div> 'fiftheen':'+15',</div><div> 'sixteen':'+16',</div><div> 'seventeen':'+17',</div><div> 'eighteen':'+18',</div><div> 'nineteen':'+19',</div><div> 'ten':'+10',</div><div> 'twenty':'+20',</div><div> 'thirty':'+30',</div><div> 'fourty':'+40',</div><div> 'fifthy':'+50',</div><div> 'sixtith':'+60',</div><div> 'seventy':'+70',</div><div> 'eighty':'+80',</div><div> 'ninety':'+90',</div><div> 'hundred':')*100+(',</div><div> 'thousand':')*1000+(',</div><div> 'million':')*1000000+(',</div><div> 'billion':')*1000000000+(',</div><div> 'trillion':')*100000000000+(',</div><div> 'and',''}</div><div> for key,value in subs.items(): name = name.replace(key,value)</div><div> if '(' in name: name='('+name+')'</div><div> name.replace('()','1')</div><div> if not re.compile('[\d\+\*\(\)]+').match(name): return AttributeError</div><div> try: return self[eval(name)-1]</div><div> except: raise AttributeError</div></div><div><br></div><div><br><div><div>On Sep 10, 2011, at 10:15 AM, Sal Lara wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">I think it's super-overdue. I honestly can't even think of that many places in my code where I depend on the actual numerical index value of a list element. That in and of itself isn't very pythonic, right? However, were the first list element actually 1, many who answer yes to my question might feel differently.<br clear="all">
<font face="'trebuchet ms', sans-serif"><b><br></b>-Sal</font><br><br><div class="gmail_quote">On Sat, Sep 10, 2011 at 10:03 AM, Tathagata Dasgupta <span dir="ltr"><<a href="mailto:tathagatadg@gmail.com">tathagatadg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">What do guys think of list revolution?<br>
<br>
<a href="http://mail.python.org/pipermail/python-ideas/2011-September/011448.html" target="_blank">http://mail.python.org/pipermail/python-ideas/2011-September/011448.html</a><br>
<font color="#888888"><br>
<br>
--<br>
Cheers,<br>
T<br>
_______________________________________________<br>
Chicago mailing list<br>
<a href="mailto:Chicago@python.org">Chicago@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/chicago" target="_blank">http://mail.python.org/mailman/listinfo/chicago</a><br>
</font></blockquote></div><br>
_______________________________________________<br>Chicago mailing list<br><a href="mailto:Chicago@python.org">Chicago@python.org</a><br>http://mail.python.org/mailman/listinfo/chicago<br></blockquote></div><br></div></body></html>