473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Idle bytecode query on apparently unreachable returns

>What puzzles me, though, are bytecodes 17, 39 and 42 - surely these aren't
reachable? Does the compiler just throw in a default 'return None'
epilogue, with routes there from every code path, even when it's not
needed? If so, why?


Hi.

pyc (http://freshmeat.net/projects/pyc) can already remove that
unused code since June.

As for "why", I guess that there is a lot of room for optimizing
the bytecode but it's a PITA doing all of it in the current internal
compiler. And so developers simply don't care about it.
Maybe the ast-branch would make it easier to start generating
optimal bytecode. On the other hand, the 'compiler module'
produces bad bytecode (for example it miscalculates the 'stacksize'
of functions and as a result the generated functions are slow), it
doesn't use LIST_APPEND, and it doesn't even do the simple peephole
optimizations of the intenal compiler!
In the latest version 0.8 to-be-released, pyc does many more bytecode
optimizations that give a +5% to pystone and it can also bring
generator expressions and decorators to python 2.3.

[OT]
0.8 is stuck on the conditional. We can bring the conditional expression
from the __future__ to users of 2.3/2.4 but I'm not sure people really
like the "T if C else F" syntax over "C ? T : F".

The argument: "python uses 'and'/'or' instead of &&/|| and therefore
it should also use 'if-else' instead of '?:'", just doesn't apply.
And generally this is one of those things that you will never find
the argument that proves which is the right choice. In these cases
you do what you *LIKE* more.

Perhaps a vote would be in order considering the this-or-that
nature of the conditional expression :)
st.

----------------------------------------------------------------
This message was sent through the TEI of ATHENS by means of NOC.
Oct 11 '05 #1
0 1186

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

Similar topics

4
by: Tom Anderson | last post by:
Evening all, Here's a brief chat with the interpretator: Python 2.4.1 (#2, Mar 31 2005, 00:05:10) on darwin Type "help", "copyright", "credits" or "license" for more information. >>> def...
3
by: martlaco1 | last post by:
Trying to fix a query that (I thought) had worked once upon a time, and I keep getting a Data Type Mismatch error whenever I enter any criteria for an expression using a Mid function. Without the...
6
by: lakshmi | last post by:
Hi all I'm trying to traverse through the results from a query that returns more than 1 row. The data reader reads only the first row. The following code doesn't work. Let me know what's wrong....
19
by: Frank Rizzo | last post by:
I want to log the user out when there has been a period of inactivity in the application. The key here is inactivity of the application, not the system. I know that you can retrieve the...
5
by: Kevin Buchan | last post by:
How can I tell if the system is 'idle', or the screen saver is running, or the machine is locked? I am writing an application that could really benefit from knowing this information. During...
18
by: bobueland | last post by:
IDLE doesn't seem to honor PYTHONSTARTUP environment variable nor sitecustomize.py How do you then customize in IDLE? (basically I want to execute the statement from btools import * each...
8
by: Vince Morgan | last post by:
Hi, I'm not sure that I have the right group, so please bear with me. Recently I created a fuction in the MS Access VBA IDE. The function returns a Boolean. I created the function to use as...
33
by: ram.ragu | last post by:
hi i have problem to calculate idle time of cpu and if idle time is more then i have to shut down the system. can anyone tell me the idea to so that please
6
by: Andreas Tawn | last post by:
I'm trying to integrate the timeout function from here http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473878 into a long running automation script and the following code causes IDLE after...
1
by: HillBilly | last post by:
What does that error mean and why would each break statement be marked as unreachable? It implies the return will --always-- return some --thing-- if even null and no further processing can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.