[python] Pulnocni rozjimani :-)

Pavel Schön pavel na schon.cz
Pondělí Květen 11 12:46:33 CEST 2015


$ python
Python 2.6.6 (r266:84292, Nov 21 2013, 10:50:32) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
>>> a = 256
>>> b = 256
>>> a is b
True
>>> a = 257
>>> b = 257
>>> a is b
False


On Sunday, May 10, 2015 at 1:05:58 AM UTC+2, Vladimir Macek wrote:
> Just having fun.
> 
>     $ python
>     >>> a = {}
>     >>> b = {'a': a}
>     >>> a['b'] = b
>     >>> a
>     {'b': {'a': {...}}}
>     >>> b
>     {'a': {'b': {...}}}
>     >>> import cPickle
>     >>> ap = cPickle.dumps(a)
>     >>> del a, b
>     >>> len(ap)
>     26
>     >>> a = cPickle.loads(ap)
>     >>> a
>     {'b': {'a': {...}}}
>     >>> a['b']
>     {'a': {'b': {...}}}
>     >>> a['b']['a']
>     {'b': {'a': {...}}}
>     >>> a['b']['a']['b']
>     {'a': {'b': {...}}}
>     >>>
> 
> Navaze nekdo? :-)
> 
> V.
> 
> 
> --- news://freenews.netfront.net/ - complaints: news na netfront.net ---



Další informace o konferenci Python