Re: A random word from one of two lists

2021-01-03 Thread Richard Damon
't really need to do this as a two-level selection: > > import random > animal = ['koala', 'kangaroo'] > fruit = ['banana', 'apple'] > result = random.choice(animal + fruit) > print(result) It depends on what distribution of

Re: dayofyear is not great when going into a new year

2021-01-05 Thread Richard Damon
out on Dec 30, 2019, which was the first day of the ISO week bsed 2020, and he ended it with a comment that if 2019 wasn't going so well, you could always just use ISO to get an early start on 2020. Apparently a lot of people were getting this recommended a number of months later, and people were commenting how that line just was not aging well. And we couldn't use that te get out of 2020, as 2020 is a long year, and ISO 2021 didn't start until Jan 4th. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: tkinter: creating/attaching menubar to top level window

2021-01-08 Thread Richard Damon
'menu'] = menubar # attach it to the top level window > ^ > yet that's the syntax he prints on page 84 (and has in the book's code > supplement). > > Why am I getting an invalid syntax error here? > > TIA, > > Rich Because it is the wrong syn

Re: learning python building 2nd app, need advices

2021-01-08 Thread Richard Damon
On 1/8/21 6:10 PM, pascal z via Python-list wrote: > any way to attach a file because I loose indentation? Don't post via googlegroups, it thinks the world is HTML, which treats spaces in a funny matter. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Why Python 3?

2014-04-20 Thread Richard Damon
On 4/20/14, 5:40 PM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Mon, Apr 21, 2014 at 2:22 AM, Ian Kelly wrote: >>> When I'm writing a generic average function, I probably don't know whether >>> it will ever be used to average complex numbers. >> >> This keeps coming up in t

Re: cx_freeze and temporary files - security related question

2014-07-06 Thread Richard Damon
On 5/21/14, 12:42 PM, Nagy László Zsolt wrote: I need to create an application for Windows 7 that runs from a flash drive. This program would be used to create remote backups of the pendrive. The pendrive contains sensitive data, so when I plug in the pendrive and run the program to make a backup

Re: cx_freeze and temporary files - security related question

2014-07-06 Thread Richard Damon
like you probably do all the backups. Then you can know that there aren't any traces left behind that you didn't think of. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiple inheritance and a broken super() chain

2023-07-03 Thread Richard Damon via Python-list
ght. But *Right.__init__()* is called twice. What's going on here? Thanks, Peter Because the MRO from Bottom is [Bottom, Left, Right, Top] so super() in Left is Right. It doesn't go to Top as the MRO knows that Right should go to Top, so Left needs to go to Right to init everything,

Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-17 Thread Richard Damon via Python-list
> On Aug 17, 2023, at 10:02 AM, c.buhtz--- via Python-list > wrote: > > X-Post: https://stackoverflow.com/q/76913082/4865723 > > 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 pyt

Re: type annotation vs working code

2023-10-01 Thread Richard Damon via Python-list
g (set to True when you initialize), and look it up with getattr() with a default value of False. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: Context without manager

2023-11-27 Thread Richard Damon via Python-list
Read the Fine context manager documentation. What “with with_expression as var” does is effectively: ob = with_expression var = ob.__enter__() And then at the end of the with, does a ob.__exit__() (With some parameters to __exit__, that could just be None, None, None for the simplest case). N

Context without manager

2023-11-27 Thread Richard Damon via Python-list
Read the Fine context manager documentation. What “with with_expression as var” does is effectively: ob = with_expression var = ob.__enter__() And then at the end of the with, does a ob.__exit__() (With some parameters to __exit__, that could just be None, None, None for the simplest case). N

Re: How/where to store calibration values - written by program A, read by program B

2023-12-28 Thread Richard Damon via Python-list
On 12/28/2023 12:20 AM EST rbowman via Python-list <[1]python-list@python.org> wrote: On Wed, 27 Dec 2023 03:53:42 -0600, Greg Walters wrote: The biggest caveat is that the shared variable MUST exist before it can be examined or used (not surprising).

Re: Python misbehavior

2024-02-08 Thread Richard Damon via Python-list
If you look up the documentation for youtube-dlp, you may find that you can use that module directly, and not need the ClipGrab wrapper at all (though it may provide some benefits if you can get it working again). -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: UTF_16 question

2024-04-29 Thread Richard Damon via Python-list
> On Apr 29, 2024, at 12:23 PM, jak via Python-list > wrote: > > Hi everyone, > one thing that I do not understand is happening to me: I have some text > files with different characteristics, among these there are that they > have an UTF_32_le coding, utf_32be, utf_16_le, utf_16_be all of them

Re: Best use of "open" context manager

2024-07-06 Thread Richard Damon via Python-list
ld modify the last attempt to open the file twice, which would work, but seems like a kludge (subject to race condition, inefficient). Is there a better / more Pythonic solution? Best wishes Rob Cliffe -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list

Re: backslash in triple quoted string

2025-05-11 Thread Richard Damon via Python-list
On 05/11/2025 6:36 AM EDT Left Right via Python-list <[1]python-list@python.org> wrote: Then it just means that the grammar lies. The two claims are mutually exclusive, so either one is a lie or the other or both. No, it more points out that not all errors are grammat

<    1   2   3   4