Viz stejný problém (místo 'str' problém s 'list')
http://stackoverflow.com/questions/3795591/can-i-override-python-list-displays
You cannot trivially override the syntactic sugar used for built-in
types, since this happens at the compiler level.
Dne 3.11.2010 10:49, Visgean Skeloru napsal(a):
Dobrý den, mám tu následující kód, nevíte proč my hodí python na
poslední řádek AttribueError? Pokouším se přepsat třídu string ale
nějak mi to nejede...
#! /usr/bin/python
# -*- coding: UTF-8 -*-
class str(str):
asx = "mlam mlam"
print str("asx").asx
print "axs".asx
_______________________________________________
Python mailing list
[email protected]
http://www.py.cz/mailman/listinfo/python
_______________________________________________
Python mailing list
[email protected]
http://www.py.cz/mailman/listinfo/python