Q: Python 2.0 preliminary features?

skaller skaller at maxtal.com.au
Tue Oct 19 15:55:44 EDT 1999


William Tanksley wrote:
 
> This is totally orthogonal to your post, but I'm just curious: I like how
> Dylan allows one to write the first argument of a function either as a
> distinguished or ordinary paramter -- that is, "abs(1)" is the same as
> "(1).abs()".
> 
> Can we do the same with Viper?

	No. I was going to implement it, but when I considered it,
I realised it wouldn't work well in Python. The problem is 
several fold: in the first place, there's nothing magical
about function calls in python:

		x.a (args)

is really:

	(x.a) (args)

that is, an attribute lookup _followed_ by a function call.
So we would need to say that if

	x.a

fails, try looking for 'a'. Worse, consider:

	x.a = 1

Woops! Will this really assign to a local or module
variable, and not an attribute of the object? [No]

Anyhow, it started to look seriously inconsistent in Python.

> Of course, I'm about to ask for multiple dispatch, but since everyone who
> even knows what multiple dispatch is already knew I was going to ask for
> it...  So I won't bother asking.

	What do you want it to do? Any idea how it should work in Python?
 
-- 
John Skaller, mailto:skaller at maxtal.com.au
1/10 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
downloads: http://www.triode.net.au/~skaller




More information about the Python-list mailing list