I got to the point of trying to implement continue in my own interpreter
project and was surprised when my for-loop just used some jumps to manage its
control flow. Actually, I hoped for something else; I don't have logic in my
code generation to track jump positions. I kind of hoped there was s
On Friday, May 29, 2020 at 7:30:32 AM UTC-5, Eryk Sun wrote:
> On 5/28/20, Adam Preble wrote:
> Sometimes a user will open a script via "open with" and browse to
> python.exe or py.exe. This associates .py files with a new progid that
> doesn't pass the %* comma
On Thursday, May 28, 2020 at 7:57:04 PM UTC-5, Terry Reedy wrote:
> The OP is so far choosing to not use an installer with those fixes. By
> not doing so, he is missing out on the maybe 2000 non-security fixes and
> some enhancements that likely would benefit him more than maybe 50
> mostly obs
I wanted to update from 3.6.8 on Windows without necessarily moving on to 3.7+
(yet), so I thought I'd try 3.6.9 or 3.6.10.
All I see for both are source archives:
https://www.python.org/downloads/release/python-369/
https://www.python.org/downloads/release/python-3610/
So, uh, I theoretically
The (rightful) obsession with modules in PEP-451 and the import machinery hit
me with a gotcha when I was trying to implement importing .NET stuff that
mimicked IronPython and Python.NET in my interpreter project.
The meat of the question:
Is it important that the spec loader actually return a m
I'm fussing over some details of relative imports while trying to mimic Python
module loading in my personal project. This is getting more into corner cases,
but I can spare time to talk about it while working on more normal stuff.
I first found this place:
https://manikos.github.io/how-pythons-
On Saturday, April 18, 2020 at 1:15:35 PM UTC-5, Alexandre Brault wrote:
> >>> def f():
> ... â â from sys import path, argv ...
So I figured it out and all but I wanted to ask about the special characters in
that output. I've seen that a few times and never figured out what's going on
and if
On Friday, April 17, 2020 at 1:37:18 PM UTC-5, Chris Angelico wrote:
> The level is used for package-relative imports, and will basically be
> the number of leading dots (eg "from ...spam import x" will have a
> level of 3). You're absolutely right with your analysis, with one
> small clarification
On Friday, April 17, 2020 at 1:22:18 PM UTC-5, Adam Preble wrote:
> At this point, my conceptual stack is empty. If I POP_TOP then I have nothing
> to pop and the world would end. Yet, it doesn't. What am I missing?
Check out this guy replying to himself 10 minutes later.
I guess
Given this in Python 3.6.8:
from dis import dis
def import_from_test():
from sys import path
>>> dis(import_from_test)
2 0 LOAD_CONST 1 (0)
2 LOAD_CONST 2 (('path',))
4 IMPORT_NAME 0 (sys)
6 IMPORT_
On Thursday, March 19, 2020 at 5:02:46 PM UTC-5, Greg Ewing wrote:
> On 11/03/20 7:02 am, Adam Preble wrote:
> > Is this foo attribute being looked up in an override of __getattr__,
> > __getattribute__, or is it a reserved slot that's internally doing this?
> > That
On Tuesday, March 10, 2020 at 9:28:11 AM UTC-5, Peter Otten wrote:
> self.foo looks up the attribute in the instance, falls back to the class and
> then works its way up to the parent class, whereas
>
> super().foo bypasses both instance and class, and starts its lookup in the
> parent class.
I
On Monday, March 9, 2020 at 9:31:45 PM UTC-5, Souvik Dutta wrote:
> This should be what you are looking for.
> https://python-reference.readthedocs.io/en/latest/docs/functions/super.html
I'm not trying to figure out how the super() function works, but rather the
anatomy of the object is returns.
On Wednesday, March 4, 2020 at 11:13:20 AM UTC-6, Adam Preble wrote:
> Stuff
I'm speculating that the stuff I don't see when poking are reserved slots. I
figured out how much of a thing that is when I was digging around for how
classes know how to construct themselves. I managed
Months ago, I asked a bunch of stuff about super() and managed to fake it well
enough to move on to other things for awhile. The day of reckoning came this
week and I was forced to implement it better for my personal Python project. I
have a hack in place that makes it work well-enough but I fou
On Monday, March 2, 2020 at 3:12:33 PM UTC-6, Marco Sulla wrote:
> Is your project published somewhere? What changes have you done to the
> interpreter?
I'm writing my own mess:
https://github.com/rockobonaparte/cloaca
It's a .NET Pythonish interpreter with the distinction of using a whole lot of
On Monday, March 2, 2020 at 7:09:24 AM UTC-6, Lele Gaifax wrote:
> Yes, you just used it, although you may have confused its meaning:
>
Yeah I absolutely got it backwards. That's a fun one I have to fix in my
project now!
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday, March 1, 2020 at 3:08:29 PM UTC-6, Terry Reedy wrote:
> Because BaseClass is the superclass of SubClass.
So there's a mechanism for parent classes to know all their children?
--
https://mail.python.org/mailman/listinfo/python-list
Based on what I was seeing here, I did some experiments to try to understand
better what is going on:
class BaseClass:
def __init__(self):
self.a = 1
def base_method(self):
return self.a
def another_base_method(self):
return self.a + 1
class SubClass(BaseCl
I have been making some progress on my custom interpreter project but I found I
have totally blown implementing proper subclassing in the data model. What I
have right now is PyClass defining what a PyObject is. When I make a PyObject
from a PyClass, the PyObject sets up a __dict__ that is used
I'm trying to understand the difference in disassemblies with 3.6+ versus older
versions of CPython. It looks like the basic opcodes like LOAD_FAST are 3 bytes
in pre-3.6 versions, but 2 bytes in 3.6+. I read online somewhere that there
was a change to the argument sizes in 3.6: it became 2 byte
Thanks for the replies from everybody. It looks like I should double check
super_init and see what truck is coming from that which will hit me with a
gotcha later. I'm very naively right now plucking the class from my locals and
I was able to proceed in the very, very short term.
I think I woul
I was wrong in the last email because I accidentally in super_gettro instead of
super_init.
Just for some helper context:
>>> class Foo:
... pass
...
>>> class Bar(Foo):
... def __init__(self):
... super().__init__()
... self.a = 2
...
>>> dis(Bar)
Disassembly of __init__:
3
On Thursday, June 27, 2019 at 8:30:21 PM UTC-5, DL Neil wrote:
> I'm mystified by "literally given nothing".
I'm focusing there particularly on the syntax of writing "super()" without any
arguments to it. However, internally it's getting fed stuff.
> If a class has not defined an attribute, eg s
I'm trying to mimick Python 3.6 as a .NET science project and have started to
get into subclassing. The super() not-a-keyword-honestly-guys has tripped me
up. I have to admit that I've professionally been doing a ton Python 2.7, so
I'm not good on my Python 3.6 trivia yet. I think I have the gen
On Friday, April 5, 2019 at 5:54:42 PM UTC-5, Gregory Ewing wrote:
> But when compiling a class body, it uses a dict to hold the
> locals, and generates LOAD_NAME and STORE_NAME opcodes to
> access it.
>
> These opcodes actually date from very early versions of
> Python, when locals were always ke
On Thursday, April 4, 2019 at 1:17:02 PM UTC-5, adam@gmail.com wrote:
> Thanks for the response. I was meaning to write back earlier, but I've been
> spending my free Python time in the evenings reimplementing what I'm doing to
> work more correctly. I'm guessing before the code object repre
On Monday, April 1, 2019 at 1:23:42 AM UTC-5, Gregory Ewing wrote:
> adam.pre...@gmail.com wrote:
> https://eli.thegreenplace.net/2012/06/15/under-the-hood-of-python-class-definitions
>
> Briefly, it creates a dict to serve as the class's namespace dict,
> then executes the class body function pas
I have been mimicking basic Python object constructs successfully until I
started trying to handle methods as well in my hand-written interpreter. At
that point, I wasn't sure where to stage all the methods before they get
shuffled over to an actual instance of an object. I'm having to slap this
On Thursday, March 21, 2019 at 10:26:14 PM UTC-5, Sharan Basappa wrote:
> I am running a program and even though the program runs all fine, the log
> file is missing. I have pasted first few lines of the code.
>
I am thinking--hoping, rather--that you just kind of double pasted there.
Anyways, y
On Tuesday, March 19, 2019 at 9:49:48 PM UTC-5, Chris Angelico wrote:
> I would recommend parsing in two broad steps, as CPython does:
>
> 1) Take the source code and turn it into an abstract syntax tree
> (AST). This conceptualizes the behaviour of the code more-or-less the
> way the programmer w
On Tuesday, March 19, 2019 at 3:48:27 PM UTC-5, Chris Angelico wrote:
> > I can see in vartest() that it's using a LOAD_GLOBAL for that, yet first()
> > and second() don't go searching upstairs for a meow variable. What is the
> > basis behind this?
> >
>
> Both first() and second() assign to th
I got hit on the head and decided to try to write something of a Python
interpreter for embedding. I'm starting to get into the ugly stuff like
scoping. This has been a good way to learn the real deep details of the
language. Here's a situation:
>>> meow = 10
>>> def vartest():
... x = 1
..
I have a module with a dependency specifically on pillow>=4.2.1. We are using
an internal PyPI that has removed the pillow 4.x series, but it does have
5.2.0. If we try to install pillow>=4.2.1 it doesn't find anything. If we just
instruct pip to install pillow, then it will end up installing pi
On Sunday, June 10, 2018 at 3:05:45 PM UTC-5, Barry wrote:
> The way I learn about the details of RPM packaging is to look at examples
> like what I wish to achieve.
>
> I would go get the source RPM for a python2 package from each distro you want
> to supoort and read its .spec file.
>
> I se
I have a situation where internally I need to distribute some Python code using
Linux packages rather than simply relying on wheel files. This seems to be a
solved problem because a lot of Python modules clearly get distributed as .rpm
and .deb. It's not completely unreasonable because soon I wi
On Friday, August 9, 2013 1:31:43 AM UTC-5, Peter Otten wrote:
> I see I have to fix it myself then...
Sorry man, I think in my excitement of seeing the first of your examples to
work, that I missed the second example, only seeing your comments about it at
the end of the post. I didn't expect s
I thought I responded to this. Oh well
On Friday, August 9, 2013 12:47:43 AM UTC-5, Benjamin Kaplan wrote:
> Are you using Python.NET or IronPython? IronPython is reasonably well
>
> supported, and it looks like there's a patch you can use to get PyLint
>
> working on it (see
>
> http://mail.
PyLint can't figure out imports of .NET code being referenced in my Python
scripts that use Python.NET. I can kind of see why; you have to evaluate some
clr.AddReference calls for the imports to even succeed. I wonder if I have any
recourse. Generally, to import a DLL you have to do a few thi
On Thursday, August 8, 2013 3:50:47 AM UTC-5, Peter Otten wrote:
> Peter Otten wrote:
> Oops, that's an odd class name. Fixing the name clash in Types.__new__() is
>
> left as an exercise...
Interesting, I got __main__.T, even though I pretty much just tried your code
wholesale. For what it's
On Thursday, August 8, 2013 3:04:30 AM UTC-5, Terry Reedy wrote:
> I cannot help but note that this is *more* typing. But anyhow, something
It wasn't so much about the typing so much as having "test" in front of
everything. It's a problem particular to me since I'm writing code that, well,
run
On Thursday, August 8, 2013 3:50:47 AM UTC-5, Peter Otten wrote:
> Peter Otten wrote:
> Oops, that's an odd class name. Fixing the name clash in Types.__new__() is
>
> left as an exercise...
I will do some experiments with a custom test loader since I wasn't aware of
that as a viable alternativ
We were coming into Python's unittest module from backgrounds in nunit, where
they use a decorate to identify tests. So I was hoping to avoid the convention
of prepending "test" to the TestClass methods that are to be actually run. I'm
sure this comes up all the time, but I mean not to have to
43 matches
Mail list logo