Generate Popular Tags for instagram or facebook

2021-09-20 Thread Python 4 Fun
Before we proceed let me make it clear we are not scraping tags from any website. We will "Generate" them using simple code in python. So, How does it work? First, I have collected all popular tags and saved it in a text file as list. [Read More] https://pysnakeblog.blogspot.com/2021/09/gener

Re: Explaining exec(globals, separate_locals)

2021-09-20 Thread Eryk Sun
On 9/20/21, Terry Reedy wrote: > > "If exec gets two separate objects as globals and locals, the code will > be executed as if it were embedded in a class definition." Note that, unlike exec(), the body of a class definition can modify closure variables in nonlocal function scopes. For example:

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Peter J. Holzer
On 2021-09-20 05:08:55 -0700, Mostowski Collapse wrote: > You have to copy C1,..,Cm one position down. On the other > hand, when scanning the single list, removing the > element is just pointer swizzling. That's the problem. You think that pointer swizzling is fast because you are used to language

Explaining exec(globals, separate_locals)

2021-09-20 Thread Terry Reedy
The second paragraph of the current exec entry https://docs.python.org/3.11/library/functions.html#exec ends with a sentence I wrote. "If exec gets two separate objects as globals and locals, the code will be executed as if it were embedded in a class definition." Would the following would be

Inheriting from str

2021-09-20 Thread ast
Hello class NewStr(str): def __init__(self, s): self.l = len(s) Normaly str is an immutable type so it can't be modified after creation with __new__ But the previous code is working well obj = NewStr("qwerty") obj.l 6 I don't understand why it's working ? (python 3.9) -- https:/

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Chris Angelico
On Tue, Sep 21, 2021 at 3:58 AM Mostowski Collapse wrote: > > I read the following, and you should also know: > > > Python's [] is implemented as an array, not a linked list. > > Although resizing is O(n), appending to it is amortized O(1), > > because resizes happen very rarely. > https://stackov

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Chris Angelico
On Tue, Sep 21, 2021 at 3:51 AM Mostowski Collapse wrote: > > sympy also builds a language on top of Python. > pandas also builds a language on top of Python. > > Is there some pope that says this wouldn't be > allowed, I dont think so, otherwise sympy, pandas, etc.. > > wouldn't exist. I dont und

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
Now I am expecting somebody telling me I should not program Java style in Python. So I wonder what would have happened if I would tell you I am FORTRAN programmer. Then somebody would tell me I should not program FORTRAN style in Python. Hopefully this makes it evident that this argumentation is

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
The sweep_trail() is not an issue. There must be a bottleneck somewhere else in Python. The sweep_trail() respectively the paremt call gc() only takes a very small fraction of the runtime: Check the "gc" timing, the bottleneck is somewhere else? Mostowski Collapse schrieb am Freitag, 17. Septemb

Re: Inheriting from str

2021-09-20 Thread Jon Ribbens via Python-list
On 2021-09-20, ast wrote: > Hello > > class NewStr(str): > def __init__(self, s): > self.l = len(s) > > Normaly str is an immutable type so it can't be modified > after creation with __new__ > > But the previous code is working well > > obj = NewStr("qwerty") > obj.l > 6 > > I don't und

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
In general the algorithm I am using is from a paper by Matts Carlson from SICStus Prolog. Its this paper here: Garbage Collection for Prolog Based on WAM January 1986 Karen Appleby, Mats Carlsson, Seif Haridi, Dan Sahlin https://www.researchgate.net/publication/279463524 But since you guys are s

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
Also I am not a C programmer. The last time I was programming C was 30 years ago. I am mostly a Java programmer the recent years. Dogelog Runtime adopts a lot of implementation details from Jekejeke Prolog which is a Prolog written in Java. The difference betweeen the two is that Jekejeke Prolog

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
This strategy works if you use failure driven loops. It doesn't work you program recursive loops that go on forever. Like Erlang processes. foo(X) :- bar(X,Y), foo(Y). Typically Y is a fresh variable. A good Prolog system with good Garbage Collection can run such a process for days and months.

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
What would be maybe possible, is to scan the trail from the other side, and use a first pass to determine the new size, and use a second pass to fill a new array with the remaining elments. This would be two times O(n), so it would be linear and not quadratic O(n^2) as when you scan from the top

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
Please be patient. A big problem with development can be burnout. So I am trying to slow down things at the moment. The ideas are easy to sketch, but implementation can take weeks. Here is the idea again in a nutshell: use ast.parse() and compile(). Or build directly an AST, not using the string

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
I read the following, and you should also know: > Python's [] is implemented as an array, not a linked list. > Although resizing is O(n), appending to it is amortized O(1), > because resizes happen very rarely. https://stackoverflow.com/a/5932364/502187 The list type doesn't have an O(1) opera

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
Also I nowhere wrote that I would use doubly-linked list or a set of objects. The trail is neither, its a single linked list. I also refer directly to objects, I do not need the trail to refer to objects. The Prolog trail is only a logbook. The Prolog trail has similarity to a database log: t

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
But I dont see any utility in investing too much time with the Prolog garbage collection of Dogelog runtime. It is only a small share of the execution time: Mostowski Collapse schrieb am Freitag, 17. September 2021 um 10:58:57 UTC+2: > %%% > % S

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Mostowski Collapse
sympy also builds a language on top of Python. pandas also builds a language on top of Python. Is there some pope that says this wouldn't be allowed, I dont think so, otherwise sympy, pandas, etc.. wouldn't exist. I dont understand your argument. Chris Angelico schrieb: On Mon, Sep 20, 2021 at

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Greg Ewing
On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse wrote: On the other hand if I would use the trigger from Python, I possibly would need a double linked list, to remove an element. Here's another idea: Put weak references in the trail, but don't bother with the scanning -- just skip over dea

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Chris Angelico
On Mon, Sep 20, 2021 at 9:50 PM Peter J. Holzer wrote: > > Let Python be Python, don't try to build your own language on top of > > it. > > Well, he's writing a Prolog interpreter, so building his own language on > top of Python is sort of the point. I think a better way to put it is > "Don't try

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Peter J. Holzer
On 2021-09-20 04:33:39 +1000, Chris Angelico wrote: > On Mon, Sep 20, 2021 at 3:19 AM Mostowski Collapse > wrote: > > Question to Chris Angelico: If I stay with my > > sweep_trail(), which is the periodically scanning, > > I can use a single linked list. > > > > On the other hand if I would use t