User Tools

Site Tools


cs_lang:python:things-to-know:lazy-vs-eager

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cs_lang:python:things-to-know:lazy-vs-eager [2013/01/23 14:53]
cedric
cs_lang:python:things-to-know:lazy-vs-eager [2013/01/23 15:01] (current)
cedric
Line 1: Line 1:
 ====== Lazy vs Eager evaluation ====== ====== Lazy vs Eager evaluation ======
  
-Python generally uses eager evaluation (in contrary to Haskell).+Python generally uses an eager evaluation (in contrary to [[cs_lang:haskell|Haskell]]but for example with Python 3 the range() function returns a special range object which computes elements of the list on demand.
  
 <code python> <code python>
Line 11: Line 11:
 </code> </code>
  
-This was not the case with Python 2:+This was not the case with Python 2 (without iterators):
 <code python> <code python>
 >>> r = range(10) >>> r = range(10)
cs_lang/python/things-to-know/lazy-vs-eager.1358949207.txt.gz ยท Last modified: 2013/01/23 14:53 by cedric