On 24/05/2023 15:37, A KR wrote:
It is perfectly explained in the standards here [1] saying that:
In order to avoid infinite recursion in this method, its implementation should
always call the base class method with the same name to access any attributes
it needs, for example, object.__getatt
On 21/04/2023 00:44, Lorenzo Catoni wrote:
Dear Python Mailing List members,
I am writing to seek your assistance in understanding an unexpected
behavior that I encountered while using the __enter__ method. I have
provided a code snippet below to illustrate the problem:
```
class X:
... _
On 31/03/2023 15:01, Loris Bennett wrote:
Hi,
In my top level program file, main.py, I have
def main_function():
parser = argparse.ArgumentParser(description="my prog")
...
args = parser.parse_args()
config = configparser.ConfigParser()
if args.config_f
On 27/01/2023 21:31, Ivan "Rambius" Ivanov wrote:
Hello,
I am developing a script that accepts a time zone as an option. The
time zone can be any from pytz.all_timezones. I have
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-z", "--zone", choices=pytz.all_timezon
On 18/12/2022 16:44, songbird wrote:
Peter Otten wrote:
...
While I think what you need is a database instead of the collection of
csv files the way to alter namedtuples is to create a new one:
from collections import namedtuple
Row = namedtuple("Row", "foo bar baz")
ro
On 17/12/2022 20:45, Albert-Jan Roskam wrote:
On Dec 15, 2022 10:21, Peter Otten <__pete...@web.de> wrote:
>>> from collections import namedtuple
>>> Row = namedtuple("Row", "foo bar baz")
>>> row = Row(1, 2, 3)
&g
On 14/12/2022 19:50, songbird wrote:
I'm relatively new to python but not new to programming in general.
The program domain is accounting and keeping track of stock trades and other
related information (dates, cash accounts, interest, dividends, transfers of
funds, etc.)
Assume that
On 13/12/2022 15:46, Michael F. Stemper wrote:
It's easy enough -- in fact necessary -- to handle the bottom
level of a function differently than the levels above it. What
about the case where you want to handle something differently
in the top level than in lower levels? Is there any way to tell
On 08/12/2022 02:17, Jach Feng wrote:
Peter Otten 在 2022年12月8日 星期四清晨5:17:59 [UTC+8] 的信中寫道:
On 07/12/2022 03:23, Jach Feng wrote:
s0 = r'\x0a'
At this moment it was done by
def to1byte(matchobj):
return chr(int('0x' + matchobj.group(1), 16))
s1 = re.sub(r'\\x([0-9
On 07/12/2022 03:23, Jach Feng wrote:
s0 = r'\x0a'
At this moment it was done by
def to1byte(matchobj):
return chr(int('0x' + matchobj.group(1), 16))
s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
But, is it that difficult on doing this simple thing?
>>> import codecs
>>>
On 03/11/2022 04:24, Paulo da Silva wrote:
Hi!
And a typing problem again!!!
___
class C:
def __init__(self):
self.__foos=5*[0]
@property
def foos(self) -> list[int]:
return self.__foos
@foos.setter
def foos(self,v:
On 30/10/2022 14:37, Peter J. Holzer wrote:
On 2022-10-30 09:23:27 -0400, Thomas Passin wrote:
On 10/30/2022 6:26 AM, Peter J. Holzer wrote:
On 2022-10-29 23:59:44 +0100, Paulo da Silva wrote:
The funny thing is that if I replace foos by Foos it works because it gets
known by the initial initi
On 24/10/2022 05:19, Chris Angelico wrote:
On Mon, 24 Oct 2022 at 14:15, Dan Stromberg wrote:
I've found that mypy understands simple assert statements.
So if you:
if f is not None:
assert f is not None
os.write(f, ...)
You might be in good shape.
Why can't it simply under
On 22/08/2022 05:30, Chris Angelico wrote:
On Mon, 22 Aug 2022 at 10:04, Buck Evan wrote:
I've had much success doing round trips through the lxml.html parser.
https://lxml.de/lxmlhtml.html
I ditched bs for lxml long ago and never regretted it.
If you find that you have a bunch of invalid h
On 25/07/2022 02:47, Khairil Sitanggang wrote:
Regarding your comment : "
*However, usually object creation and initialization iscombined by allowing
arguments to the initializer:*" , so which one of the two classes Node1,
Node2 below is more common in practice? Option 2, I guess.
Thanks,
# opt
On 23/07/2022 06:28, Khairil Sitanggang wrote:
Hello Expert:
I just started using python. Below is a simple code. I was trying to check
if, say, NO1 is not in the NODELIST[:].NO
How can I achieve this purpose?
Regards,
-Irfan
class Node:
def __init__(self):
self.NO = 0
On 20/07/2022 11:37, Chris Angelico wrote:
On Wed, 20 Jul 2022 at 18:34, Frank Millman wrote:
Hi all
C:\Users\E7280>python
Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>
On 29/06/2022 23:17, Chris Angelico wrote:
On Thu, 30 Jun 2022 at 02:49, Johannes Bauer wrote:
But now consider what happens when we create the lambdas inside a list
comprehension (in my original I used a generator expresison, but the
result is the same). Can you guess what happens when we crea
On 12/06/2022 14:40, Ayesha Tassaduq wrote:
Hi i am trying to store a text file into MongoDB but i got the error .
"failing because no such method exists." % self.__name.split(".")[-1]
TypeError: 'Collection' object is not callable. If you meant to call the
'insert' method on a 'Collection' obje
On 09/06/2022 00:53, Richard David wrote:
Why am I not getting debug output on my windows 10 machine:
C:\temp>\Windows\py.exe -0
-V:3.11 *Python 3.11 (64-bit)
-V:3.10 Python 3.10 (64-bit)
C:\temp>set PYLAUNCH_DEBUG=1
C:\temp>\Windows\py.exe
Python 3.11.0b3 (main, Jun 1 20
On 09/06/2022 00:53, Richard David wrote:
Why am I not getting debug output on my windows 10 machine:
C:\temp>\Windows\py.exe -0
-V:3.11 *Python 3.11 (64-bit)
-V:3.10 Python 3.10 (64-bit)
C:\temp>set PYLAUNCH_DEBUG=1
C:\temp>\Windows\py.exe
Python 3.11.0b3 (main, Jun 1 20
On 07/06/2022 00:28, Israel Brewster wrote:
I have some large (>100GB) datasets loaded into memory in a two-dimensional (X
and Y) NumPy array backed XArray dataset. At one point I want to filter the data
using a boolean array created by performing a boolean operation on the dataset
that is, I
On 23/05/2022 22:54, Tola Oj wrote:
i just finished learning oop as a beginner and trying to practice with it
but i ran into this typeerror issue, help please.
Traceback (most recent call last):
File
"c:\Users\ojomo\OneDrive\Desktop\myexcel\oop_learn.py\myExperiment.py\mainMain.py",
line 36,
On 13/05/2022 18:37, bryangan41 wrote:
Is the following LBYL:foo = 123if foo < 200: do()If so, how to change to
EAFP?Thanks!Sent from Samsung tablet.
The distinction between look-before-you-leap and
easier-to-ask-forgiveness-than-permission is weaker than yo might expect.
When you write
f
On 20/04/2022 13:01, Sam Ezeh wrote:
I went back to the code recently and I remembered what the problem was.
I was using multiprocessing.Pool.pmap which takes a callable (the
lambda here) so I wasn't able to use comprehensions or starmap
Is there anything for situations like these?
Hm, I don'
On 27/03/2022 11:24, Manfred Lotz wrote:
Let's say I have a Python app and have used an undefined method somewhere. Let
us further assume I have not detected it thru my tests.
Is there a way to detect it before deploying the app? pylint doesn't notice it.
Minimal example:
#!/usr/bin/env pytho
On 02/03/2022 01:32, Rob Cliffe via Python-list wrote:
itertools.product returns an iterator (or iterable, I'm not sure of the
correct technical term).
There's a simple test:
iter(x) is x --> True # iterator
iter(x) is x --> False # iterable
So:
>>> from itertools import product
>>> p =
On 27/02/2022 17:28, Chris Angelico wrote:
On Mon, 28 Feb 2022 at 03:24, MRAB wrote:
On 2022-02-27 08:51, Barry Scott wrote:
On 22 Feb 2022, at 09:30, Chris Angelico wrote:
On Tue, 22 Feb 2022 at 20:24, Frank Millman mailto:fr...@chagford.com>> wrote:
Hi all
I think this should be a s
On 22/02/2022 10:44, Frank Millman wrote:
On 2022-02-22 11:30 AM, Chris Angelico wrote:
On Tue, 22 Feb 2022 at 20:24, Frank Millman wrote:
Hi all
I think this should be a simple one-liner, but I cannot figure it out.
I have a dictionary with a number of keys, where each value is a single
li
On 10/02/2022 09:20, Igor Basko wrote:
Hi everyone,
This is my first question here. Hope to get some clarification.
Basically this question is about multiple inheritance and the usage of
super().__init__ in parent
classes.
So I have two classes that inherit from the same base class.
For example
On 15/09/2021 15:39, Abdur-Rahmaan Janhangeer wrote:
Greetings,
If i have a file name flower.py and i add x = 1 in it.
When i run python -i flower.py i get a shell
If type x i get 1
x
1
The values are auto injected.
How do i start a shell by code with values already injected? Thanks
Kin
On 01/09/2021 13:48, Loris Bennett wrote:
"Dieter Maurer" writes:
Loris Bennett wrote at 2021-8-31 15:25 +0200:
I am having difficulty getting the my logging configuration passed on
to imported modules.
My initial structure was as follows:
$ tree blorp/
blorp/
|-- blorp
| |-- __in
On 01/09/2021 06:25, ABCCDE921 wrote:
I dont want to import numpy
argmax(list)
returns index of (left most) max element
>>> import operator
>>> second = operator.itemgetter(1)
>>> def argmax(values):
return max(enumerate(values), key=second)[0]
>>> argmax([1, 2, 3, 0])
2
argm
On 30/08/2021 06:17, dn via Python-list wrote:
OTOH the simulation of rolling n-number of dice, as would happen in the
real-world, would be broken by making the computer's algorithm more
efficient (rolling until the first non-equal value is 'found'). Does
that mean the realism of the model dies?
On 30/08/2021 15:50, Chris Angelico wrote:
def how_many_times():
return next((count, rolls) for count, rolls in
enumerate(iter(roll, None)) if len(Counter(rolls)) == 1)
That's certainly the most Counter-intuitive version so far;)
Do I get bonus points for it being a one-liner that doe
On 29/08/2021 20:44, joseph pareti wrote:
In the code attached below, the A-variant is from somebody else who knows
Python better than I. But I do not like to just use any code without having
a grasp, specifically the line in* bold*, so I wrote the B-variant which
gives the same results. The C-va
On 29/08/2021 12:13, dn via Python-list wrote:
On 29/08/2021 20.06, Peter Otten wrote:
...
OK, maybe a bit complicated... but does it pay off if you want to
generalize?
def roll_die(faces):
while True: yield random.randrange(1, 1 + faces)
def hmt(faces, dies):
for c, d in
On 28/08/2021 14:00, Hope Rouselle wrote:
def how_many_times():
x, y = 0, 1
c = 0
while x != y:
c = c + 1
x, y = roll()
return c, (x, y)
--8<---cut here---end--->8---
Why am I unhappy? I'm wish I could confine x, y to the while loop. T
On 26/08/2021 09:09, Abdur-Rahmaan Janhangeer wrote:
Cannot read one file in a zip file if the zip file contains multiple files.
This example does not work https://www.py4u.net/discuss/203494 as Pandas
shows a ValueError: Multiple files found in ZIP file. Only one file per ZIP.
If the Zip file
On 14/08/2021 00:33, John Griner wrote:
Hello, and thanks in advance,
I am trying to recode categorical variable to numeric. Despite using
lambda, If else, dummy-recoding, and so forth, what I get is from ONE
column that has 4 variables (City, Town, Suburb, Rural), I get FOUR columns:
On 13/08/2021 06:49, Ridit wrote:
So, whoever gets this, when I try to download packages using pip, it shows
errors saying "'pip' is not recognized as an internal or external command,
operable program or batch file." Is there a way to solve this? I tried
modifying, even repairing
On 29/07/2021 17:43, Dennis Lee Bieber wrote:
On Thu, 29 Jul 2021 15:45:26 +0200, Peter Otten <__pete...@web.de>
declaimed the following:
On 28/07/2021 18:40, Dennis Lee Bieber wrote:
On Wed, 28 Jul 2021 09:04:40 +0200, Peter Otten <__pete...@web.de>
declaimed the following:
Pe
On 28/07/2021 18:40, Dennis Lee Bieber wrote:
On Wed, 28 Jul 2021 09:04:40 +0200, Peter Otten <__pete...@web.de>
declaimed the following:
Perhaps it has something to do with the X-No-Archive flag set by Dennis?
According to my properties page in Agent, I've turned that of
On 28/07/2021 18:09, joseph pareti wrote:
The following code fails as shown in the title:
*import subprocesscmd = 'ls -l
/media/joepareti54/Elements/x/finance-2020/AI/Listen_attend_spell/VCTK-Corpus/wav48
| awk "{print $9 }"'process = subprocess.Popen([cmd],
As a quick fix try
process =
On 28/07/2021 07:32, Cameron Simpson wrote:
On 27Jul2021 19:24, Hongyi Zhao wrote:
On Wednesday, July 28, 2021 at 7:25:27 AM UTC+8, cameron...@gmail.com wrote:
Just to follow on a bit to Dennis:
But I can't any reply from Dennis in this issue.
Odd, because I replied to his reply to you :-)
On 18/07/2021 03:40, MRAB wrote:
On 2021-07-17 13:01, Chris Green wrote:
pypi.org is a wonderful resource but its size now demands a better
search engine.
There's always Google. I find that the search terms:
"google contacts" pypi
finds some results.
With a small modification
"goog
On 09/07/2021 17:29, Артем Комендантян wrote:
Hello!
There is a code https://pastebin.com/0NLsHuLa.
It has a multiline chain of method calling, when some method fails. In
python3.7 it fails in a row which corresponds to the failing method, in
python3.9 it corresponds to the very first line.
Ano
On 02/07/2021 11:44, Chris Angelico wrote:
I've just spent half an hour trying to figure out how to mess with the
Python REPL (specifically, how to implement a line-by-line interactive
interpreter within a larger app). It's rather hard to find it, but the
key module is "code".
https://docs.pytho
On 23/06/2021 19:42, Larry Martell wrote:
When an AWS cloudwatch event is passed to a consumer it looks like this:
{
"awslogs": {
"data": "ewogICAgIm1l..."
}
}
To get the actual message I do this:
def _decode(data):
compressed_payload = b64decode(data)
json_paylo
On 12/06/2021 04:02, Jach Feng wrote:
def foo():
... # do something
...
a = []
for i in range(3):
... a.append(foo())
...
a
[]
The most natural way to achieve something similar is to replace append()
with extend():
>>> def foo(): return ()
>>> a = []
>>> for i in range(3):
On 01/06/2021 23:32, Rich Shepard wrote:
On Tue, 1 Jun 2021, Ethan Furman wrote:
Well, you only had two logging statements in that code -- logging is like
print: if you want to see it, you have to call it:
Ethan,
Got it, thanks.
I believe
Do you have unit tests? Those are an excellent too
On 31/05/2021 17:57, Colin McPhail via Python-list wrote:
Hi,
According to the enum module's documentation an Enum-based enumeration's
members can have values of any type:
"Member values can be anything: int, str, etc.."
You didn't read the fineprint ;)
"""
The rules for what is all
On 29/05/2021 01:12, Cameron Simpson wrote:
On 28May2021 14:49, Rich Shepard wrote:
On Fri, 28 May 2021, Dennis Lee Bieber wrote:
It's apparently looking for some environment variable based upon the
code at
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjfpYm
On 26/05/2021 01:02, Cameron Simpson wrote:
On 25May2021 15:53, Dennis Lee Bieber wrote:
On Tue, 25 May 2021 19:21:39 +0200, hw declaimed the
following:
Oh ok, it seemed to be fine. Would it be the right way to do it with
sys.exit()? Having to import another library just to end a program
mi
On 25/05/2021 05:20, hw wrote:
We're talking about many different things. If it's simply "num = ..."
followed by "num = ...", then it's not a new variable or anything,
it's simply rebinding the same name. But when you do "int = ...", it's
shadowing the builtin name.
Why? And how is that "shad
On 23/05/2021 06:37, hw wrote:
Hi,
I'm starting to learn python and have made a little example program
following a tutorial[1] I'm attaching.
Running it, I'm getting:
Traceback (most recent call last):
File "[...]/hworld.py", line 18, in
print(isinstance(int, float))
TypeError: is
Usually an abstract class cannot be instantiated:
>>> from abc import ABCMeta, abstractmethod
>>> from fractions import Fraction
>>> class A(Fraction, metaclass=ABCMeta):
@abstractmethod
def frobnicate(self): pass
>>> A()
Traceback (most recent call last):
File "", lin
On 20/05/2021 06:00, Richard Damon wrote:
class GedcomHead(Gedcom0Tag):
"""GEDCOM 0 HEAD tag"""
def ___init___(self, *, parent):
An __init__ with three underscores; you must me joking ;)
--
https://mail.python.org/mailman/listinfo/python-list
On 05/05/2021 20:08, Jan van den Broek wrote:
On 2021-05-05, Peter Otten <__pete...@web.de> wrote:
On 05/05/2021 16:10, Ethan Furman wrote:
I see your messages twice (occasionally with other posters as well).?? I
have no idea how to fix it.?? :(
OK, I'll try another
On 05/05/2021 16:10, Ethan Furman wrote:
I see your messages twice (occasionally with other posters as well). I
have no idea how to fix it. :(
OK, I'll try another option from Thunderbird's context menu: Followup to
Newsgroup.
Does that appear once or twice?
In theory it should go to the
On 05/05/2021 13:03, Jan van den Broek wrote:
On 2021-05-05, Peter Otten <__pete...@web.de> wrote:
Perhaps there's something wrong on my side, but I'm
seeing this message twice:
Msg-ID: mailman.145.1620211376.3087.python-l...@python.org
Return-Path: __pete...@web.de
and
On 05/05/2021 05:55, Rasig Kosonmontri wrote:
Hi I wanted to unsubscribe from the python mailing list because I has been
sending me countless mails over the months but when I try to login on my
browser it doesn't recognize this email as a user even though the mails
that are coming it are to this
On 19/04/2021 11:52, Loris Bennett wrote:
Hi,
I have various small programs which tend to have an interface like the
following example:
usage: grocli [-h] [-o {check,add,delete}] [-u USERS [USERS ...]] [-g GROUP]
Command line grouper tool
optional arguments:
-h, --help
On 16/04/2021 19:11, Quentin Bock wrote:
is it possible to set the target language of a translation to be the input
from a user?
I have tried inputting specific abbreviations that would normally be
accepted as the target language but it remains in Icelandic and I would
like to change the target l
On 15/04/2021 20:20, Chris Angelico wrote:
On Fri, Apr 16, 2021 at 4:16 AM Jorge Conforte wrote:
I'm using xarray to read netcdf data and I had to time in my data the
values:
xarray.DataArray 'time' (time: 507)>
array(['1979-01-01T00:00:00.0', '1979-02-01T00:00:00.0',
On 12/04/2021 18:01, Andreas R Maier wrote:
Hi,
I have written some classes that represent immutable views on collections (see
"immutable-views" package on Pypi).
Currently, these view classes inherit from the abstract collection classes such as Mapping,
Sequence, Set. However, they implement
On 05/04/2021 06:25, Cameron Simpson wrote:
If you truly need to test msg() _without_ the file= parameter, you could
monkey patch module_2:
old_MSG_DESTINATION = module_2.MSG_DESTINATION
module_2.MSG_DESTINATION = sys.stderr
# now the module_2 module has an updated reference for
On 02/04/2021 12:38, Peter Otten wrote:
On 02/04/2021 11:16, Egon Frerich wrote:
I have a string like
'"ab,c" , def'
and need to separate it into
"ab,c" and "def".
split separates at the first ',':
bl
'"a,bc", def'
On 02/04/2021 11:16, Egon Frerich wrote:
I have a string like
'"ab,c" , def'
and need to separate it into
"ab,c" and "def".
split separates at the first ',':
bl
'"a,bc", def'
bl.split(',')
['"a', 'bc"', ' def']
The initial string looks like it's close enough to the CSV format.
Unfortu
On 25/03/2021 08:14, Loris Bennett wrote:
I'm not doing that, but I am trying to replace a longish bash pipeline
with Python code.
Within Emacs, often I use Org mode[1] to generate date via some bash
commands and then visualise the data via Python. Thus, in a single Org
file I run
/usr/bin
On 15/03/2021 09:47, Robert Latest via Python-list wrote:
Richard Damon wrote:
On 3/8/21 4:16 AM, Robert Latest via Python-list wrote:
Joseph L. Casale wrote:
I couldn't find any information on how to implement logging in a library
that doesn't know the name of the application that uses it. Ho
On 10/03/2021 13:19, S Monzur wrote:
I initially scraped the links using beautiful soup, and from those links
downloaded the specific content of the articles I was interested in
(titles, dates, names of contributor, main texts) and stored that
information in a list. I then saved the list to a tex
On 10/03/2021 04:35, S Monzur wrote:
Thanks! I ended up using beautiful soup to remove the html tags and create
three lists (titles of article, publications dates, main body) but am still
facing a problem where the list is not properly storing the main body.
There is something wrong with my code
On 09/03/2021 03:08, Bischoop wrote:
I try for a while place the top button in a a middle of column=0 with
span to column2 below so the button being centered to those,
I'm not sure what you mean, do you perhaps need columnspan=3?
tried with
canvas as well but with no success. Is someone wit
On 06/03/2021 12:43, Manfred Lotz wrote:
On Sat, 6 Mar 2021 12:00:33 +0100
Manfred Lotz wrote:
Let us say I have a package which reads a TOML file.
I want to give the user of my package the choice to decide if he wants
to use the toml, tomlkit or rtoml package.
So, in case the user chose to
On 01/03/2021 00:47, Alan Gauld via Python-list wrote:
On 28/02/2021 00:17, Cameron Simpson wrote:
BUT... It also has a __iter__ value, which like any Box iterates over
the subboxes. For MDAT that is implemented like this:
def __iter__(self):
yield from ()
Sorry, a bit OT but I
On 28/02/2021 23:33, Marco Sulla wrote:
On Sun, 28 Feb 2021 at 01:19, Cameron Simpson wrote:
My object represents an MDAT box in an MP4 file: it is the ludicrously
large data box containing the raw audiovideo data; for a TV episode it
is often about 2GB and a movie is often 4GB to 6GB.
[...]
Th
On 28/02/2021 01:17, Cameron Simpson wrote:
I just ran into a surprising (to me) issue with list() on an iterable
object.
My object represents an MDAT box in an MP4 file: it is the ludicrously
large data box containing the raw audiovideo data; for a TV episode it
is often about 2GB and a movie i
On 25/02/2021 01:42, Davor Levicki wrote:
i have two lists
list1 = ['01:15', 'abc', '01:15', 'def', '01:45', 'ghi' ]
list2 = ['01:15', 'abc', '01:15', 'uvz', '01:45', 'ghi' ]
and when I loop through the list
list_difference = []
for item in list1:
if item not in list2:
list_differen
On 24/02/2021 22:03, Dan Stromberg wrote:
On Wed, Feb 24, 2021 at 12:58 PM Peter Otten <__pete...@web.de> wrote:
On 24/02/2021 20:36, Carla Molina wrote:
This is not a bug. Have a look at the array's dtype:
>>> n = 60461826
>>> a = np.array([1, 50, 100, 150,
On 24/02/2021 20:36, Carla Molina wrote:
I found the following bug (python 3.9.1) when multiplying an array by
several variables without parentheses; look at the following example:
import numpy as np
NR = 0.25
N = 60461826
initialINCIDENCE = np.array([1, 50, 100, 150, 200, 250, 300])
initialIN
On 22/02/2021 06:57, gayatri funde wrote:
On Monday, February 22, 2021 at 11:15:27 AM UTC+5:30, Chris Angelico wrote:
On Mon, Feb 22, 2021 at 4:41 PM gayatri funde wrote:
On Monday, February 22, 2021 at 10:47:57 AM UTC+5:30, Dan Stromberg wrote:
On Sun, Feb 21, 2021 at 9:10 PM gayatri funde
On 14/02/2021 21:50, Chris Green wrote:
It isn't clear from the documentation. Does email.message.get() care
about the case of the header it's getting?
I checking mailing list mails and the "List-Id:" header is a bit
'mixed', i.e. it can be List-Id:, or List-ID: or list-id:, will
email.message.
On 09/02/2021 16:17, Antoon Pardon wrote:
Most of us know of the perils of mutable default values. So I came up
with the following proof of concept:
[...]
def copy_defaults(f):
Once you know you need that decorator you won't need it anymore ;)
@copy_defaults
def prepare(value, lst = []):
On 08/02/2021 22:33, Stefan Ritter wrote:
Hi,
It would be highly appreciated if you could offer me some advice to
solve a problem I'm currently facing:
I have a Windows 10 ADM64 desktop and a Windows 10 AMD64 Laptop.
I wrote some code to insert text in a .txt-file. It works perfectly on
my la
On 07/02/2021 16:12, Peter J. Holzer wrote:
On 2021-02-06 21:01:37 -0600, Skip Montanaro wrote:
The logging package can log exceptions and call stacks, but it does
(in my opinion) a suboptimal job of it. Consider this simple example:
import logging
FORMAT = '%(asctime)-15s %(levelname)s %(messa
On 27/01/2021 20:04, Zoran wrote:
In the same folder I have three files: main.py, app_logger.py and mymodule.py
with their contents:
# main.py
import argparse
import app_logger
import mymodule
import logging
logger = app_logger.get_logger(__name__)
def log_some_messages():
logger.debug(f
On 19/01/2021 10:42, Bischoop wrote:
On 2021-01-19, Peter Otten <__pete...@web.de> wrote:
On 19/01/2021 04:45, Bischoop wrote:
I sat to it again and solved it.
Congratulations!
lil = tuple(set(s)) # list of characters in s
li=[0,0,0,0,0,0] # list for counted repeats
I see a
On 19/01/2021 04:45, Bischoop wrote:
I sat to it again and solved it.
Congratulations!
> lil = tuple(set(s)) # list of characters in s
>
> li=[0,0,0,0,0,0] # list for counted repeats
I see a minor problem here. What happens if s contains more than len(li)
characters?
import timeit
Since
On 17/01/2021 02:15, Dan Stromberg wrote:
IMO a good set of tests is much more important than type annotations ;)
def get_longest(string: str) -> typing.Tuple[int, typing.List[str]]:
"""Get the longest run of a single consecutive character."""
May I ask why you artificially limit th
On 07/01/2021 08:42, Christian Gollwitzer wrote:
Am 07.01.21 um 08:29 schrieb Paulo da Silva:
Does anybody know why cmd method isn't called when I change the button
state (clicking on it) in this example?
I know that this seems a weird class use. But why doesn't it work?
Thanks.
class C:
On 06/01/2021 22:03, Grant Edwards wrote:
I'm completely baffled by that. Can somebody explain how this
expression is evaluated?
self.callbacks['file->new', underline: 0]
It appears that the dict callbacks is being accessed with the key of
a tuple comprising a string and a slice.
Huh?
Y
On 06/01/2021 22:03, Rich Shepard wrote:
On Thu, 7 Jan 2021, Chris Angelico wrote:
Are you sure that this works? It's syntactically valid, but I don't
think it means what you think it does.
ChrisA,
I'm always open to learning. There's no error generated ... yet the
application doesn' open so
On 31/12/2020 23:46, Bob van der Poel wrote:
When I run python from the command line and generate an error I get the
following:
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
z
/home/bob/.local/lib/pyth
Saurav Chirania wrote:
> I really like that python's sort method accepts a key function as a
> parameter which can be used to specify how elements should be compared.
>
> Similarly, we could have a "key" argument which specifies how elements
> should be counted. Let's say we have a list of a mill
Peter Otten wrote:
> If the list is huge you can also delete in reverse order:
>
> for i in reversed(len(_list)):
Make that reversed(range(len(_list))).
> if discard(_list[i]):
> del _list[i]
Example:
>>> items = ['a', 'b', '
Mats Wichmann wrote:
> On 9/7/20 5:01 PM, Driuma Nikita wrote:
>
>
> _list = list(range(50))
> for i, el in enumerate(_list):
> del _list[i]
> print(_list)
>
>
> Don't change the the list while you are iterating over it, it messes up
> the iteration. It's not "randomly
Steve wrote:
> I am not sure how to post the code for my file here, is copy/paste the
> best way?
Yes. Try to paste only the relevant parts, or, if possible, post a small
self-contained example that can be run by the reader without further
editing.
> Is there another? I understand that attachm
Peter Otten wrote:
> group_key = itemgetter(0, 3, 4)
>
>
> def sort_key(row, lookup={k: i for i, k in enumerate(sort_list)}):
> return lookup[row[6]]
>
>
> result = list(
> chain.from_iterable(
> sorted(group, key=sort_key)
> for
Larry Martell wrote:
> I have a list of tuples, and I want to group them by 3 items (0, 3, 4)
> and then within each group sort the data by a 4th item (6) using a
> sort order from another list. The list is always ordered by the 3
> grouping items.
>From your description I deduced
from itertools
1 - 100 of 5496 matches
Mail list logo