can be used in several
namespaces and as attributes. It's just a bit harder to use
non-identifier names than identifiers.
Whether it's a good idea to use them at all is a different question.
I think the OP wondered about the .0 in the local namespace within list
comprehensions. Unfortunately I cannot say much about that.
Paul
Ralf M.
--
https://mail.python.org/mailman/listinfo/python-list
or what sections of the
documentation to read next.
Any ideas / pointers?
Ralf M.
--
https://mail.python.org/mailman/listinfo/python-list
Am 16.09.2022 um 23:34 schrieb Eryk Sun:
On 9/16/22, Ralf M. wrote:
I would like to replace a method of an instance, but don't know how to
do it properly.
A function is a descriptor that binds to any object as a method. For example:
>>> f = lambda self, x: self + x
Am 17.09.2022 um 00:35 schrieb Dan Stromberg:
On Fri, Sep 16, 2022 at 2:06 PM Ralf M. <mailto:ral...@t-online.de>> wrote:
I would like to replace a method of an instance, but don't know how to
do it properly.
You appear to have a good answer, but... are you sure
ot;, 1)[0]
if script_path not in sys.path:
sys.path[0:0] = [script_path]
import my_local_modul
That works, but it's ugly, executing code between imports is frowned
upon, and it needs to be added to every script.
Does anybody have a better idea?
Any help is appreciated.
Ralf M.
--
https://mail.python.org/mailman/listinfo/python-list
Am 21.04.2023 um 17:31 schrieb Mats Wichmann:
On 4/20/23 15:47, Ralf M. wrote:
Hello,
when I run a script with a "normally" installed python, the directory
the script resides in is automatically added as first element to
sys.path, so that "import my_local_module" finds m
Am 22.04.2023 um 03:27 schrieb Greg Ewing via Python-list:
How are you invoking your script? Presumably you have some code
in your embedding application that takes a script path and runs
it. Instead of putting the code to update sys.path into every
script, the embedding application could do it be
Am 21.04.2023 um 18:07 schrieb Thomas Passin:
On 4/20/2023 5:47 PM, Ralf M. wrote:
Hello,
when I run a script with a "normally" installed python, the directory
the script resides in is automatically added as first element to
sys.path, so that "import my_local_module" find
Am 25.04.2021 um 16:30 schrieb Mats Wichmann:
On 4/24/21 2:57 PM, Chris Angelico wrote:
On Sun, Apr 25, 2021 at 5:57 AM Gisle Vanem
wrote:
With 'py -3.6' or 'py 3.8' I get the expected.
But with 'py -3':
Python 3.8.9 (default, Apr 13 2021, 15:54:59) [GCC 10.2.0 64 bit
(AMD64)] on win32
Recently I wrote a quick and dirty script to do some counting and
statistics. When I re-read it a bit later I noticed that I had been
using two different ways to create two-dimensional (default-)dicts. Now
I'm wondering whether one of them is "better" or more pythonic than the
other.
What I d
Am 17.09.2019 um 20:59 schrieb Manfred Lotz:
I have a function like follows
def regex_from_filepat(fpat):
rfpat = fpat.replace('.', '\\.') \
.replace('%', '.') \
.replace('*', '.*')
return '^' + rfpat + '$'
As I don't want to have the r
Am 18.09.2019 um 22:22 schrieb Chris Angelico:
On Thu, Sep 19, 2019 at 6:20 AM Ralf M. wrote:
Am 17.09.2019 um 20:59 schrieb Manfred Lotz:
I have a function like follows
def regex_from_filepat(fpat):
rfpat = fpat.replace('.', '\\.') \
Am 18.09.2019 um 22:24 schrieb Alexandre Brault:
On 2019-09-18 4:01 p.m., Ralf M. wrote:
I don't know the exact rules of Windows wildcards, so there may be
even more cases of unexpected behavior.
If anyone knows where to find the complete rules (or a python module
that implements the
nd
another, different instance of En and its members is created.
How do I have to change mod1.py to avoid the problem?
Currently I have moved main() into a new file script.py. That works, but
is not what I wanted.
I doubt it's a bug in the enum module, but should that be the case, I
Hello,
to my last question I got many helpful and enlightening answers.
So I try again with a completely different topic.
https://docs.python.org/3/library/unittest.html#test-discovery
says about test discovery:
"Unittest supports simple test discovery. In order to be compatible with
test disc
15 matches
Mail list logo