Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-08 Thread Roel Schroeven
Νικόλαος Κούρας schreef: Session settings afaik is for putty to remember hosts to connect to, not terminal options. I might be worng though. No matter how many times i change its options next time i run it always defaults back. Putty can most definitely remember its settings: - Start PuTTY; you

Re: Split a list into two parts based on a filter?

2013-06-10 Thread Roel Schroeven
Roy Smith schreef: I have a list, songs, which I want to divide into two groups. Essentially, I want: new_songs = [s for s in songs if s.is_new()] old_songs = [s for s in songs if not s.is_new()] but I don't want to make two passes over the list. I could do: new_songs = [] old_songs = [] for

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Roel Schroeven
Peter Otten schreef: Fábio Santos wrote: On 10 Jun 2013 23:54, "Roel Schroeven" wrote: You could do something like: new_songs, old_songs = [], [] [(new_songs if s.is_new() else old_songs).append(s) for s in songs] But I'm not sure that that's any better than the long

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-20 Thread Roel Schroeven
Νίκος schreef: Στις 18/6/2013 12:05 μμ, ο/η Steven D'Aprano έγραψε: Names are *always* linked to objects, not to other names. a = [] b = a # Now a and b refer to the same list a = {} # Now a refers to a dict, and b refers to the same list as before I see, thank you Steven. But since this is

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-28 Thread Roel Schroeven
Temia Eszteri schreef: Actually, I believe someone in an earlier thread in the newsgroup or elsewhere pointed out that serial ports automatically open under Windows. I'd have to look it back up when I have the time, which I don't have at the moment, unfortunately. That doesn't have anything to

Re: Slow output

2012-06-28 Thread Roel Schroeven
subhabangal...@gmail.com schreef: Dear Group, I am Sri Subhabrata Banerjee writing from India. I am running a small program which exploits around 12 1 to 2 KB .txt files. I am using MS Windows XP Service Pack 3 and Python 2.6 where IDLE is GUI. The text is plain ASCII text. The RAM of the machine

Re: Basic JSON question: Do I really need the quotes

2012-10-12 Thread Roel Schroeven
moo...@yahoo.co.uk schreef: Hi, I need to define some configuration in a file that will be manually created. Internally, the data will be stored as a dict, which contains various properties related to a design e.g. Design Name, dependencies, lists of files (and associated libraries). json seemed

Re: readline trick needed

2012-10-13 Thread Roel Schroeven
Etienne Robillard schreef: On Sun, 14 Oct 2012 00:47:52 +1100 Chris Angelico wrote: Excuse me? I'm not overly familiar with readline, so perhaps there is a really obvious way to do what Steven's trying to do, but this post does not appear to be the result of a lack of thinking. If it really

Re: Aggressive language on python-list

2012-10-13 Thread Roel Schroeven
Zero Piraeus schreef: : Not sure exactly how to put this ... I'm a mostly passive subscriber to this list - my posts here over the years could probably be counted without having to take my socks off - so perhaps I have no right to comment, but I've noticed a marked increase in aggressive langua

Re: Feedback on my python framework I'm building.

2012-10-15 Thread Roel Schroeven
MRAB schreef: On 2012-10-14 23:38, Dave Angel wrote: On 10/14/2012 08:48 AM, Roy Smith wrote: In article <507a3365$0$6574$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: Remember using PEEK and POKE commands with BASIC back in 1978? Pretty much impossible in Python. But, trivia

Re: Problem with time.time() standing still

2012-05-10 Thread Roel Schroeven
Hi Bob, This reminds of a problem we had at work some years ago. I've followed the thread from the beginning, but I hadn't a clue about what could possibly cause the problem until you said: Bob Cowdery schreef: Hopefully somebody can add the last piece of this puzzle. My code didn't work becaus

Re: Addition problems

2011-04-01 Thread Roel Schroeven
quot; uses the value of q. In the version with commented lines, that value is never changed, while it is changed each iteration in the version with the lines uncommented. -- The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven -- http://mail.python.org/mailman/listinfo/python-list

Re: Old Man Yells At Cloud

2017-09-18 Thread Roel Schroeven
heses. I don't know how, I don't know why, it just happens. -- The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Re: Old Man Yells At Cloud

2017-09-18 Thread Roel Schroeven
ats purity" sometimes. -- The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Re: Spacing conventions

2017-09-28 Thread Roel Schroeven
ddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Re: OT I before E [was Re: Lies in education [was Re: The "loop and a half"]]

2017-10-05 Thread Roel Schroeven
m. -- Isaac Asimov Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Does anyone know ni?

2018-02-06 Thread Roel Schroeven
ring? -- The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Re: Does anyone know ni?

2018-02-06 Thread Roel Schroeven
Asimov Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

How to work on a package

2018-02-06 Thread Roel Schroeven
de of writing packages? -- The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Re: How to work on a package

2018-02-07 Thread Roel Schroeven
ect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Re: How to work on a package

2018-02-07 Thread Roel Schroeven
Rob Gaddi schreef op 7/02/2018 22:24: On 02/07/2018 12:34 PM, Roel Schroeven wrote: dieter schreef op 7/02/2018 8:21: Likely, there are many ways to execute tests for your package. I am using "setuptools" for packaging (an extension of Python's standard "disutils"). It

Re: Bitstream -- Binary Data for Humans

2018-03-05 Thread Roel Schroeven
ps://en.wikipedia.org/wiki/Automatic_identification_system Best regards, Roel -- The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom. -- Isaac Asimov Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Re: tail

2022-04-24 Thread Roel Schroeven
dn schreef op 24/04/2022 om 0:04: Disagreeing with @Chris in the sense that I use tail very frequently, and usually in the context of server logs - but I'm talking about the Linux implementation, not Python code! If I understand Marco correctly, what he want is to read the lines from bottom to t

Re: How to replace characters in a string?

2022-06-08 Thread Roel Schroeven
Op 8/06/2022 om 11:25 schreef Dave: Hi, I misunderstood how it worked, basically I’ve added this function: def filterCommonCharacters(theString): myNewString = theString.replace("\u2019", "'") return myNewString Which returns a new string replacing the common characters. This can e

Re: mapLast, mapFirst, and just general iterator questions

2022-06-14 Thread Roel Schroeven
Chris Angelico schreef op 14/06/2022 om 20:47: > def main(): > for each in (iterEmpty, iter1, iter2, iterMany): > baseIterator = each() > chopFirst = mapFirst(baseIterator, lambda x: x[1:-1]) > andCapLast = mapLast(chopFirst, lambda x: x.upper()) > print(repr("

Re: "CPython"

2022-06-20 Thread Roel Schroeven
Paulo da Silva schreef op 20/06/2022 om 21:01: Às 18:19 de 20/06/22, Stefan Ram escreveu: >The same personality traits that make people react >to troll postings might make them spread unconfirmed >ideas about the meaning of "C" in "CPython". > >The /core/ of CPython is written in

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Roel Schroeven
Op 24/06/2022 om 10:43 schreef נתי שטרן: what's the problem with the code Have you seen the replies from Mats Wichmann and Chris Angelico, who helpfully pointed out some problems with your code and possible improvements? Please take those into account instead of asking the same thing over

Re: argparse modify

2022-06-24 Thread Roel Schroeven
Op 24/06/2022 om 0:32 schreef Dennis Lee Bieber: On Thu, 23 Jun 2022 18:57:31 +0200, "Dieter Maurer" declaimed the following: >??? wrote at 2022-6-23 15:31 +0300: >>how to solve this (argparse) >>MAXREPEAT = _NamedIntConstant(32,name=str(32)) >>TypeError: 'name' is an invalid keyword a

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Roel Schroeven
Op 24/06/2022 om 11:10 schreef נתי שטרן: OK. I lifted the full library to a HUGE python file that was saved on LAN in MY WORK Do I need to lift many other libraries to the file? I glad to any answer Answer this: what is it that your _actually_ trying to do? What is the ultimate goal of all that

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Roel Schroeven
Op 24/06/2022 om 14:14 schreef נתי שטרן: My TARGET  is to bind many code libraries to one Huge code file that works optimally and do optimizations if needed. In this file have code of huge part of falconpy, ALL code of re, argparse, are and many other code libraries Don't do that. Sorry, it's ju

Re: REPL with multiple function definitions

2022-06-26 Thread Roel Schroeven
Rob Cliffe via Python-list schreef op 27/06/2022 om 0:14: This 2-line program def f(): pass def g(): pass runs silently (no Exception).  But: 23:07:02 c:\>python Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32 Type "help", "copyright", "credits" o

Re: calculate diff between dates

2022-07-13 Thread Roel Schroeven
Op 12/07/2022 om 14:37 schreef נתי שטרן: I glad for any help http://www.catb.org/~esr/faqs/smart-questions.html -- "Binnen een begrensde ruimte ligt een kritiek punt, waar voorbij de vrijheid afneemt naarmate het aantal individuen stijgt. Dit gaat evenzeer op voor mensen in de begrensde ruimte

Re: [Neuroimaging] what's the problem??????

2022-07-15 Thread Roel Schroeven
Dennis Lee Bieber schreef op 15/07/2022 om 19:11: ... is, itself, returning a dictionary on which .values() can be applied. In that case, the list() call is likely redundant as .values() already returned a list (hmmm, is list(some_list) a no-op, or does it wrap some_list into another list -- in t

Re: list indices must be integers or slices, not str

2022-07-20 Thread Roel Schroeven
Frank Millman schreef op 20/07/2022 om 13:04: >> On Wed, 20 Jul 2022 at 18:34, Frank Millman wrote: >>>   >>> >>>   >>> x = list(range(10)) >>>   >>> >>>   >>> '{x[1]}'.format(**vars()) >>> '1' >>>   >>> >>>   >>> '{x[-1]}'.format(**vars()) >>> Traceback (most recent call last): >>>     File "",

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Roel Schroeven
Cecil Westerhof via Python-list schreef op 27/07/2022 om 17:43: "Michael F. Stemper" writes: > This is orthogonal to your question, but might be of some use to you: > > The combination of using len(to_try) as an argument to randint() and > saving the output to a variable named "index" suggests

Re: Simple TCP proxy

2022-07-30 Thread Roel Schroeven
Morten W. Petersen schreef op 29/07/2022 om 22:59: OK, sounds like sunshine is getting the best of you. It has to be said: that is uncalled for. Chris gave you good advice, with the best of intentions. Sometimes we don't like good advice if it says something we don't like, but that's no reaso

Re: What can I do about this?

2022-08-29 Thread Roel Schroeven
Op 29/08/2022 om 2:55 schreef gene heskett: On 8/28/22 19:39, Peter J. Holzer wrote: On 2022-08-28 18:40:17 -0400, gene heskett wrote: Persuant to my claim the py3.10 is busted, here is a sample. This is me, trying to make pronterface, inside a venv: When the package manager version will only

Re: What can I do about this?

2022-08-29 Thread Roel Schroeven
Mark Bourne schreef op 29/08/2022 om 13:02: Roel Schroeven wrote: > $ source {path_to_venv}/bin/pip3  # activate the venv I think this first line should probably be: $ source {path_to_venv}/bin/activate # activate the venv i.e. with `activate` rather than `pip3`? Oops, yes, of cou

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

2022-10-11 Thread Roel Schroeven
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 P

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Roel Schroeven
Op 24/10/2022 om 4:29 schreef Chris Angelico: Parsing ancient HTML files is something Beautiful Soup is normally great at. But I've run into a small problem, caused by this sort of sloppy HTML: from bs4 import BeautifulSoup # See: https://gsarchive.net/gilbert/plays/princess/tennyson/tenniv.htm

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Roel Schroeven
Op 24/10/2022 om 9:42 schreef Roel Schroeven: Using html5lib (install package html5lib) instead of html.parser seems to do the trick: it inserts right before the next , and one before the closing . On my system the same happens when I don't specify a parser, but IIRC that's a b

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Roel Schroeven
(Oops, accidentally only sent to Chris instead of to the list) Op 24/10/2022 om 10:02 schreef Chris Angelico: On Mon, 24 Oct 2022 at 18:43, Roel Schroeven wrote: > Using html5lib (install package html5lib) instead of html.parser seems > to do the trick: it inserts right before the next

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Roel Schroeven
Jon Ribbens via Python-list schreef op 24/10/2022 om 19:01: On 2022-10-24, Chris Angelico wrote: > On Tue, 25 Oct 2022 at 02:45, Jon Ribbens via Python-list wrote: >> Adding in the omitted , , , , and >> would make no difference and there's no particular reason to recommend >> doing so as fa

Re: Operator: inappropriate wording?

2022-10-26 Thread Roel Schroeven
elas tica schreef op 26/10/2022 om 21:01: Quotes from The Python Language Reference, Release 3.10.8: - Note that tuples are not formed by the parentheses, but rather by use of the comma operator (p. 66) - Note: If the object is a class instance and the attribute reference occurs on both sid

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Roel Schroeven
Op 14/11/2022 om 4:23 schreef DFS: On 11/13/2022 9:11 PM, Chris Angelico wrote: On Mon, 14 Nov 2022 at 11:53, DFS wrote: On 11/13/2022 5:20 PM, Jon Ribbens wrote: On 2022-11-13, DFS wrote: In code, list.clear is just ignored. At the terminal, list.clear shows in code: x = [1,2,3] x.clea

Re: Passing information between modules

2022-11-20 Thread Roel Schroeven
Stefan Ram schreef op 20/11/2022 om 11:39: The idea is about parameterizing the behavior of a module. For example, the module "M" may contain functions that contain "input.read()" to get input and "output.write()" to write output. Then one would write code like (the following is no

Re: Passing information between modules

2022-11-20 Thread Roel Schroeven
Thomas Passin schreef op 20/11/2022 om 20:33: https://devblogs.microsoft.com/oldnewthing/20050607-00/?p=35413 https://devblogs.microsoft.com/oldnewthing/20101125-00/?p=12203 Now that I think about it, The Old New Thing is also where I got the global vs local thing: "Don’t use global state to ma

Re: How to convert a raw string r'\xdd' to '\xdd' more gracefully?

2022-12-07 Thread Roel Schroeven
Op 7/12/2022 om 4:37 schreef Jach Feng: MRAB 在 2022年12月7日 星期三上午11:04:43 [UTC+8] 的信中寫道: > On 2022-12-07 02: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

Re: sqlite3 double quote behavior

2022-12-13 Thread Roel Schroeven
Op 13/12/2022 om 1:41 schreef John K. Parejko: Asking here before I file an improvement request issue on the python GitHub: sqlite has a known misfeature with double-quoted strings, whereby they will be interpreted as string literals if they don’t match a valid identifier [1]. The note in the

Re: sqlite3 double quote behavior

2022-12-13 Thread Roel Schroeven
Op 13/12/2022 om 14:23 schreef Thomas Passin: On 12/13/2022 4:09 AM, Chris Angelico wrote: On Tue, 13 Dec 2022 at 19:52, Roel Schroeven wrote: Like Lars Liedtke this is not an exact answer to your question, but you can side-step the issue by using parametrized queries, i.e. instead of

Re: sqlite3 double quote behavior

2022-12-13 Thread Roel Schroeven
Op 13/12/2022 om 15:15 schreef Roel Schroeven: +1 to expose the sqlite3_db_config() function, or maybe just a special case for this specific option. Actually I'm surprised SQLite doesn't have a PRAGMA command to customize this behavior. That would make it possible to customiz

Re: sqlite3 double quote behavior

2022-12-13 Thread Roel Schroeven
Stefan Ram schreef op 13/12/2022 om 8:42: "John K. Parejko" writes: >I was just burned by this, where some tests I’d written >against an sqlite database did not fail in the way that they >“should” have, because of this double-quoted string issue. In standard SQL, double quotes denote identif

Re: sqlite3 double quote behavior

2022-12-13 Thread Roel Schroeven
Chris Angelico schreef op 13/12/2022 om 20:01: On Wed, 14 Dec 2022 at 06:00, Roel Schroeven wrote: > > Stefan Ram schreef op 13/12/2022 om 8:42: > > "John K. Parejko" writes: > > >I was just burned by this, where some tests I’d written > > >against an

Re: sqlite3 double quote behavior

2022-12-13 Thread Roel Schroeven
Roel Schroeven schreef op 13/12/2022 om 22:18: Chris Angelico schreef op 13/12/2022 om 20:01: > > Perhaps it's a better idea to use [identifier] or `identifier` instead > > though (I just learned about those on > > https://sqlite.org/lang_keywords.html). Both are not stand

Re: sqlite3 double quote behavior

2022-12-13 Thread Roel Schroeven
Roel Schroeven schreef op 13/12/2022 om 22:36: sqlite> insert into foo values ("xyzzy", "xyzzy"); SQLite accepts it like that, but I really should have used single quotes there instead of double quotes. It's a bad habit from using MySQL for too long I guess. -- &q

Re: sqlite3 double quote behavior

2022-12-13 Thread Roel Schroeven
Chris Angelico schreef op 13/12/2022 om 22:58: Okay, so. exactly the same as if you use standard double quotes, but change the configuration option. So the options are: make everything worse for everyone by exacerbating the problem of non-standard identifier quoting, or get this API so SQLite

Re: Possible re bug when using ".*"

2022-12-28 Thread Roel Schroeven
Alexander Richert - NOAA Affiliate via Python-list schreef op 28/12/2022 om 19:42: In a couple recent versions of Python (including 3.8 and 3.10), the following code: import re print(re.sub(".*", "replacement", "pattern")) yields the output "replacementreplacement". This behavior does not occu

Re: Possible re bug when using ".*"

2022-12-28 Thread Roel Schroeven
Roel Schroeven schreef op 28/12/2022 om 19:59: Alexander Richert - NOAA Affiliate via Python-list schreef op 28/12/2022 om 19:42: In a couple recent versions of Python (including 3.8 and 3.10), the following code: import re print(re.sub(".*", "replacement", "pat

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Roel Schroeven
Jen Kris via Python-list schreef op 10/01/2023 om 21:41: But where they have been set to the same object, an operation on one will affect the other as long as they are equal (in Python). As long as they are *identical*, not equal. Identical as in having the same identity as Python defines it. I

Re: To clarify how Python handles two equal objects

2023-01-11 Thread Roel Schroeven
Op 11/01/2023 om 16:33 schreef Jen Kris via Python-list: Yes, I did understand that.  In your example, "a" and "b" are the same pointer, so an operation on one is an operation on the other (because they’re the same memory block). Sorry if you feel I'm being overly pedantic, but your explanatio

Re: file.read Method Documentation (Python 2.7.10)

2023-01-11 Thread Roel Schroeven
Chris Angelico schreef op 11/01/2023 om 18:36: On Thu, 12 Jan 2023 at 04:31, Stephen Tucker wrote: > 1. Create BOM.txt > 2. Input three bytes at once from BOM.txt and print them > 3. Input three bytes one at a time from BOM.txt and print them All of these correctly show that a file, in binary m

Re: To clarify how Python handles two equal objects

2023-01-14 Thread Roel Schroeven
Chris Angelico schreef op 15/01/2023 om 1:41: On Sun, 15 Jan 2023 at 11:38, Jen Kris wrote: > > Yes, in fact I asked my original question – "I discovered something about Python array handling that I would like to clarify" -- because I saw that Python did it that way. > Yep. This is not spec

Re: Improvement to imports, what is a better way ?

2023-01-19 Thread Roel Schroeven
Op 19/01/2023 om 11:32 schreef Stefan Ram: dn writes: >The longer an identifier, the more it 'pushes' code over to the right or >to expand over multiple screen-lines. Some thoughts on this are behind >PEP-008 philosophies, eg line-limit. Raymond Hettinger (transcribed, shortened and parti

Re: Improvement to imports, what is a better way ?

2023-01-19 Thread Roel Schroeven
2qdxy4rzwzuui...@potatochowder.com schreef op 19/01/2023 om 19:30: > The PEP-8 rules are good, but they can't cover all cases perfectly. Some the PEP-8 rules are debatable. Regardless, they can't cover all cases perfectly. (IOW, we agree on the bit that's relevant to this thread.) PEP 8 even

Re: DeprecationWarning but replacement doesn't work

2023-02-04 Thread Roel Schroeven
Chris Green schreef op 4/02/2023 om 16:17: I am using Image from PIL and I'm getting a deprecation warning as follows:- /home/chris/bin/picShrink.py:80: DeprecationWarning: ANTIALIAS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead. But if I change l

Re: Am I banned from Discuss forum?

2023-02-11 Thread Roel Schroeven
Michael Torrie schreef op 11/02/2023 om 4:59: I didn't know there was a Discourse forum. Is it supposed to be sync > with the mailing list and USENET? Or is it intended to replace this > mailing list? I rarely see Python devs on this list, so maybe > they've chosen to hang out exclusively in D

Re: Tuple Comprehension ???

2023-02-21 Thread Roel Schroeven
Hen Hanna schreef op 21/02/2023 om 5:13: (A) print( max( * LisX )) (B) print( sum( * LisX ))<--- Bad syntax !!! What's most surprising is (A) is ok, and (B) is not. even tho' max() and sum() have (basically) the same

Re: Line continuation and comments

2023-02-24 Thread Roel Schroeven
Mark Bourne schreef op 24/02/2023 om 22:04: Personally, I don't particularly like the way you have to put multiline strings on the far left (rather than aligned with the rest of the scope) to avoid getting spaces at the beginning of each line. I find it makes it more difficult to see where the s

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-27 Thread Roel Schroeven
Op 26/02/2023 om 6:53 schreef Hen Hanna: > There are some similarities between Python and Lisp-family > languages, but really Python is its own thing. Scope (and extent ?) of variables is one reminder that Python is not Lisp  fori in range(5):  print( i )

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-27 Thread Roel Schroeven
Op 27/02/2023 om 9:56 schreef inhahe: On Mon, Feb 27, 2023 at 3:52 AM Roel Schroeven wrote: > Op 26/02/2023 om 6:53 schreef Hen Hanna: > > > There are some similarities between Python and Lisp-family > > > languages, but really Python is its own thing. > > > >

Re: How to escape strings for re.finditer?

2023-02-28 Thread Roel Schroeven
Op 28/02/2023 om 3:44 schreef Thomas Passin: On 2/27/2023 9:16 PM, avi.e.gr...@gmail.com wrote: And, just for fun, since there is nothing wrong with your code, this minor change is terser: example = 'X - abc_degree + 1 + qq + abc_degree + 1' for match in re.finditer(re.escape('abc_degree + 1'

Re: How to escape strings for re.finditer?

2023-02-28 Thread Roel Schroeven
Op 28/02/2023 om 14:35 schreef Thomas Passin: On 2/28/2023 4:33 AM, Roel Schroeven wrote: [...] (2) Searching for a string in another string, in a performant way, is not as simple as it first appears. Your version works correctly, but slowly. In some situations it doesn't matter, but in

Re: Testing list sequence question

2023-03-04 Thread Roel Schroeven
Gabor Urban schreef op 4/03/2023 om 17:38: Hi guys, I have a strange problem that I do not understand. I am testing function which returns a dictionary. The code should ensure that the keys of the dictionary are generated in a given order. I am testing the function with the standard unittest

Re: Testing list sequence question

2023-03-04 Thread Roel Schroeven
Thomas Passin schreef op 4/03/2023 om 18:49: On 3/4/2023 11:38 AM, Gabor Urban wrote: > Hi guys, > > I have a strange problem that I do not understand. I am testing function > which returns a dictionary. The code should ensure that the keys of the > dictionary are generated in a given order.

Re: We can call methods of parenet class without initliaze it?

2023-03-15 Thread Roel Schroeven
Op 15/03/2023 om 10:57 schreef scruel tao: The following code won’t be allowed in Java, but in python, it works fine: ```python class A: A = 3 def __init__(self): print(self.A) def p(self): print(self.A) self.A += 1 class B(A): def __init__(self)

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-16 Thread Roel Schroeven
Op 14/03/2023 om 8:48 schreef Alexander Nestorov: I have the following code: ... for i in range(151): # 150 iterations    ... Nothing to do with your actual question and it's probably just a small oversight, but still I thought it was worth a mention: that comment does not accu

Re: Friday finking: IDE 'macro expansions'

2023-03-17 Thread Roel Schroeven
Op 17/03/2023 om 0:54 schreef Thomas Passin: What I find more useful is matching brackets/parens/braces.  Not inserting them but highlighting or (better) jumping to the matching one when asked. That is very helpful indeed. Even better than simply highlighting is (IMO) a thing called "Rainbow B

Re: Fwd: Friday finking: IDE 'macro expansions'

2023-03-18 Thread Roel Schroeven
Peter J. Holzer schreef op 18/03/2023 om 13:15: On 2023-03-18 08:46:42 +, Alan Gauld wrote: > On 17/03/2023 17:55, Thomas Passin wrote: > >> I used Delphi and Smalltalk/V which both pretty much only exist within > >> their own IDEs and I used their features extensively. > > > > Back when

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Roel Schroeven
Andreas Eisele schreef op 30/03/2023 om 11:15: I sometimes make use of the fact that the built-in pow() function has an optional third argument for modulo calculation, which is handy when dealing with tasks from number theory, very large numbers, problems from Project Euler, etc. I was unpleasa

Re: Christoph Gohlke and compiled packages

2023-04-11 Thread Roel Schroeven
Op 11/04/2023 om 12:58 schreef Chris Angelico: On Tue, 11 Apr 2023 at 20:15, Jim Schwartz wrote: > > What’s the problem now? Is it with python on windows? I use python on windows so I’d like to know. Thanks > Python itself is fine, but a lot of third-party packages are hard to obtain. So if

Re: Dataclasses, immutability(?), and ChatGPT

2023-04-12 Thread Roel Schroeven
Op 12/04/2023 om 6:58 schreef dn via Python-list: Are dataclasses (or instances thereof) mutable or immutable? - and in what sense? Instances of dataclasses are mutable, just like normal classes. Dataclasses *are* normal classes, with some extra special methods. They are totally different from

Re: Invalid literal for int() with base 10?

2023-05-26 Thread Roel Schroeven
Op 25/05/2023 om 23:30 schreef Kevin M. Wilson via Python-list: Ok, I'm not finding any info. on the int() for converting a str to an int (that specifies a base parameter)?! The picture is of the code I've written... And the base 10 paradigm involved?? years = int('y') # store for calculationVa

"Invalid literal for int() with base 10": is it really a literal?

2023-05-26 Thread Roel Schroeven
Kevin M. Wilson's post "Invalid literal for int() with base 10?" got me thinking about the use of the word "literal" in that message. Is it correct to use "literal" in that context? It's correct in something like this: >>> int('invalid') Traceback (most recent call last):   File "", line 1, in

Re: "Invalid literal for int() with base 10": is it really a literal?

2023-05-26 Thread Roel Schroeven
Op 26/05/2023 om 10:29 schreef Chris Angelico: However, if you want to change the wording, I'd be more inclined to synchronize it with float(): >>> float("a") Traceback (most recent call last): File "", line 1, in ValueError: could not convert string to float: 'a' I was looking for other Va

Re: f-string syntax deficiency?

2023-06-06 Thread Roel Schroeven
Op 6/06/2023 om 16:08 schreef Chris Angelico: On Wed, 7 Jun 2023 at 00:06, Neal Becker wrote: > > The following f-string does not parse and gives syntax error on 3.11.3: > > f'thruput/{"user" if opt.return else "cell"} vs. elevation\n' > > However this expression, which is similar does parse cor

Re: f-string syntax deficiency?

2023-06-06 Thread Roel Schroeven
Op 6/06/2023 om 16:41 schreef Roel Schroeven: 'return' being a keyowrd is definitely going to be the problem. *keyword -- "Don't Panic." -- Douglas Adams, The Hitchhiker's Guide to the Galaxy -- https://mail.python.org/mailman/listinfo/python-list

Re: New Python implementation

2021-02-15 Thread Roel Schroeven
lso the semantics of the various languages. Is it your intention to not only compile procedural and object-oriented languages, or also functional languages such as Haskell, Ocaml, Scheme? -- "Honest criticism is hard to take, particularly from a relative, a friend, an acquainta

Re: New Python implementation

2021-02-15 Thread Roel Schroeven
Grant Edwards schreef op 15/02/2021 om 21:59: On 2021-02-15, Roel Schroeven wrote: Is it your intention to not only compile procedural and object-oriented languages, or also functional languages such as Haskell, Ocaml, Scheme? And Prolog! Ha, yes, that one was the next one I thought about

Re: New Python implementation

2021-02-16 Thread Roel Schroeven
Christian Gollwitzer schreef op 16/02/2021 om 8:25: Am 15.02.21 um 21:37 schrieb Roel Schroeven: So your claim is that your compiler is able to, or will be able to, compile any language just by specifying a small schema file. Great! Do you maybe have a proof-of-concept? A simple language with

Re: Current thinking on required options

2021-04-20 Thread Roel Schroeven
elp to document precisely and explicitly what's happening, instead of having to rely on remembering the order of arguments/options. -- "Honest criticism is hard to take, particularly from a relative, a friend, an acquaintance, or a stranger." -- Franklin P. Jones Roel Schroev

Re: Posting code on stackoverflow

2021-06-05 Thread Roel Schroeven
nk lines before and after the code block. -- "Honest criticism is hard to take, particularly from a relative, a friend, an acquaintance, or a stranger." -- Franklin P. Jones Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Re: Why the list creates in two different ways? Does it cause by the mutability of its elements? Where the Python document explains it?

2021-06-16 Thread Roel Schroeven
oes that answer your doubts? [1] https://docs.python.org/3.8/library/functions.html?highlight=id#id -- "Honest criticism is hard to take, particularly from a relative, a friend, an acquaintance, or a stranger." -- Franklin P. Jones Roel Schroeven -- https://mail.python.org/mailman/listinfo/python-list

Re: argparse: delimiter for argparse list arguments

2021-08-03 Thread Roel Schroeven
Jon Ribbens via Python-list schreef op 3/08/2021 om 17:48: On 2021-08-03, Michael Torrie wrote: > On 8/2/21 1:43 PM, Sven R. Kunze wrote: >> maybe, I am missing something here but is it possible to specify a >> delimiter for list arguments in argparse: >> >> https://docs.python.org/3/library/a

Re: argparse: delimiter for argparse list arguments

2021-08-03 Thread Roel Schroeven
Jon Ribbens via Python-list schreef op 3/08/2021 om 22:55: >> Loads of git commands do this. e.g. commit, diff, log, status, etc. >> It's not completely unlike what you're describing above, which is >> already supported automatically by argparse. > > Commands like git commit do not use '--' to se

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-16 Thread Roel Schroeven
Op 15/08/2021 om 7:01 schreef Chris Angelico: On Sun, Aug 15, 2021 at 1:02 PM John O'Hagan wrote: > > > On 2021-08-13 17:17, Chris Angelico wrote: > > > Is it really? In my experience, no human ear can distinguish 277Hz > > > from 277.1826Hz when it's played on a one-bit PC speaker, which the >

Re: on floating-point numbers

2021-09-03 Thread Roel Schroeven
Op 2/09/2021 om 17:08 schreef Hope Rouselle: ls = [7.23, 8.41, 6.15, 2.31, 7.73, 7.77] sum(ls) > 39.594 > ls = [8.41, 6.15, 2.31, 7.73, 7.77, 7.23] sum(ls) > 39.61 > > All I did was to take the first number, 7.23, and move it to the last > position in t

Sad news: Fredrik Lundh ("Effbot") has passed away

2021-12-10 Thread Roel Schroeven
Message from Guido van Rossum (https://mail.python.org/archives/list/python-...@python.org/thread/36Q5QBILL3QIFIA3KHNGFBNJQKXKN7SD/): A former core dev who works at Google just passed the news that Fredrik Lundh (also known as Effbot) has died. Fredrik was an early Python contributor (e.g. El

Re: venv and executing other python programs

2022-02-15 Thread Roel Schroeven
Op 15/02/2022 om 8:21 schreef Reto: On Tue, Feb 15, 2022 at 06:35:18AM +0100, Mirko via Python-list wrote: > How to people here deal with that? Don't activate the venv for those programs then? The point of a venv is that you only enter it when you actually want that specific python stack. Get y

Re: Behavior of the for-else construct

2022-03-03 Thread Roel Schroeven
Op 3/03/2022 om 14:24 schreef computermaster360: I want to make a little survey here. Do you find the for-else construct useful? Have you used it in practice? Do you even know how it works, or that there is such a thing in Python? - No, or at least not when balanced against the drawbacks as I pe

Re: Behavior of the for-else construct

2022-03-04 Thread Roel Schroeven
Op 4/03/2022 om 8:18 schreef Chris Angelico: On Fri, 4 Mar 2022 at 18:13, Dieter Maurer wrote: > One of my use cases for `for - else` does not involve a `break`: > the initialization of the loop variable when the sequence is empty. > It is demonstrated by the following transscript: > > ```pycon

  1   2   3   4   5   >