A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/1999-November/018175.html below:

__str__ vs. __repr__

__str__ vs. __repr__ __str__ vs. __repr__Phil Hunt philh at vision25.demon.co.uk
Mon Nov 15 20:57:23 EST 1999
In article <m3n1shp2uu.fsf at atrus.jesus.cam.ac.uk>
           mwh21 at cam.ac.uk "Michael Hudson" writes:
> philh at vision25.demon.co.uk (Phil Hunt) writes:
> 
> > In article <01fd01bf2dce$d2c03cf0$f29b12c2 at secret.pythonware.com>
> >            fredrik at pythonware.com "Fredrik Lundh" writes:
> > > 2) what's the reason byte code cannot be used to recover
> > > the original source code
> > 
> > Perhaps because two different (but obviously functionally
> > identical and very similar) source codes could produce the same
> > byte code.
> 
> I doubt it actually. Python's bytecode is really pretty high
> level. Leastaways, I can't think of any examples.

How about:

   x = a + b + c
   x = (a + b) + c
   x=a+b+c

I'd guess these all produce the same bytecode.

I'd also not be surprised if you could consistently change the
name of a local variable within a function without changing bytecodes,
i.e. Python internally doesn't know the names of local variables.

> It's one of those things I might get round to writing one of these
> days. I don't really know how hard it would be. Not especially, I
> suspect.

You might want to have a look at how Java bytecode decompilers
work.

-- 
Phil Hunt - - - - - - - - -  philh at vision25.demon.co.uk
Moore's Law: processor speed doubles every 18 months
Gates' Law: software speed halves every 18 months



More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4