Re: A missing iterator on itertools module?

2024-04-03 Thread Antoon Pardon via Python-list
Op 28/03/2024 om 17:45 schreef ast via Python-list: Hello Suppose I have these 3 strings: s1 = "AZERTY" s2 = "QSDFGH" s3 = "WXCVBN" and I need an itertor who delivers A Q W Z S C E D C ... I didn't found anything in itertools to do the job. The documentation mentions a roundrobin

Re: Extract lines from file, add to new files

2024-01-15 Thread Antoon Pardon via Python-list
modified/extended BNF description of a superset of the intended language and used other means to further check whether the code in question was valid or not. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: mypy question

2024-01-12 Thread Antoon Pardon via Python-list
ouldn't be the following. queries:list[dict[str,str]|dict[str,list]|dict[str,dict[str, dict[str, Ant]]] My impression at this moment is that you are write something like: dict[str, str | int] as as shorthand for dict[str, str] | dict[str, int]. But those two are different types. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: making your own DirEntry.

2023-12-23 Thread Antoon Pardon via Python-list
Op 23/12/2023 om 12:34 schreef Barry Scott: On 23 Dec 2023, at 09:48, Antoon Pardon via Python-list wrote: Because I have functions with DirEntry parameters. I would duck-type a class I control to be my DirEnrry in this situation. Would also help you when debugging as you can tell

Re: making your own DirEntry.

2023-12-23 Thread Antoon Pardon via Python-list
Op 22/12/2023 om 21:39 schreef DL Neil via Python-list: Antoon, On 12/23/23 01:00, Antoon Pardon via Python-list wrote: I am writing a program that goes through file hierarchies and I am mostly using scandir for that which produces DirEntry instances. At times it would be usefull if I could

making your own DirEntry.

2023-12-22 Thread Antoon Pardon via Python-list
r, is_file, ... methods. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

return type same as class gives NameError.

2023-10-22 Thread Antoon Pardon via Python-list
I have the following small module: =-=-=-=-=-=-=-=-=-=-=-= 8< =-=-=-=-=-=-=-=-=-=-=-=-= from typing import NamedTuple, TypeAlias, Union from collections.abc import Sequence PNT: TypeAlias = tuple[float, float] class Pnt (NamedTuple): x: float y: float def __add__(self, other:

Re: Evaluation of variable as f-string

2023-01-25 Thread Antoon Pardon
Op 23/01/2023 om 17:24 schreef Johannes Bauer: Hi there, is there an easy way to evaluate a string stored in a variable as if it were an f-string at runtime? I.e., what I want is to be able to do this: x = { "y": "z" } print(f"-> {x['y']}") This prints "-> z", as expected. But consider: x

Re: How make your module substitute a python stdlib module.

2022-12-28 Thread Antoon Pardon
Op 27/12/2022 om 16:49 schreef Thomas Passin: On 12/27/2022 8:25 AM, Antoon Pardon wrote: Op 27/12/2022 om 13:46 schreef Chris Angelico: On Tue, 27 Dec 2022 at 23:28, Antoon Pardon  wrote: At the moment I am happy with a solution that once the programmer has imported from QYZlib.threaders

Re: How make your module substitute a python stdlib module.

2022-12-27 Thread Antoon Pardon
Op 27/12/2022 om 13:46 schreef Chris Angelico: On Tue, 27 Dec 2022 at 23:28, Antoon Pardon wrote: At the moment I am happy with a solution that once the programmer has imported from QYZlib.threaders that module will used as the threading module. Oh! If that's all you need, then yes

Re: How make your module substitute a python stdlib module.

2022-12-27 Thread Antoon Pardon
Op 27/12/2022 om 13:09 schreef Chris Angelico: On Tue, 27 Dec 2022 at 23:06, Antoon Pardon wrote: How do you intend to distinguish one from the other? How should the logging module know which threading module to use? That is my question! How can I get the logging module to use my module.I

Re: How make your module substitute a python stdlib module.

2022-12-27 Thread Antoon Pardon
Op 27/12/2022 om 12:28 schreef Chris Angelico: On Tue, 27 Dec 2022 at 22:13, Antoon Pardon wrote: Op 27/12/2022 om 11:37 schreef Chris Angelico: On Tue, 27 Dec 2022 at 21:29, Antoon Pardon wrote: OK, I am writing an alternative for the threading module. What I would like to know is how

Re: How make your module substitute a python stdlib module.

2022-12-27 Thread Antoon Pardon
Op 27/12/2022 om 11:37 schreef Chris Angelico: On Tue, 27 Dec 2022 at 21:29, Antoon Pardon wrote: OK, I am writing an alternative for the threading module. What I would like to know is how I can get some library modules call my alternative instead of the threading module. For instance

How make your module substitute a python stdlib module.

2022-12-27 Thread Antoon Pardon
the logging module to call the function from my module to get the current_thread, instead of it calling "current_thread" from the threading module. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: Does one have to use curses to read single characters from keyboard?

2022-12-11 Thread Antoon Pardon
t could possibly go wrong? Nothing that can't go wrong otherwise. It is my experience that when a [Return] is needed, people just type in a two key combination. They don't type one key, then check, then type [Return]. So in practice the same things go wrong, either way. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Optional arguments in a class behave like class attributes.

2022-10-17 Thread Antoon Pardon
You can use the following decorator for what you probably want. def copy_defaults(func): """ This decorator makes that defaults values are copied on a call. """ signature = inspect.signature(func) parameter_items = list(signature.parameters.items()) @wraps(func) def

Re: for -- else: what was the motivation?

2022-10-16 Thread Antoon Pardon
made it clear you wanted a fight. I choose not to enter that fight. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: for -- else: what was the motivation?

2022-10-16 Thread Antoon Pardon
Op 16/10/2022 om 19:01 schreef Peter J. Holzer: On 2022-10-16 12:17:39 +0200, Antoon Pardon wrote: Op 16/10/2022 om 00:50 schreefavi.e.gr...@gmail.com: That might not easily solve this problem. But I wonder if reserving some kind of prefix might help, so anything like extension.0nNoBreak

Re: for -- else: what was the motivation?

2022-10-16 Thread Antoon Pardon
to and from a long list of reserved key words that may vary by locale? I think you are carrying my idea further than I intended. I was just thinking that instead of using U+0064 U+0065 U+0066 [beinf def] we could be using U+1D41D U+1D41E U+1D41F [being  퐝퐞퐟]. -- Antoon Pardon. -- https

Re: for -- else: what was the motivation?

2022-10-16 Thread Antoon Pardon
Op 16/10/2022 om 19:03 schreef Chris Angelico: On Mon, 17 Oct 2022 at 03:57, Antoon Pardon wrote: Op 16/10/2022 om 17:05 schreef Chris Angelico: On Sun, 16 Oct 2022 at 22:47, Antoon Pardon wrote: Why would I need good luck? I expressed an idea and you didn't like it. That won't affect

Re: for -- else: what was the motivation?

2022-10-16 Thread Antoon Pardon
Op 16/10/2022 om 17:05 schreef Chris Angelico: On Sun, 16 Oct 2022 at 22:47, Antoon Pardon wrote: Why would I need good luck? I expressed an idea and you didn't like it. That won't affect my life in a meaningful way. Well, with that attitude, it's not going to affect anyone else's life

Re: for -- else: what was the motivation?

2022-10-16 Thread Antoon Pardon
Op 16/10/2022 om 13:03 schreef Chris Angelico: On Sun, 16 Oct 2022 at 21:19, Antoon Pardon wrote: My idea would be to reserve different unicode blocks for the keywords and the identifiers. e.g. We could reserve the mathematical alphanumeric block for keywords and all other letters

Re: for -- else: what was the motivation?

2022-10-16 Thread Antoon Pardon
a strugle searching for a keyword that will break as little programs as possible. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Find the path of a shell command

2022-10-12 Thread Antoon Pardon
d directly in a cron script but not via a python script, you may need to export the PATH in your cron script. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: flattening lists

2022-10-12 Thread Antoon Pardon
,7],[8,9]] >>> list(itertools.chain.from_iterable(lst)) [1, 2, 3, 4, 5, 6, 7, 8, 9] -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: for -- else: what was the motivation?

2022-10-11 Thread Antoon Pardon
in python with the same kind of syntax: https://code.activestate.com/recipes/580625-collection-pipeline-in-python/ I have my own python3 module with stuff like that and I find it very usefull. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-11 Thread Antoon Pardon
Op 10/10/2022 om 19:08 schreef Robert Latest via Python-list: Antoon Pardon wrote: I would like a tool that tries to find as many syntax errors as possible in a python file. I'm puzzled as to when such a tool would be needed. How many syntax errors can you realistically put into a single

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Antoon Pardon
Op 10/10/2022 om 00:45 schreef Cameron Simpson: On 09Oct2022 21:46, Antoon Pardon wrote: Is it that onerous to fix one thing and run it again? It was once when you handed in punch cards and waited a day or on very busy machines. Yes I find it onerous, especially since I have a pipeline

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
of such a tool doesn't need to go through all the provided information. If after correcting a few errors, the users find the rest of the information gives him a headache, he can just ignore all that and just run a new iteration. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
Op 9/10/2022 om 21:18 schreef Avi Gross: Antoon, it may also relate to an interpreter versus compiler issue. Something like a compiler for C does not do anything except write code in an assembly language. It can choose to keep going after an error and start looking some more from a less

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
Op 9/10/2022 om 21:18 schreef Avi Gross: Antoon, it may also relate to an interpreter versus compiler issue. Something like a compiler for C does not do anything except write code in an assembly language. It can choose to keep going after an error and start looking some more from a less

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
Op 9/10/2022 om 19:23 schreef Karsten Hilbert: Am Sun, Oct 09, 2022 at 06:59:36PM +0200 schrieb Antoon Pardon: Op 9/10/2022 om 17:49 schreef Avi Gross: My guess is that finding 100 errors might turn out to be misleading. If you fix just the first, many others would go away. At this moment

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
Op 9/10/2022 om 17:49 schreef Avi Gross: My guess is that finding 100 errors might turn out to be misleading. If you fix just the first, many others would go away. At this moment I would prefer a tool that reported 100 errors, which would allow me to easily correct 10 real errors, over the

What to use for finding as many syntax errors as possible.

2022-10-09 Thread Antoon Pardon
. I just want a tool for syntax errors. No style enforcements. Any recommandations? -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make a variable's late binding crosses the module boundary?

2022-08-31 Thread Antoon Pardon
Op 31/08/2022 om 09:53 schreef dn: On 31/08/2022 19.38, Antoon Pardon wrote: Op 30/08/2022 om 23:52 schreef dn: The conversation seems to be wandering some way from the OP. Whereas both of these answers are clever (and I assume work), the question becomes: why would you want to do

Re: How to make a variable's late binding crosses the module boundary?

2022-08-31 Thread Antoon Pardon
the module that did the import will not notice the change in the original module. focussing on the code smell, is leading the attention away from the problem. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: Exclude 'None' from list comprehension of dicts

2022-08-16 Thread Antoon Pardon
Op 16/08/2022 om 00:20 schreef dn: On 16/08/2022 00.56, Antoon Pardon wrote: Op 5/08/2022 om 07:50 schreef Loris Bennett: Antoon Pardon   writes: Op 4/08/2022 om 13:51 schreef Loris Bennett: Hi, I am constructing a list of dictionaries via the following list comprehension:     data

Re: Exclude 'None' from list comprehension of dicts

2022-08-15 Thread Antoon Pardon
Op 5/08/2022 om 07:50 schreef Loris Bennett: Antoon Pardon writes: Op 4/08/2022 om 13:51 schreef Loris Bennett: Hi, I am constructing a list of dictionaries via the following list comprehension: data = [get_job_efficiency_dict(job_id) for job_id in job_ids] However

Re: Exclude 'None' from list comprehension of dicts

2022-08-04 Thread Antoon Pardon
? In that case your list will be all dictionaries and empty ones will be processed fast enough. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: My first attempt at a package.

2022-07-26 Thread Antoon Pardon
Op 25/07/2022 om 16:43 schreef Dennis Lee Bieber: On Mon, 25 Jul 2022 10:39:46 +0200, Antoon Pardon declaimed the following: Yes it is, but it doesn't answer my question: How do I create a package in which a file is built at install time. I just want to build a configuration file

Re: My first attempt at a package.

2022-07-25 Thread Antoon Pardon
Op 19/07/2022 om 16:57 schreef David Lowry-Duda: On Tue, Jul 19, 2022 at 03:58:41PM +0200, Antoon Pardon wrote: I am writing a python package which has the following structure PACKAGE    * module1.py    * module2.py    * data.cfg However the data.cfg should be build at installation time

My first attempt at a package.

2022-07-19 Thread Antoon Pardon
should be build with the following linix command: $ date '+installed on %Y:%M:%d at %T' > data.cfg -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating lambdas inside generator expression

2022-06-29 Thread Antoon Pardon
Or you could try this as an alternative: conds = [ (lambda code: lambda msg: msg.hascode(code))(z) for z in ("foo", "bar") ] Op 29/06/2022 om 12:43 schreef Johannes Bauer: Aha! conds = [ lambda msg, z = z: msg.hascode(z) for z in ("foo", "bar") ] Is what I was looking for to explicitly

Re: min, max with position

2022-06-05 Thread Antoon Pardon
and the visually-challenged!) ell = l one = 1 min(enumerate(ell), key=lambda x: x[one]) I'd like to point to the operator module which allows you to write the above as: min(enumerate(ell), key=operator.itemgetter(one)) -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: tail

2022-04-24 Thread Antoon Pardon
to text 2) Split into lines 3) Iterate backwards over the lines Tada! Done. And in Python, quite easy. The downside, of course, is that you have to store the entire file in memory. Why not just do: tail = collections.deque(text_stream, maxlen = nr_of_lines) tail.reverse() ... -- Antoon Pardon

Re: Tuple unpacking inside lambda expressions

2022-04-19 Thread Antoon Pardon
Op 16/04/2022 om 23:36 schreef Sam Ezeh: Two questions here. Firstly, does anybody know of existing discussions (e.g. on here or on python-ideas) relating to unpacking inside lambda expressions? I found myself wanting to write the following. ``` map( lambda (module, data):

Re: Comparing sequences with range objects

2022-04-12 Thread Antoon Pardon
Op 11/04/2022 om 02:31 schreef Dan Stromberg: It sounds a little like you're looking for interval arithmetic. Maybe https://pypi.org/project/python-intervals/1.5.3/ ? Not completely but it suggested an idea to explore. -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Comparing sequences with range objects

2022-04-12 Thread Antoon Pardon
Op 11/04/2022 om 02:01 schreef duncan smith: On 10/04/2022 21:20, Antoon Pardon wrote: Op 9/04/2022 om 02:01 schreef duncan smith: On 08/04/2022 22:08, Antoon Pardon wrote: Well my first thought is that a bitset makes it less obvious to calulate the size of the set or to iterate over

Re: Comparing sequences with range objects

2022-04-10 Thread Antoon Pardon
Op 9/04/2022 om 02:01 schreef duncan smith: On 08/04/2022 22:08, Antoon Pardon wrote: Well my first thought is that a bitset makes it less obvious to calulate the size of the set or to iterate over its elements. But it is an idea worth exploring. def popcount(n):     ""&qu

Re: Comparing sequences with range objects

2022-04-08 Thread Antoon Pardon
Op 8/04/2022 om 16:28 schreef duncan smith: On 08/04/2022 08:21, Antoon Pardon wrote: Yes I know all that. That is why I keep a bucket of possible duplicates per "identifying" field that is examined and use some heuristics at the end of all the comparing instead of starting t

Re: Comparing sequences with range objects

2022-04-08 Thread Antoon Pardon
Op 8/04/2022 om 08:24 schreef Peter J. Holzer: On 2022-04-07 17:16:41 +0200, Antoon Pardon wrote: Op 7/04/2022 om 16:08 schreef Joel Goldstick: On Thu, Apr 7, 2022 at 7:19 AM Antoon Pardon wrote: I am working with a list of data from which I have to weed out duplicates. At the moment I

Re: Comparing sequences with range objects

2022-04-07 Thread Antoon Pardon
Op 7/04/2022 om 16:08 schreef Joel Goldstick: On Thu, Apr 7, 2022 at 7:19 AM Antoon Pardon wrote: I am working with a list of data from which I have to weed out duplicates. At the moment I keep for each entry a container with the other entries that are still possible duplicates. The problem

Comparing sequences with range objects

2022-04-07 Thread Antoon Pardon
. So what would be a relatively easy way to get the same result without wasting too much memory on entries that haven't any weeding done on them. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Reducing "yield from" overhead in recursive generators

2022-03-18 Thread Antoon Pardon
functions. Maybe if you contact them they can be interested in making a similar decorating macro for use with such recursive decorators. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Behavior of the for-else construct

2022-03-07 Thread Antoon Pardon
Op 4/03/2022 om 02:08 schreef Avi Gross via Python-list: If Python was being designed TODAY, I wonder if a larger set of key words would be marked as RESERVED for future expansion including ORELSE and even NEVERTHELESS. I think a better solution would be to have reserved words written

Re: All permutations from 2 lists

2022-03-02 Thread Antoon Pardon
Op 2/03/2022 om 15:58 schreef Larry Martell: On Wed, Mar 2, 2022 at 9:37 AM Antoon Pardon wrote: If one list is empty I want just the other list. What I am doing is building a list to pass to a mongodb query. If region is empty then I want to query for just the items in the os list. I

Re: All permutations from 2 lists

2022-03-02 Thread Antoon Pardon
Op 2/03/2022 om 15:29 schreef Larry Martell: On Wed, Mar 2, 2022 at 9:10 AM Antoon Pardon wrote: Op 2/03/2022 om 14:44 schreef Larry Martell: On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: Op 2/03/2022 om 14:27 schreef Larry Martell: On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwz

Re: All permutations from 2 lists

2022-03-02 Thread Antoon Pardon
Op 2/03/2022 om 14:44 schreef Larry Martell: On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: Op 2/03/2022 om 14:27 schreef Larry Martell: On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwzuui...@potatochowder.com> wrote: On 2022-03-01 at 19:12:10 -0500, Larry Martell wrote: If I

Re: All permutations from 2 lists

2022-03-02 Thread Antoon Pardon
t seems to be an empty list, which IMO is a perfectly valid result. All possible permutations over two collections where one collection is empty, should IMO give you an empty collection. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to check if there is internet?

2022-02-22 Thread Antoon Pardon
Op 22/02/2022 om 09:40 schreef Chris Angelico: On Tue, 22 Feb 2022 at 19:33, Abdur-Rahmaan Janhangeer wrote: As discussed here but, it would have been nevertheless great to have this tiny function instead of nothing Here's a function that determines whether or not you have an internet

Re: Why There Is No Python Compressed Archive or Binaries ?

2022-01-17 Thread Antoon Pardon
You could try miniconda. Op 17/01/2022 om 20:53 schreef Sina Mobasheri: Consider scenario that I want run python 3.10 in CentOS 8, I think last python version in CentOS repository is 3.6, if I use epel I can get 3.8 so ..., I think (correct me if I'm wrong ) the only way that I can run

Re: Why operations between dict views return a set and not a frozenset?

2022-01-05 Thread Antoon Pardon
() - a.keys() {3} Why not frozenset({3})? My 2 cents worths: Because dictviews mutate with the directory. That makes them more like set than like frozenset. So operations on them produce a set. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: A problem with itertools.groupby

2021-12-17 Thread Antoon Pardon
e original iterator with an extra termination condition. So in order to start the next group-iterator the previous group-iterator is exhausted, because the original iterator has to be ready to produce values for the next group-iterator. -- Antoon Pardon. -- https://mail.python.org/mailman/listi

Re: Negative subscripts

2021-11-26 Thread Antoon Pardon
ing a reverse_view function, that takes a list as argument and produces something that behaves as the reversed list without actually reversing the list and then as in the first option use the [y:] slice on that. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-29 Thread Antoon Pardon
Did I get that right? -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-29 Thread Antoon Pardon
are not as issue. I then explain you misunderdood en now you come with the above. Maybe you should be more aware of the history of a thread before coming with this kind of statements. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-28 Thread Antoon Pardon
e test which you use to control this loop. Should I think it worth the trouble to rewrite your example, quod non, it would be like below, with that unneeded list. while [ play_game(), input("Play again? ") in ['y', 'Y', 'yes', 'Yes']][-1]: pass -- Antoon Pardon. -- h

Re: New assignmens ...

2021-10-28 Thread Antoon Pardon
Op 27/10/2021 om 20:20 schreef Avi Gross: I think anyone who suggests we should separate costs from benefits belongs securely within the academic world and should remain there. Practical things need to be built considering costs. Theoretical things, sure, cost is not an issue. Seperating

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 18:16 schreef Christman, Roger Graydon: On 27/10/2021 at 12:45 Antoon Pardon wrote: However with the introduction of the walrus operator there is a way to simulate a significant number of one and a half loops. Consider the following: >do > a =

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
a whole let useful. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 10:49 schreef Chris Angelico: On Wed, Oct 27, 2021 at 7:46 PM Antoon Pardon wrote: So if you want this added, show a use-case that makes it look way better than the alternatives (including a generator, a mid-loop break, etc). Way better according to which criteria? IMO

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
should combine those two work variables into some kind of instance no matter how contrived. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 10:05 schreef Chris Angelico: On Wed, Oct 27, 2021 at 6:00 PM Antoon Pardon wrote: Op 26/10/2021 om 00:24 schreef Chris Angelico: TBH, I don't think there's a lot of value in multiple-assignment, since it has a number of annoying conflicts of syntax and few viable use

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 10:05 schreef Chris Angelico: On Wed, Oct 27, 2021 at 6:00 PM Antoon Pardon wrote: Op 26/10/2021 om 00:24 schreef Chris Angelico: TBH, I don't think there's a lot of value in multiple-assignment, since it has a number of annoying conflicts of syntax and few viable use

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Is that one use case or is that a use case for each kind of couple? And even if the benefits are little per case, they can add up with every occasion such a case pops up. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
an assignment. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 25/10/2021 om 18:47 schreef Christman, Roger Graydon: Message: 8 Date: Mon, 25 Oct 2021 11:20:52 +0200 From: Antoon Pardon To: python-list@python.org Subject: Re: New assignmens ... Message-ID: <5761dd65-4e87-8b8c-1400-edb821204...@vub.be> Content-Type: text/plain; charset=utf-8;

Re: New assignmens ...

2021-10-26 Thread Antoon Pardon
Op 25/10/2021 om 23:03 schreef Chris Angelico: > On Tue, Oct 26, 2021 at 7:18 AM Antoon Pardon wrote: >> Op 25/10/2021 om 20:39 schreef Chris Angelico: >>> On Tue, Oct 26, 2021 at 5:35 AM Antoon Pardon wrote: >>>> By putting limits on the walrus code, you ar

Re: New assignmens ...

2021-10-25 Thread Antoon Pardon
Op 25/10/2021 om 20:39 schreef Chris Angelico: > On Tue, Oct 26, 2021 at 5:35 AM Antoon Pardon wrote: >> By putting limits on the walrus code, you are not reducing complexity, you >> are increasing it. >> You are increasing complexity because you can't just reuse the

Re: New assignmens ...

2021-10-25 Thread Antoon Pardon
tting limits on the walrus code, you are not reducing complexity, you are increasing it. You are increasing complexity because you can't just reuse the code that handles an ordinary assignment. You now need specific code to limit it's use. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: New assignmens ...

2021-10-25 Thread Antoon Pardon
the second code over the first. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

importing a module from a file without the '.py' suffix

2021-10-22 Thread Antoon Pardon
I have a file with python code but the name doesn't end with the '.py' suffix. What is the easiest way to import this code as a module without changing its name? -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Mailing list activity low

2021-10-12 Thread Antoon Pardon
Have I missed something and has the maillinglist been moved. Activity is very low here, about one message every five days. Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

f-strings and internationalisation.

2021-05-24 Thread Antoon Pardon
languages. Can that be done with f-strings? -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: name for a mutually inclusive relationship

2021-02-26 Thread Antoon Pardon
Op 24/02/21 om 17:12 schreef Ethan Furman: I'm looking for a name for a group of options that, when one is specified, all of them must be specified. It seems you are looking at an equivalence. -- https://mail.python.org/mailman/listinfo/python-list

python 2.6: Need some advise for installing modules on a legacy system

2021-02-24 Thread Antoon Pardon
I need to do some development on this legacy system. It only runs python2.6 and there is little hope of installing an other version. How can I best proceed to install modules for working with mysql and ldap? -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list

Mutable defaults

2021-02-09 Thread Antoon Pardon
Most of us know of the perils of mutable default values. So I came up with the following proof of concept: from inspect import signature as signature_of, Parameter from itertools import zip_longest from copy import copy def copy_defaults(f): signature = signature_of(f) def

Re: Best practice for handling exceptions raised at lower levels?

2021-02-02 Thread Antoon Pardon
Op 2/02/21 om 01:54 schreef Skip Montanaro: Here's the crux of the problem. Where does responsibility generally fall for low level exception handling? I don't mean to pick on IMAPClient. It's just a recent example and got me thinking about the problem. Is it (generally) the responsibility of the

Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-27 Thread Antoon Pardon
Op 27/01/21 om 05:17 schreef Dan Stromberg: On Tue, Jan 26, 2021 at 8:13 PM Dan Stromberg wrote: On Tue, Jan 26, 2021 at 4:01 PM C W wrote: Hello everyone, I'm a long time Matlab and R user working on data science. How do you troubleshooting/debugging in Python? I frequently read

Re: Simple question - end a raw string with a single backslash ?

2020-10-19 Thread Antoon Pardon
nd not change how the ' is treated. What python does here is a combination of both. The \ appears and it changes how the ' is treated. That is IMO broken. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Faking stdlib

2020-10-01 Thread Antoon Pardon
chain -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list

Re: How to install your personal module/package on site.

2020-08-21 Thread Antoon Pardon
pip. Note that the above example pulls a particular tagged release via the "@5.0.3" suffix. That is a nice feature. I will have a closer look at this. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-15 Thread Antoon Pardon
Op 15/08/20 om 15:02 schreef Chris Angelico: > On Sat, Aug 15, 2020 at 10:45 PM Antoon Pardon > wrote: >> >> >> I don't understand this argument. The trace back information that is >> destroyed with this optimization, is information that isn't available &

Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2020-08-15 Thread Antoon Pardon
at is at heart a state machine would be a lot more easy if python would have TCO. Then each state could be implemented by a function and transitioning from one state to the next would be just calling the next function. Sure you can resolve this by writing your state function trampoline styl

Re: How to install your personal module/package on site.

2020-08-15 Thread Antoon Pardon
Op 15/08/20 om 07:33 schreef dn via Python-list: > On 14/08/2020 22:32, Antoon Pardon wrote: >> Well the question is in the subject. >> >> I have a number of modules/packages which were until recently >> personal use only. However python is getting more popular >

How to install your personal module/package on site.

2020-08-14 Thread Antoon Pardon
Well the question is in the subject. I have a number of modules/packages which were until recently personal use only. However python is getting more popular at work and some of my work was considered useful enough to install in a public available spot. How should I approach this? -- Antoon. --

How to turn a defaultdict into a normal dict.

2020-06-10 Thread Antoon Pardon
that is not present, should raise KeyError. Is that somehow possible? -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Multithread and locking issue

2020-05-15 Thread Antoon Pardon
Op 15/05/20 om 00:36 schreef Stephane Tougard: Hello, A multithreaded software written in Python is connected with a Postgres database. To avoid concurrent access issue with the database, it starts a thread who receive all SQL request via queue.put and queue.get (it makes only insert, so

Re: Function to avoid a global variable

2020-04-28 Thread Antoon Pardon
depth += inc return parseStack parseStack = make_parseStack() -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to inheret a metaclass.

2020-04-10 Thread Antoon Pardon
Op 9/04/20 om 18:37 schreef Peter Otten: Antoon Pardon wrote: I am experimenting with subclasses that all need the same metaclass as the base class. Is there a way to make the metaclass be inherited, so that you don't have to repeat the "metaclass = MetaClass" with ever

  1   2   3   4   5   6   7   8   9   10   >