Steven D'Aprano writes on 10 Nov 2009
19:11:07 GMT:
> ...
> > So I am trying to restructure it using lazy evaluation.
>
> Oh great, avoiding confusion with something even more confusing.
Lazy evaluation may be confusing if it is misused.
But, it may be very clear and powerful if used appropriat
Steven D'Aprano writes on 22 Feb 2010
06:07:05 GMT:
> ...
> It's *especially* not safe if you put nothing in the globals dict,
> because Python kindly rectifies that by putting the builtins into it:
>
> >>> eval("__builtins__.keys()", {}, {})
> ['IndexError', 'all', 'help', 'vars', ... 'Overflo
Chris Withers writes on Thu, 13 Aug 2009 08:20:37
+0100:
> ...
> I've already established that the file downloads in seconds with
> [something else], so I'd like to understand why python isn't doing the
> same and fix the problem...
A profile might help to understand what the time is used for.
"Martin v. Löwis" writes on Fri, 28 Aug 2009 10:12:34
+0200:
> > The PEP says:
> > * unichr(i) for 0 <= i < 2**16 (0x1) always returns a
> >length-one string.
> >
> > * unichr(i) for 2**16 <= i <= TOPCHAR will return a
> >length-one string on wide Python builds. On
Bob Kline wrote at 2023-7-14 13:35 -0400:
>Can someone point me to the official catalog of security vulnerabilities in
>Python (by which I mean cpython and the standard libraries)? I found
>https://www.cvedetails.com/vulnerability-list/vendor_id-10210/product_id-18230/Python-Python.html
>but that i
Chris Nyland wrote at 2023-7-22 19:12 -0400:
>So I am stuck on a problem. I have a class which I want to use to create
>another class without having to go through the boiler plate of subclassing.
Do you know about `__init_subclass__`?
It is called whenever a class is subclassed and can be used to
Dom Grigonis wrote at 2023-7-26 05:22 +0300:
> ...
>Is there a way to achieve it without actually implementing operators?
>I have looked at Proxy objects, but they do not seem suited to achieve this.
Proxying is a good approach:
you might have a look at `dm.reuse.proxy.OverridingProxy` (--> `dm.re
Jason Friedman wrote at 2023-8-3 21:34 -0600:
> ...
>my_frame = inspect.currentframe()
> ...
>My question is: let's say I wanted to add a type hint for my_frame.
`my_frame` will be an instance of `Types.FrameType`.
--
https://mail.python.org/mailman/listinfo/python-list
c.bu...@posteo.jp wrote at 2023-8-17 07:10 +:
>I want to display one string in its original source (untranslated)
>version and in its translated version site by site without duplicating
>the string in the python source code?
Is it an option for you to replace the `gettext` binding
by `zope.i18
c.bu...@posteo.jp wrote at 2023-8-17 07:10 +:
>I want to display one string in its original source (untranslated)
>version and in its translated version site by site without duplicating
>the string in the python source code?
You could try to translate into an unknown language: this
should give
Jan Erik Moström wrote at 2023-9-3 18:10 +0200:
>I'm looking for some advice for how to write this in a clean way
> ...
>The "problem" is that I've currently written some code that works but it uses
>global variables ... and I don't like global variables. I assume there is a
>better way to write
Jen Kris wrote at 2023-10-2 00:04 +0200:
>Iwant to write a list of 64-bit integers to a binary file. Everyexample I
>have seen in my research convertsit to .txt, but I want it in binary. I wrote
>this code,based on some earlier work I have done:
>
>buf= bytes((len(qs_array)) * 8)
>
>for offset
Janis Papanagnou wrote at 2023-10-21 04:03 +0200:
> ...
>I'd like to ask; where do you see the specific risks with Python
>(as language per se) and it's (web-socket-)libraries here?
The web server in Python's runtime library is fairly simple,
focusing only on the HTTP requirements.
You might want
o1bigtenor wrote at 2023-10-24 07:22 -0500:
> ...
>Is there a way to verify that a program is going to do what it is
>supposed to do even
>before all the hardware has been assembled and installed and tested?
Others have already noted that "verify" is a very strong aim.
There are different kinds o
Frank Millman wrote at 2023-10-25 09:57 +0200:
> ...
>Based on this, I am considering the following -
>
>1. Replace my HTTP handler with Uvicorn. Functionality should be the
>same, but performance should be improved.
>
>2. Instead of running as a stand-alone server, run my app as a
>reverse-proxy u
o1bigtenor wrote at 2023-10-25 06:44 -0500:
>On Wed, Oct 25, 2023 at 6:24?AM Dieter Maurer wrote:
> ...
>> There are different kinds of errors.
>>
>> Some can be avoided by using an integrated development environment
>> (e.g. misspellings, type mismatches, ...).
&g
o1bigtenor wrote at 2023-10-25 07:50 -0500:
>> There are several others,
>> e.g. "ECLIPSE" can be used for Python development.
>
>Is 'Eclipse' a Windows oriented IDE?
No.
==> "https://en.wikipedia.org/wiki/Eclipse_(software)"
--
https://mail.python.org/mailman/listinfo/python-list
o1bigtenor wrote at 2023-10-25 08:29 -0500:
> ...
>It would appear that something has changed.
>
>Went to the Eclipse download page, downloaded and verified (using sha-512).
>Expanded software to # opt .
>There is absolutely NO mention of anything python - - - java, c and
>its permutations,
>'scien
Loris Bennett wrote at 2023-10-27 09:29 +0200:
> ...
>For the application with the system Python this mechanism works, but for
>the non-system Python I get the error:
>
> NameError: name '__version__' is not defined
If you get exceptions (they usually end in `Error` (such as `NameError`)),
look a
Chris Green wrote at 2023-10-28 17:08 +0100:
>I am using the python3 smbus module, but it's hard work because of the
>lack of documentation. Web searches confirm that the documentation is
>somewhat thin!
>
>If you do the obvious this is what you get:-
>
>>>> import smbus
>>>> dir (smbus)
>
Chris Green wrote at 2023-11-2 10:58 +:
> ...
>So, going on from this, how do I do the equivalent of "apt update; apt
>upgrade" for my globally installed pip packages?
`pip list -o` will tell you for which packages there are upgrades
available.
`pip install -U ...` will upgrade packages.
Be c
Karsten Hilbert wrote at 2023-11-3 14:47 +0100:
> ...
>> Are they not available in your system's package manager?
>
>... this clearly often answers to "no" for applications of
>any complexity.
>
>Is there a suggested proper path to deal with that (Debian is
>of interest to me here) ?
Complex appli
Karsten Hilbert wrote at 2023-11-5 23:19 +0100:
> ...
>do you happen to know where to read up on how to fit a pip
>constraint file into a Debian package creation workflow ?
I have only rudimentary `apt` knowledge.
I know it is quite flexible, e.g. it used to handle `flash`
in a special way. I exp
c.bu...@posteo.jp wrote at 2023-11-6 12:47 +:
>I would like to know how to detect (e.g. via a linter) typos in function
>names imported from another module.
One option is a test suite (--> Python's "unittest" package)
with a sufficiently high coverage (near 100 %).
--
https://mail.python.org/
Dom Grigonis wrote at 2023-11-15 18:44 +0200:
>So there is a method __set_name__ which is called on class creation.
>
>The functionality that I am interested in is not retrieving name, but the fact
>that it also receives `owner` argument.
>
>Thus, allowing simulation of bound class method.
>
>I wa
Dom Grigonis wrote at 2023-11-16 20:12 +0200:
>What I am interested in is a callback.
>Preferably just after methods get bound. So in `object.__new__`.
>I have done it via metaclass, but it is not ideal as there would be too much
>overhead.
>
>I think what I am looking for is custom method bindin
Dom Grigonis wrote at 2023-11-16 21:11 +0200:
> ...
>> On 16 Nov 2023, at 21:00, Dieter Maurer wrote:
>> ...
>> Methods are not bound during instance creation, they are bound during
>> access.
>
>Good to know. What is the criteria for binding then? Does i
Piergiorgio Sartor wrote at 2023-11-25 22:15 +0100:
> ...
>Apparently, the "with" context manager is not usable
>in classes, at least not with __init__() & co.
You can use `with` in classes -- with any context manager.
However, you would usually not use `with` with a file you have opened
in `__ini
Guenther Sohler wrote at 2024-1-9 08:14 +0100:
>when i run this code
>
>a = cube([10,1,1])
>b = a
>
>i'd like to extend the behaviour of the assignment operator
>a shall not only contain the cube, but the cube shall also know which
>variable name it
>was assigned to, lately. I'd like to use that
Frank Millman wrote at 2024-1-15 15:51 +0200:
>I have read that one should not have to worry about garbage collection
>in modern versions of Python - it 'just works'.
There are still some isolated cases when not all objects
in an unreachable cycle are destroyed
(see e.g. step 2 of
"https://devgui
>On 27/01/24 10:46 am, Stefan Ram wrote:
>>But your explanation seems to have no mention of the "something" /
>>"the awaitable object" part following the preposition "on". Shouldn't
>>this awaitable object play a rôle in the explanation of what happens?
You can explain a function call
Rich Shepard wrote at 2024-1-29 08:15 -0800:
> ...
>If this explanation is not sufficiently clear I'll re-write it. :-)
Have you read "https://docs.python.org/3/library/io.html#module-io";?
--
https://mail.python.org/mailman/listinfo/python-list
Sanskar Mukeshbhai Joshi wrote at 2024-3-10 18:08 +:
>I had made my project in BCA in Python. When I had complete my project and run
>the program, at that time I got the error in runnig my project. The error was
>ModuleNotFoundError: No module named 'flask'.
`flask` is not part of the Python
Loris Bennett wrote at 2024-3-21 10:56 +0100:
> ...
>So as I understand it, I need to convert the InstanceState-objects to,
>say, dicts, in order to print them. However I also want to remove one
>of the keys from the output and assumed I could just pop it off each
>event dict, thus:
>
>event_d
Thomas Nyberg wrote at 2024-3-22 11:08 +0100:
> ... `future` use across thread boundaries ...
> Here's an example using just the standard library that
> exhibits the same issue:
I think all `asyncio` objects (futures, tasks, ...)
are meant to be used in a single thread.
If you use them across diff
dieter.mau...@online.de wrote at 2024-3-22 18:28 +0100:
>Thomas Nyberg wrote at 2024-3-22 11:08 +0100:
>> ... `future` use across thread boundaries ...
>> Here's an example using just the standard library that
>> exhibits the same issue:
> ...
>For use across thread boundaries, you likely will use
Johanne Fairchild wrote at 2024-5-3 10:56 -0300:
>How to discover what values produced an exception? Or perhaps---why
>doesn't the Python traceback show the values involved in the TypeError?
>For instance:
>
>--8<>8---
(0,0) < 4
>Traceba
HenHanna wrote at 2024-5-30 13:03 -0700:
>
>Given a text file of a novel (JoyceUlysses.txt) ...
>
>could someone give me a pretty fast (and simple) Python program that'd
>give me a list of all words occurring exactly once?
Your task can be split into several subtasks:
* parse the text into words
Edward Teach wrote at 2024-6-3 10:47 +0100:
> ...
>The Gutenburg Project publishes "plain text". That's another problem,
>because "plain text" means UTF-8and that means unicode...and that
>means running some sort of unicode-to-ascii conversion in order to get
>something like "words". A couple
Yair Eshel wrote at 2024-6-13 13:01 +0300:
> ...
>I would like to suggest an alternative syntax, that will, in a sense, apply
>the best of both worlds:
>
>import logging
>with open('sample_data/README.md') as f:
> print (len(f.read()))
>except FileNotFoundError:
> logging.error("File not")
Are y
Ulrich Goebel wrote at 2024-6-28 18:08 +0200:
>Hi,
>
>a class can have methods, and it can have attributes, which can hold a
>function. Both is well known, of course.
>
>My question: Is there any difference?
I think you should make the distinction "class versus instance attribute"
rather than "me
Loris Bennett wrote at 2024-11-1 10:10 +0100:
> ...
> mail.set_content(body, cte="quoted-printable")
In the line above, you request the content to use
the "cte" (= "Content-Transfer-Encoding") "quoted-printable"
and consequently, the content is encoded with `quoted-printable`.
Maybe, you do not n
> ...
>After the recent upgrades I had to install youtube_dl with pipx for the
>new python version.
>When I ran the script which imported youtube_dl, I got an import error
>as it appears the path to the module
>was not in sys.path
I see at several options:
* install `youtoube_dl` where Pytho
Loris Bennett wrote at 2024-11-11 15:05 +0100:
>I have the following in my program:
>try:
>logging.config.fileConfig(args.config_file)
>config = configparser.ConfigParser()
>config.read(args.config_file)
>if args.verbose:
>print(f"Configuration file:
Loris Bennett wrote at 2024-11-12 10:00 +0100:
> ...
>However, it strikes me as not immediately obvious that the logging file
>must exist at this point. I can imagine a situation in which I want to
>configure a default log file and create it if it missing.
This is what happens usually:
if you ope
Cameron Simpson wrote at 2024-11-12 08:17 +1100:
>On 11Nov2024 18:24, dieter.mau...@online.de wrote:
>>Loris Bennett wrote at 2024-11-11 15:05 +0100:
>>>I have the following in my program:
>>>try:
>>>logging.config.fileConfig(args.config_file)
>>>config = configparser.ConfigPar
301 - 346 of 346 matches
Mail list logo