473,566 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Why no tailcall-optimization?

On Tue, 23 Sep 2008 06:41:33 -0700 (PDT), sturlamolden <st**********@y ahoo.nowrote:
>On Sep 23, 3:13Â*am, process <circularf...@g mail.comwrote:
>Why doesn't Python optimize tailcalls? Are there plans for it?

Because Python is a dynamic language. While a function is executing,
its name may be bound to another object. It may happen as a side
effect of what the function is doing, or even from another thread. The
compiler has no way of knowing that.
That's not the reason. It's not particularly hard to implement TCE for
Python. Instead, Guido has repeatedly given the reason as his feeling
that recursion is not the most natural way to express most algorithms
in Python. Adding TCE to the runtime would encourage people to write
(or continue to write) highly recursive algorithms, which would go
against what Guido thinks is "Pythonic". Here's a quote from him on
the topic:
But I have a problem with tail recursion. It's generally requested by
new converts from the Scheme/Lisp or functional programming world, and
it usually means they haven't figured out yet how to write code
without using recursion for everything yet. IOW I'm doubtful on how
much of a difference it would make for real Python programs (which,
simplifying a bit, tend to use loops instead of recursion).
Jean-Paul
Sep 23 '08 #1
0 635

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1804
by: Stephen Thorne | last post by:
Decorators have been getting lots of air-time at the moment, but only really the syntax. After a short discussion on irc the other night I decided to download python2.4 from experimental and write out some truely worthy decorator hacks. I implemented multimethods as a warm-up, and then implemented tail call elimination. Presented here is a...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7645
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.