A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-June/065850.html below:

Allow Empty Subscript List Without Parentheses

[Python-Dev] Pre-PEP: Allow Empty Subscript List Without Parentheses [Python-Dev] Pre-PEP: Allow Empty Subscript List Without ParenthesesNick Coghlan ncoghlan at gmail.com
Sun Jun 11 07:49:17 CEST 2006
Noam Raphael wrote:
> I hope that my (hopefully) better explanation made the use case more
> compelling, but I want to add two points in favour of an empty tuple:

I guess I'm really only -0 on the idea of x[] invoking x.__getitem__(), and 
allowing the class to decide whether or not to define a default value for the 
subscript. I wouldn't implement it myself, but I wouldn't object strenuously 
if Guido decided it was OK :)

For your specific use cases, though, I'd be inclined to tweak the API a bit, 
and switch to using attributes for the single-valued data:

tax_rates.income_tax = 0.18

Although the income tax rate should actually depend on the current financial 
year, since it can change over time as the government increases taxes ;)

> Why? Mental exercise is a good way to keep you mental ;)

Hehe :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4