Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Clever One Liners

Reply
Thread Tools

Re: Clever One Liners

 
 
holger krekel
Guest
Posts: n/a
 
      07-03-2003
Curly Joe wrote:
> I agree with you, especially since the compiler, in
> most cases, must break everything down into single
> steps anyway. Take for instance a very simple
> example:
> x = a + b/c
> The compiler would execute this as:
> x = b/c
> x += a


to be more precise, the compiler would *compile*

x = a + b/c

to some bytecode like

LOAD_FAST 0 (a) # get var and put on valuestack
LOAD_FAST 1 (b) # get var and put on valuestack
LOAD_FAST 2 (c) # get var and put on valuestack
BINARY_DIVIDE # take 2 stack values and put
# the devision of them on valuestack
BINARY_ADD # take 2 stack values and put
# the sum on the value stack
STORE_FAST 3 (x) # store last stack item into "x"

and the interpreter would execute this bytecode.

> Michael Chermside wrote:
> I'm not picking on you in particular, there have been
> several people
> doing this lately, but I'd like to ask folks to please
> lay off the
> quest for one-liners.


What about going for writing bytecode-assembler instead of
language-level oneliners ?

cheers,

holger

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help on one-liners pankaj_wolfhunter@yahoo.co.in Digital Photography 2 08-02-2007 02:34 PM
Help on one-liners pankaj_wolfhunter@yahoo.co.in Digital Photography 0 08-01-2007 06:31 AM
Need help with python one liners which will not be caught by signal.alarm vj Python 0 04-19-2006 08:52 PM
one-liner to make all programs one-liners Larry Perl Misc 1 02-03-2005 11:35 PM
Re: Clever One Liners Curly Joe Python 0 07-03-2003 02:27 AM



Advertisments