Subclassing built-in classes

Gabriel Genellina gagsl-py at yahoo.com.ar
Sat Oct 7 03:14:42 EDT 2006


At Friday 6/10/2006 06:58, Maric Michaud wrote:

>As the first post said "...couldn't python (in theory)...", I was discussing
>if it would be possible for python (in some future version) to manage the
>literals so that they use the constructors in the __builtin__ module, I
>didn't say it works actually (I'm aware it's not the case).

The idea looks crazy for me... You suggest that code like this:

         x = 12 + 6.0 - len('ABCD'

would be evaluated at run time as it were:

         x = int('12') + float('6.0') - len(str('ABCD'))

Certainly would slow down the whole execution time *a*lot*, with no 
benefit for almost nobody, if *every* reference to *any* literal in 
the code calls a python function at run time.
And unless you return *exactly* the same object as now, almost all 
code would break!
Do you have any useful usage for this?


-- 
Gabriel Genellina
Softlab SRL 


	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas




More information about the Python-list mailing list