On Mon, Dec 05, 2022 at 10:37:39PM -0300, Sabrina Almodóvar wrote:
The Python Paradox
Paul Graham
August 2004
[SNIP]
Hence what, for lack of a better name, I'll call the Python paradox:
if a company chooses to write
I would depend on the project.
In the crytoanalysis tool that I developing, "cryptonita", I just
manipule bytes. Nothing that could depend on the distro so my CI picks
one OS and run the tests there.
Project: https://github.com/cryptonitas/cryptonita
CI:
https://github.com/cryptonitas/cryptonit
On Wed, Jul 27, 2022 at 08:32:31PM +0200, Morten W. Petersen wrote:
You're thinking of the backlog argument of listen?
From my understanding, yes, when you set up the "accepter" socket (the
one that you use to listen and accept new connections), you can define
the length of the queue for inco
I did a few tests
# test 1
def f():
i = 1
print(locals())
exec('y = i; print(y); print(locals())')
print(locals())
a = eval('y')
print(locals())
u = a
print(u)
f()
{'i': 1}
1
{'i': 1, 'y': 1}
{'i': 1, 'y': 1}
{'i': 1, 'y': 1, 'a': 1}
1
# test 2
def f():
i = 1
offtopic
If you want a pure-python but definitely a more hacky implementation,
you can play around with inspect.stack() and get the variables from
the outer frames.
# code:
x = 32
y = 42
printf("Hello x={x}, y={y}", x=27)
# output:
Hello x=27, y=42
The implementation of printf() was never re
Hi, I couldn't read your posts, every time I try to open one I'm
redirected to an index page.
I took a look at the smps project and I as far I understand it is a
SSL client that sends messages to a server that implements a store of
messages.
I would suggest to remove the sleep() calls and as a c
On Fri, Jul 08, 2022 at 04:15:35PM -0600, Mats Wichmann wrote:
In addition... there is no "Python 10.0" ...
Mmm, perhaps that's the problem :D
@Angie Odette Lima Banguera, vamos a necesitar algun traceback o algo
para guiarte. Podes tambien buscar en internet (youtube) q hay varios
tutori
Hi, I'm not an expert on this so this is an educated guess:
You are calling drop=True and I presume that you want to delete the rows
of your dataset that satisfy a condition.
That's a problem.
If the underlying original data is stored in a dense contiguous array,
deleting chunks of it will leav
Try to reinstall python and only python and if you succeeds, then try to
reinstall the other tools.
For this, use "apt-get" instead of "apt"
$ sudo apt-get reinstall python3
When a system is heavily broken, be extra careful and read the output of
the programs. If "apt-get" says than in order to
You probably want something like overload/multiple dispatch. I quick search
on PyPI yields a 'multipledispatch' package.
I never used, however.
On Wed, May 11, 2022 at 08:36:26AM -0700, Tobiah wrote:
On 5/11/22 06:33, Michael F. Stemper wrote:
I have a function that I use to retrieve daily dat
If the queue was not shared to any other process, I would guess that its
size is reliable.
However, a plain counter could be much simpler/safer.
The developer of multiprocessing.Queue, implemented
size() thinking in how to share the size and maintain a reasonable
consistency between process.
He/
I perhaps didn't understand the PEP completely but I think that the goal
of marking some objects as immortal is to remove the refcount from they.
For immutable objects that would make them truly immutable.
However I don't think that the immortality could be applied to any
immutable object by def
Then, you must put the initialization (dynamically loading the modules)
into the function executed in the foreign process.
You could wrap the payload function into a class instances to achieve this.
In the foreign process, you call the instance which first performs
the initialization and then exe
7; in sys.modules
True
So the last check proves that pickle.loads imports any necessary module.
Martin.
On Mon, Mar 07, 2022 at 08:28:15AM +, Barry wrote:
On 7 Mar 2022, at 02:33, Martin Di Paola wrote:
Yes but I think that unpickle (pickle.loads()) does that plus
importing any mod
Yeup, that would be my first choice but the catch is that "sayhi" may
not be a function of the given module. It could be a static method of
some class or any other callable.
Ah, fair. Are you able to define it by a "path", where each step in
the path is a getattr() call?
Yes but I think th
I'm not so sure about that. The author of the plugin knows they're
writing code that will be dynamically loaded, and can therefore
expect the kind of problem they're having. It could be argued that
it's their responsibility to ensure that all the needed code is loaded
into the subprocess.
Ye
Try to use `fork` as "start method" (instead of "spawn").
Yes but no. Indeed with `fork` there is no need to pickle anything. In
particular the child process will be a copy of the parent so it will
have all the modules loaded, including the dynamic ones. Perfect.
The problem is that `fork` is t
The way you've described it, it's a hack. Allow me to slightly redescribe it.
modules = loader()
objs = init(modules)
def invoke(mod, func):
# I'm assuming that the loader is smart enough to not load
# a module that's already loaded. Alternatively, load just the
# module you need,
Hi everyone. I implemented time ago a small plugin engine to load code
dynamically.
So far it worked well but a few days ago an user told me that he wasn't
able to run in parallel a piece of code in MacOS.
He was using multiprocessing.Process to run the code and in MacOS, the
default start metho
Could you share the traceback / error that you are seeing?
On Sun, May 02, 2021 at 03:23:21PM -0400, Quentin Bock wrote:
Code:
#imports and variables for game
import pygame
from pygame import mixer
running = True
#initializes pygame
pygame.init()
#creates the pygame window
screen = pygame.dis
That's correct. I tried to be systematic in the analysis so I tested all
the possibilities.
Your test results were unexpected for `python3 -m venv xxx`. By
default, virtual environments exclude the system and user site
packages. Including them should require the command-line argument
`--system-
If you have activated the venv then any script that uses /usr/bin/env
will use executables from the venv
bin folder.
That's correct. I tried to be systematic in the analysis so I tested all
the possibilities.
I avoid all these issues by not activating the venv. Python has code to
know
how
I did a few experiments in my machine. I created the following foo.py
import pandas
print("foo")
Now "pandas" is installed under Python 3 outside the venv. I can run it
successfully calling "python3 foo.py".
If I add the shebang "#!/usr/bin/env python3" (notice the 3), I can also
run it
? Logs are not intended to be read by end users. Logs are primarily
used to understand what the code is doing in a production environment.
They could also be used to gather metrics data.
Why should you log to give a message instead of simply using a print?
You are assuming that logs and prints
- On a line per line basis? on a function/method basis?
In general I prefer logging line by line instead per function.
It is easy to add a bunch of decorators to the functions and get the
logs of all the program but I most of the time I end up with very
confusing logs.
There are exceptions,
In _run I first set the new timer and then I execute the function. So
that will go mostly OK.
Yes, that's correct however you are not taking into consideration the
imprecision of the timers.
Timer will call the next _run() after self._interval *plus* some unknown
arbitrary time (and extra
Hello,
I understand that you want to share data across examples (docstrings)
because you are running doctest to validate them (and test).
The doctest implementation evaluates each docstring separately without
sharing the context so the short answer is "no".
This is a limitation of doctest b
I played with Julia a few months ago. I was doing some data-science
stuff with Pandas and the performance was terrible so I decided to give
Julia a try.
My plan was to do the slow part in Julia and call it from Python.
I tried juliacall (if I don't remember wrong) but I couldn't set up it.
Hi!, in short your code should work.
I think that the join-joined problem is just an interpretation problem.
In pseudo code the background_thread function does:
def background_thread()
# bla
print("join?")
# bla
print("joined")
When running this function in parallel using threads, you
IMHO, I prefer really weird names.
For example if I'm not sure how to name a class that I'm coding, I name it
like XXXYYY (literally). Really ugly.
This is a way to avoid the so called "naming paralysis".
Once I finish coding the class I look back and it should be easy to see "what
it does" and
You may want to reshape the dataset to a tidy format: Pandas works
better with that format.
Let's assume the following dataset (this is what I understood from your
message):
In [34]: df = pd.DataFrame({
...: 'Country': ['us', 'uk', 'it'],
...: '01/01/2019': [10, 20, 30],
...: '02/
While it is correct to say that Basic Auth without HTTPS is absolutely
insecure, using Basic Auth *and* HTTPS is not secure either.
Well, the definition of "secure" depends of your threat model.
HTTPS ensures encryption so the content, including the Basic Auth
username and password, is secret
This may not answer your question but it may provide an alternative
solution.
I had the same challenge that you an year ago so may be my solution will
work for you too.
Imagine that you have a Markdown file that *documents* the expected
results.
--8<---cut here---st
I don't know if it is useful but it is an interesting
metaprogramming/reflection challenge.
You used `inspect` but you didn't take its full potential. Try to see if
you can simplify your code and see if you can come with a decorator
that does not require special parameters.
from new import N
Very nice. I used rbspy for Ruby programs https://rbspy.github.io/
and it can give you some insights about the running code that other
profiling techniques may not give you.
I'll use it in my next performance-bottleneck challenge.
On Fri, Jul 02, 2021 at 04:04:24PM -0700, Gabriele Tornetta wro
From what I'm understanding it is an "optimization problem" like the
ones that you find in "linear programming".
But in your case the variables are not Real (they are Integers) and the
function to minimize g() is not linear.
You could try/explore CVXPY (https://www.cvxpy.org/) which it's a so
You could try https://plantuml.com and http://ditaa.sourceforge.net/.
Plantuml may not sound as the right tool but it is quite flexible and
after a few tweak you can create a block diagram as you shown.
And the good thing is that you *write* which elements and relations are
in your diagram an
One way to go is using Pandas as it was mentioned before and Seaborn for
plotting (built on top of matplotlib)
I would approach this prototyping first with a single file and not with
the 1000 files that you have.
Using the code that you have for parsing, add the values to a Pandas
DataFrame
"unselectable text" not necessary means that it is an image. There is
a CSS property that you can change to make a text
selectable/unselectable.
And if it is an image, it very likely that it comes from the server as
such, so "intercepting" the packet coming from there will be for
nothing: you
Hello,
I'm not 100% sure but I think that I understand what you are trying to
do. I faced the same problem a few months ago.
I wanted to know when a particular blog posted a new article.
My plan was to query the blog every day running a python script, get the
list of articles it has and compari
Hi everyone, I would like to share a free, open source tool with you that
I've been developing in the last few years.
You'll be probably familiar with things like this in the Python
documentation:
```
>>> 1 + 3
4
```
byexample will find those snippets, it will execute "1 + 3" and the
output
41 matches
Mail list logo