Re: Python 3.x and bytes

2011-05-18 Thread Ethan Furman
Ian Kelly wrote: On Tue, May 17, 2011 at 2:20 PM, Ethan Furman wrote: The big question, though, is would you do it this way: some_var = bytes(23).replace(b'\x00', b'a') or this way? some_var = bytes(b'a' * 23) Actually, I would just do it this way: some_var

Re: Trying to understand html.parser.HTMLParser

2011-05-19 Thread Ethan Furman
Andrew Berg wrote: ElementTree doesn't seem to have been updated in a long time, so I'll assume it won't work with Python 3. I don't know how to use it, but you'll find ElementTree as xml.etree in Python 3. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

hash values and equality

2011-05-19 Thread Ethan Furman
Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing will happen if this isn't the case? Here's a toy example of a class I'm

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Chris Rebert wrote: On Thu, May 19, 2011 at 10:43 PM, Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what hor

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Peter Otten wrote: Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing will happen if this isn&

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Ulrich Eckhardt wrote: Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ I'm hoping somebody can tell me what horrible thing will happen if this isn&

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ Two things I didn't make clear originally: I'm using Python3. My objects (of type Wierd

Re: hash values and equality

2011-05-20 Thread Ethan Furman
Peter Otten wrote: Ethan Furman wrote: Peter Otten wrote: Ethan Furman wrote: Several folk have said that objects that compare equal must hash equal, and the docs also state this http://docs.python.org/dev/reference/datamodel.html#object.__hash__ --> class Wierd(): ... def __ini

Re: Why did Quora choose Python for its development?

2011-05-25 Thread Ethan Furman
Terry Reedy wrote: On 5/25/2011 8:01 AM, John Bokma wrote: to. Like I already stated before: if Python is really so much better than Python readability wise, why do I have such a hard time dropping Perl and moving on? [you meant 'than Perl'] You are one of the people whose brain fits Perl (o

Re: Python 3.2 bug? Reading the last line of a file

2011-05-25 Thread Ethan Furman
tkp...@hotmail.com wrote: Thanks for the guidance - it was indeed an issue with reading in binary vs. text., and I do now succeed in reading the last line, except that I now seem unable to split it, as I demonstrate below. Here's what I get when I read the last line in text mode using 2.7.1 and i

Re: Python 3.2 bug? Reading the last line of a file

2011-05-25 Thread Ethan Furman
MRAB wrote: On 26/05/2011 00:25, tkp...@hotmail.com wrote: Thanks for the guidance - it was indeed an issue with reading in binary vs. text., and I do now succeed in reading the last line, except that I now seem unable to split it, as I demonstrate below. Here's what I get when I read the last l

Re: Why did Quora choose Python for its development?

2011-05-26 Thread Ethan Furman
John, You say English is not your first language. Let me assure you that the words you chose to use in reply to Stephen were vulgar as well as rude, and did more to lesson the overall friendliness of this forum than Stephen's adversarial style. You usually have interesting and informative p

bug in str.startswith() and str.endswith()

2011-05-26 Thread Ethan Furman
I've tried this in 2.5 - 3.2: --> 'this is a test'.startswith('this') True --> 'this is a test'.startswith('this', None, None) Traceback (most recent call last): File "", line 1, in TypeError: slice indices must be integers or None or have an __index__ method The 3.2 docs say this: str.sta

Re: Why did Quora choose Python for its development?

2011-05-27 Thread Ethan Furman
Thorsten Kampe wrote: * Steven D'Aprano (27 May 2011 03:07:30 GMT) Okay, I've stayed silent while people criticize me long enough. What exactly did I say that was impolite? Nothing. John threw down a distinct challenge: if Python is really so much better than Python [sic] readabil

Re: bug in str.startswith() and str.endswith()

2011-05-27 Thread Ethan Furman
Ethan Furman wrote: Any reason this is not a bug? Looks like someone else beat me to filing: http://bugs.python.org/issue11828 Looks like they fixed it as well. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's super() considered super!

2011-05-27 Thread Ethan Furman
Duncan Booth wrote: Steven D'Aprano wrote: I was thrilled to learn a new trick, popping keyword arguments before calling super, and wondered why I hadn't thought of that myself. How on earth did I fail to realise that a kwarg dict was mutable and therefore you can remove keyword args, or inj

Re: The worth of comments

2011-05-27 Thread Ethan Furman
Miki Tebeka wrote: https://docs.google.com/present/view?id=ah82mvnssv5d_162dbgx78gw ;) +1 That was hilarious. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Puzzled by list-appending behavior

2011-05-27 Thread Ethan Furman
Prasad, Ramit wrote: I have to say, I do like Python's lack of keywords for these things I thought True/False were among the list of keywords in Python 3.x ? Or are those the only keywords? http://docs.python.org/py3k/reference/lexical_analysis.html#keywords False class finally

Re: Beginner needs advice

2011-05-27 Thread Ethan Furman
Lew Schwartz wrote: So, if I read between the lines correctly, you recommend Python 3? Does the windows version install with a development environment? Dabo, last I checked, uses wxPython, which uses wxWidgets (sp?), which is not yet ported to Python 3. So if you got that route you'll need to

Re: Python's super() considered super!

2011-05-27 Thread Ethan Furman
I suspect the larger issue is that Multiple Inheritance is complex, but folks don't appreciate that. Ask anyone about meta-classes and their eyes bug-out, but MI? Simple! NOT. On the other hand, perhaps the docs should declare that the built-in objects are not designed for MI, so that that,

Re: Beginner needs advice

2011-05-27 Thread Ethan Furman
harrismh777 wrote: Chris Angelico wrote: To say that "most" 2.x code is incompatible with 3.x is to deny the 2to3 utility, all I'm saying is that 3.x is not compatible with 2.x code (completely not compatible) and you're ignoring the people who deliberately write code that can cross-execu

Re: scope of function parameters (take two)

2011-05-31 Thread Ethan Furman
Henry Olders wrote: [...] what I want is a function that is free of side effects [...] Shoot, that's easy! Just write your function to not have any! ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters (take two)

2011-05-31 Thread Ethan Furman
Henry Olders wrote: Clearly, making a copy within the function eliminates the possibility of the side effects caused by passing in mutable objects. Would having the compiler/interpreter do this automatically make python so much different? It would be a different language. ~Ethan~ -- http://m

Re: returning NotImplemented

2011-05-31 Thread Ethan Furman
Eric Snow wrote: Looking at the ABC code [1], I noticed that Mapping's __eq__ method can return NotImplemented. This got me curious as to why you would return NotImplemented and not raise a TypeError or a NotImplementedError. My understanding is that if your object does not know how to perf

Re: returning NotImplemented

2011-05-31 Thread Ethan Furman
Eric Snow wrote: Guido indicates earlier in the thread that NotImplemented is used so that you know that it came from the function that you directly called, and not from another call inside that function. Why does it matter if it came directly from the function or not? And couldn't the NotIm

Re: float("nan") in set or as key

2011-06-01 Thread Ethan Furman
Carl Banks wrote: For instance, say you are using an implementation that uses > floating point, and you define a function that uses Newton's > method to find a square root: def square_root(N,x=None): if x is None: x = N/2 for i in range(100): x = (x + N/x)/2 return

Re: Delay a computation in another thread

2017-09-08 Thread Ethan Furman
On 09/08/2017 07:49 AM, Steve D'Aprano wrote: On Sun, 3 Sep 2017 03:03 am, MRAB wrote: Timer is a subclass of Thread, so you can set its .daemon attribute. Sorry for the long delay in replying to this, but if I set its daemon attribute, won't that mean it will live on after the interpreter s

Re: Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"

2017-09-18 Thread Ethan Furman
On 09/17/2017 01:14 AM, Steve D'Aprano wrote: On Sun, 17 Sep 2017 04:16 pm, Terry Reedy wrote: On 9/17/2017 2:04 AM, Chris Angelico wrote: On Sun, Sep 17, 2017 at 4:00 PM, Terry Reedy wrote: The numerical extensions have been quasi-official in the sense that at least 3 language enhancements

Re: Old Man Yells At Cloud

2017-09-19 Thread Ethan Furman
On 09/19/2017 09:37 AM, justin walters wrote: On Tue, Sep 19, 2017 at 9:17 AM, Grant Edwards wrote: On 2017-09-19, Jan Erik =?utf-8?q?Mostr=C3=B6m?= wrote: And I'm amazed how often I see people trying to calculate change = sum handed over - cost and then trying to figure out what bi

Re: Stdlib, what's in, what's out

2017-09-20 Thread Ethan Furman
On 09/20/2017 09:24 AM, Chris Warrick wrote: On 20 September 2017 at 17:16, Dennis Lee Bieber wrote: And if wxPython had been part of the stdlib, it would have meant Python 3 would have been delayed years until wxPython had been ported -- or wxPython would have been pulled from the stdlib and

Re: The "loop and a half"

2017-10-05 Thread Ethan Furman
On 10/04/2017 04:50 PM, Stefan Ram wrote: names: are sequences of letters and stand for values function names: names that stand for callable values function call operator: calls a callable value (first operand) argument: if present, it's value is passed to the function And, lo, I have explai

Posts by Stefan Ram

2017-11-21 Thread Ethan Furman
On 11/20/2017 10:47 AM, Michael Torrie wrote:> On 11/20/2017 07:50 AM, Stefan Ram wrote: >>I am posting to a Usenet newsgroup. I am not aware of any >>"Python-List mailing list". > > As far as I'm concerned, this list is primarily a mailing list, hosted > by Mailman at python.org, and is

Re: we want python software

2017-12-05 Thread Ethan Furman
On 12/05/2017 09:27 PM, km wrote: [snip] Many things in this world are frustrating, but being hateful will not solve anything. Please control yourself. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: we want python software

2017-12-06 Thread Ethan Furman
On 12/06/2017 08:33 AM, Steve D'Aprano wrote: I'm going to defend KM (srikrishnamohan) -- his comments were not "an attack", On 12/05/2017 08:38 PM, km wrote: > I dont know how these students are selected into b tech stream in India. > they are so dumb. On 12/05/2017 09:27 PM, km wrote: > You

Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
The simple answer is No, and all the answers agree on that point. It does beg the question of what an identity function is, though. My contention is that an identity function is a do-nothing function that simply returns what it was given: --> identity(1) 1 --> identity('spam') 'spam' --> ide

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 10:53 AM, Peter Otten wrote: Ethan Furman wrote: The simple answer is No, and all the answers agree on that point. It does beg the question of what an identity function is, though. My contention is that an identity function is a do-nothing function that simply returns what it

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 11:23 AM, Ned Batchelder wrote: On 12/7/17 1:28 PM, Ethan Furman wrote: --> identity('spam', 'eggs', 7) ('spam', 'eggs', 7) I don't see why this last case should hold. Why does the function take more than one argument? An

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 11:46 AM, Paul Moore wrote: On 7 December 2017 at 18:28, Ethan Furman wrote: The simple answer is No, and all the answers agree on that point. It does beg the question of what an identity function is, though. My contention is that an identity function is a do-nothing function

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 12:24 PM, Peter Otten wrote: identity((a, b, c)) calls identity() with one argument whereas identity(a, b, c) calls identity() with three arguments. That's certainly an effect; you just undo it with your test for len(args) == 1. That means that your identity() function throws aw

Re: Stackoverflow question: Is there a built-in identity function in Python?

2017-12-07 Thread Ethan Furman
On 12/07/2017 10:28 AM, Ethan Furman wrote: The simple answer is No, and all the answers agree on that point. It does beg the question of what an identity function is, though. Thankfully, Paul answered that question with a good explanation*. Thanks, everyone, for the discussion. -- ~Ethan

Re: we want python software

2017-12-08 Thread Ethan Furman
On 12/05/2017 09:27 PM, km wrote: [snip] Many things in this world are frustrating, but being hateful will not solve anything. Please control yourself. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Why does __ne__ exist?

2018-01-07 Thread Ethan Furman
On 01/07/2018 12:33 PM, Chris Angelico wrote: On Mon, Jan 8, 2018 at 7:13 AM, Thomas Jollans wrote: On 07/01/18 20:55, Chris Angelico wrote: Under what circumstances would you want "x != y" to be different from "not (x == y)" ? In numpy, __eq__ and __ne__ do not, in general, return bools.

Re: Why does __ne__ exist?

2018-01-07 Thread Ethan Furman
On 01/07/2018 04:31 PM, breamore...@gmail.com wrote: On Monday, January 8, 2018 at 12:02:09 AM UTC, Ethan Furman wrote: On 01/07/2018 12:33 PM, Chris Angelico wrote: On Mon, Jan 8, 2018 at 7:13 AM, Thomas Jollans wrote: On 07/01/18 20:55, Chris Angelico wrote: Under what circumstances

Re: Why does __ne__ exist?

2018-01-07 Thread Ethan Furman
On 01/07/2018 04:57 PM, Chris Angelico wrote: On Mon, Jan 8, 2018 at 11:35 AM, Ben Finney wrote: Chris Angelico writes: Let's put it this way. Suppose that __eq__ existed and __ne__ didn't, just like with __contains__. Go ahead: sell the notion of __ne__. Pitch it, show why we absolutely need

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread Ethan Furman
On 01/29/2018 02:41 PM, Steven D'Aprano wrote: On Mon, 29 Jan 2018 11:43:36 -0800, John Ladasky wrote: On Sunday, January 28, 2018 at 7:07:11 AM UTC-8, Steven D'Aprano wrote: (The day a programmer posts a WAV file of themselves reading their code out aloud, is the day I turn my modem off and

Re: Enums and nested classes

2022-04-21 Thread Ethan Furman
On 4/21/22 15:00, Greg Ewing wrote: On 20/04/22 10:57 pm, Sam Ezeh wrote: Has anyone here used or attempted to use a nested class inside an enum? If so, how did you find it? (what did you expect to happen and did your expectations align with resulting behaviour etc.) That's a pretty open-ende

Re: Style for docstring

2022-04-22 Thread Ethan Furman
On 4/22/22 12:36, Michael F. Stemper wrote:   Tells caller whether or not a permutation is even.   Determines if a permutation is even. (Alternative is that it's odd.)   Returns True if permutation is even, False if it is odd. Third option. -- ~Ethan~ -- https://mail.python.org/mailman/l

Async SIG post

2022-04-28 Thread Ethan Furman
Anybody interested in asynchronous programming may want to check out async-...@python.org as it has an interesting post about ASGI and PEPs 3156 and . Sign up at https://mail.python.org/mailman3/lists/async-sig.python.org/ and see the archive at https://mail.python.org/archiv

Re: mailbox misbehavior with non-ASCII

2022-07-29 Thread Ethan Furman
On 7/29/22 16:24, Peter Pearson wrote: > ... but if the apostrophe in "a'b" is replaced with a > RIGHT SINGLE QUOTATION MARK, the returned h is of type > "email.header.Header", and seems to contain inscrutable garbage. > > I'd think an exception would be the right answer. > > Is this worth a bug

Friendly Reminder

2022-12-20 Thread Ethan Furman
Greetings, all! I know our stress levels can be higher than normal around the holidays, but let's please be patient with each other. Both conversations and debates will be smoother if we assume other posters are asking/debating in good faith (at least, until proven otherwise). Happy Pythoning

Re: Possible re bug when using ".*"

2022-12-28 Thread Ethan Furman
On 12/28/22 11:07, MRAB wrote: On 2022-12-28 18:42, Alexander Richert - NOAA Affiliate via Python-list wrote:   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".

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Ethan Furman
On 1/10/23 12:03, Jen Kris via Python-list wrote: > I am writing a spot speedup in assembly language for a short but computation-intensive Python > loop, and I discovered something about Python array handling that I would like to clarify. > But on the next iteration we assign arr1 to something

Re: The Zen of D.E.K.

2023-01-13 Thread Ethan Furman
On 1/13/23 09:06, Stefan Ram wrote: >"Beautiful is better than ugly." - The Zen of Python > >This says nothing. You have to sacrifice something that >really has /value/! > >"[A]esthetics are more important than efficiency." - Donald E. Knuth [okay, falling for the troll bait] Th

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-29 Thread Ethan Furman
This thread has run its course and seems to now be generating more heat than light. It is now closed (at least on the Python List side). Thank you everyone for your participation and understanding. -- ~Ethan~ Moderator -- https://mail.python.org/mailman/listinfo/python-list

Re: Not receiving posts

2023-02-23 Thread Ethan Furman
On 2/23/23 12:29, Jim Byrnes wrote: > I have been reading the python-list for some time now. At first via gemane and since it's demise via a subscription. > Recently I noticed that I have not received any emails for quite sometime. > > I tried resubscribing but still have received no emails from

Hen Hanna & google groups

2023-02-27 Thread Ethan Furman
Greetings, all! As has been stated, Hen Hanna is posting through Google Groups, over which the Python List moderators have zero control. The only thing we can do, and which has now been done, is not allow those posts in to the Python List. -- ~Ethan~ Moderator -- https://mail.python.org/mailm

Re: Python 3.10 Fizzbuzz

2023-02-27 Thread Ethan Furman
On 2/27/23 12:20, rbowman wrote: > "By using Black, you agree to cede control over minutiae of hand- > formatting. In return, Black gives you speed, determinism, and freedom > from pycodestyle nagging about formatting. You will save time and mental > energy for more important matters." > > Someho

Re: Which more Pythonic - self.__class__ or type(self)?

2023-03-03 Thread Ethan Furman
On 3/3/23 03:32, Chris Angelico wrote: > On Fri, 3 Mar 2023 at 20:44, Alan Gauld wrote: >> On 02/03/2023 20:54, Ian Pilcher wrote: >>> Seems like an FAQ, and I've found a few things on StackOverflow that >>> discuss the technical differences in edge cases, but I haven't found >>> anything that ta

Re: why sqrt is not a built-in function?

2021-01-14 Thread Ethan Furman
On 1/14/21 9:44 AM, Denys Contant wrote: I don't understand why sqrt is not a built-in function. Why do we have to first import the function from the math module? I use it ALL THE TIME! And thousands, tens of thousands, and maybe hundreds of thousands don't. That felt good. Thank you. Any

Re: why sqrt is not a built-in function?

2021-01-14 Thread Ethan Furman
On 1/14/21 11:06 AM, Eli the Bearded wrote: "There should be one-- and preferably only one --obvious way to do it." Meanwhile, Alan Gauld pointed out: AG> because pow() is a builtin function and AG> root = pow(x,0.5) AG> is the same as AG> root = math.sqrt(x) Plus the ** operation

Re: help

2021-01-26 Thread Ethan Furman
On 1/26/21 9:05 AM, Terry Reedy wrote: On 1/26/2021 4:01 AM, Maziar Ghasemi wrote: ... Please do not repost, especially the same day. Maziar Ghasemi appears to be a new user, and had to sign up to the Python List mailing list. Are you seeing his request twice because you use gmane? --

Mr. Flibble

2021-02-15 Thread Ethan Furman
Thank you to those who pointed out this individual to the moderators. As Mr. Flibble accurately noted, he is not on the mailing list -- so his posts won't be here either. -- ~Ethan~ Python List Moderator -- https://mail.python.org/mailman/listinfo/python-list

Re: Mr. Flibble

2021-02-15 Thread Ethan Furman
On 2/15/21 2:02 PM, Grant Edwards wrote: On 2021-02-15, Ben Bacarisse wrote: You said you used Usenet (and your reply here was via Usenet). Usenet posts to comp.lang.python don't go to the mailing list (the "here" that Ethan is talking about). Mails to the list /are/ sent here, but it's one-w

Re: Python 2.7 and 3.9

2021-02-16 Thread Ethan Furman
On 2/16/21 12:09 PM, Kevin M. Wilson via Python-list wrote: My employer has hundreds of scripts in 2.7, but I'm writing new scripts in 3.9! I'm running into 'invalid syntax' errors.I have to maintain the 'Legacy' stuff, and I need to mod the path et al., to execute 3.7 w/o doing damage to the

Re: Python 2.7 and 3.9

2021-02-16 Thread Ethan Furman
Kevin, please reply to the list (preferably Reply-to-list, or Reply-all), that way others can chime in with help. On 2/16/21 12:55 PM, Kevin M. Wilson wrote: Windows 7 OS, and typically run in conjunction with testing SSD', as for stand alone scripts. Those require: python BogusFile.py. I too

name for a mutually inclusive relationship

2021-02-24 Thread Ethan Furman
I'm looking for a name for a group of options that, when one is specified, all of them must be specified. For contrast, - radio buttons: a group of options where only one can be specified (mutually exclusive) - check boxes: a group of options that are independent of each other (any number o

Re: name for a mutually inclusive relationship

2021-02-24 Thread Ethan Furman
On 2/24/21 8:28 AM, 2qdxy4rzwzuui...@potatochowder.com wrote: Entangled? Hey, I like that one! ;-) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: name for a mutually inclusive relationship

2021-02-24 Thread Ethan Furman
On 2/24/21 12:40 PM, Alan Gauld via Python-list wrote: On 24/02/2021 16:12, Ethan Furman wrote: I'm looking for a name for a group of options that, when one is specified, all of them must be specified. For contrast, - radio buttons: a group of options where only one can be spec

Re: name for a mutually inclusive relationship

2021-02-24 Thread Ethan Furman
On 2/24/21 1:23 PM, 2qdxy4rzwzuui...@potatochowder.com wrote: entangled (none or all): image size override: height width IMO, that's *one* option (-s 640x480 or -s 640,480), not two. In argparse/optparse terms, a required argument with a custom type. (OTOH, in a GUI, it'd be two sepa

Re: name for a mutually inclusive relationship

2021-02-24 Thread Ethan Furman
On 2/24/21 1:54 PM, 2qdxy4rzwzuui...@potatochowder.com wrote: Ethan Furman wrote: I didn't say it was a good example. ;-) Hopefully it gets the idea across. Ditto. ;-) IMO, the whole idea of "my program has two options, and the user has to specify both or neither," isn&

Re: name for a mutually inclusive relationship

2021-02-25 Thread Ethan Furman
On 2/25/21 7:06 PM, Joe Pfeiffer wrote: Ethan Furman writes: Like I said, at this moment I don't have a good example, only an awareness that such a thing could exist and I don't know the name for it (if it has one). So far I have seen that there are even fewer good use-cases th

editor recommendations?

2021-02-26 Thread Ethan Furman
I'm looking for an editor to use for Python programming, as well as related incidentals such as markdown files, restructured text, etc. I'm currently using vim, and the primary reason I've stuck with it for so long is because I can get truly black screens with it. By which I mean that I have

Re: Why assert is not a function?

2021-03-11 Thread Ethan Furman
On 3/11/21 1:45 PM, dn via Python-list wrote: Is assert so much faster/cheaper than try...except...raise? Infinitely faster when they are not there. ;-) Basically, you are looking at two different philosophies: - Always double check, get good error message when something fails vs - check

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-03-31 Thread Ethan Furman
On 3/31/21 4:14 PM, Chris Angelico wrote: I think this code makes some sort of argument in the debate about whether Python has too much flexibility or if it's the best metaprogramming toolset in the world. I'm not sure which side of the debate it falls on, though. Well, `__init_subclass__` is t

Re: How does "__doc__ % globals()" work?

2021-04-12 Thread Ethan Furman
On 4/12/21 3:06 PM, Jaime wrote: > Hi all. Line 102 of https://github.com/python/peps/blob/master/pep2html.py says: > > print(__doc__ % globals(), file=out) > > I realise that globals() is a standard-library > built-in function that returns a dictionary representing the current > global symbol ta

Re: do ya still use python?

2021-04-19 Thread Ethan Furman
On 4/19/21 11:22 AM, Unbreakable Disease wrote: [offensive drivel] List, my apologies -- not sure how that one got through. -- ~Ethan~ Python List Moderator -- https://mail.python.org/mailman/listinfo/python-list

Re: Unsubscribe/can't login

2021-05-05 Thread Ethan Furman
On 5/5/21 5:58 AM, Peter Otten wrote: > 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 >> Re

Re: [OT] Annoying message duplication, was Re: Unsubscribe/can't login

2021-05-05 Thread Ethan Furman
On 5/5/21 7:39 AM, Peter Otten 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 option from Thunderbird's context menu: Followup to

Re: Transistion from module to package and __init__.py

2021-05-05 Thread Ethan Furman
On 5/4/21 7:20 PM, Chris Nyland wrote: > Here is > where I my primary design question comes in. As organized now as described > to import and use the package I need > > from database import database > > or I have to put in the init file > > from database import * > > Either of these still leaves

Re: Proposal: Disconnect comp.lang.python from python-list

2021-05-06 Thread Ethan Furman
On 5/6/21 11:05 AM, Jon Ribbens via Python-list wrote: > On 2021-05-06, Stestagg wrote: >> Where's this discussion going? >> >> Which of the practically possible options are best for this list <-> >> newsgroup setup? > > And it appears even the suggestion that > Mailman 3 cannot be used while a g

Typing and Enum and Abstract

2021-05-20 Thread Ethan Furman
Here's a question on SO about typing, enum, and ABC: https://stackoverflow.com/q/67610562/208880 No answers so far. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

name for new Enum decorator

2021-05-27 Thread Ethan Furman
Greetings! The Flag type in the enum module has had some improvements, but I find it necessary to move one of those improvements into a decorator instead, and I'm having a hard time thinking up a name. What is the behavior? Well, a name in a flag type can be either canonical (it represents on

Re: Definition of "property"

2021-05-30 Thread Ethan Furman
On 5/30/21 9:57 AM, Irv Kalb wrote: > I understand what a "property" is, how it is used and the benefits, but apparently my explanation hasn't made the light bulb go on for my editor. My answer from Stackoverflow [1]: > Properties are a special kind of attribute. Basically, when Python encoun

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Ethan Furman
On 6/1/21 1:18 PM, Rich Shepard wrote: > I'd appreciate recommendations on the process to find where the bug lives > since I can't seem to find it with print() or line-by-line in pdb. Sounds like a console issue. Try using `logging` with a file... you could even use `print` with a file if you

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Ethan Furman
On 6/1/21 1:42 PM, Rich Shepard wrote: > When I run it this is the output: > $ python activitytypes.py 2021-06-01 13:39:10,219 -DEBUG - Start of Program > 2021-06-01 13:39:15,229 -DEBUG - End of Program Well, you only had two logging statements in that code -- logging is like print: if you want

Re: Verify independence and uniform distribution of discrete values in Python?

2021-07-09 Thread Ethan Furman
From Tim Peters: > `secrets` is just a wrapper around `random.SystemRandom`, so the > presence or absence of `secrets` doesn't matter. > > As to SystemRandom, all answers depend on the quality of the platform > os.urandom(), which Python has no control over. See my answer here, > and the comments

RFC for PEP 663: Improving and Standardizing Enum str(), repr(), and format() behaviors

2021-07-21 Thread Ethan Furman
PEP: 663 Title: Improving and Standardizing Enum str(), repr(), and format() behaviors Version: $Revision$ Last-Modified: $Date$ Author: Ethan Furman Discussions-To: python-...@python.org Status: Draft Type: Informational Content-Type: text/x-rst Created: 23-Feb-2013 Python-Version: 3.11 Post

Re: XML Considered Harmful

2021-09-21 Thread Ethan Furman
On 9/21/21 11:12 AM, Michael F. Stemper wrote: > It seems to me that XML is the right approach for this sort of > thing, especially since the data is hierarchical in nature. If you're looking for a format that you can read (as a human) and possibly hand-edit, check out NestedText: https://ne

Re: Subject: Re: Posts from gmane no longer allowed?

2021-09-26 Thread Ethan Furman
On 9/26/21 9:21 AM, Grant Edwards wrote: > On 2021-09-26, Chris Angelico wrote: >> I'm not sure whether the policy change happened on python-list, or at >> gmane. From the look of the error message you got, it may have >> actually been gmane's decision. Haven't heard anything from the list >> ad

Re: Posts from gmane no longer allowed?

2021-09-26 Thread Ethan Furman
On 9/26/21 10:34 AM, Grant Edwards wrote: > On 2021-09-26, Ethan Furman wrote: >> I am unaware of a change in the newsgroup <--> mailing list policy, >> and other newsgroup posts were coming through last week (it's been a >> light weekend). > > We're n

Re: New assignmens ...

2021-10-23 Thread Ethan Furman
On 10/23/21 6:42 AM, Jon Ribbens via Python-list wrote: > On 2021-10-23, Chris Angelico wrote: >> The onus is on you to show that it needs to be more flexible. > > Is it though? Yes. > It seems to me that the onus is on you to show that > this special case is special enough to be given its own

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Ethan Furman
On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: > It was already not a good name, but I am rewriting the class > completely, so now the name is a complete bumper. (No more timer.) I > am thinking about naming the class repeating_thread, but I cannot say > that I find it a very good name

Re: Best way to check if there is internet?

2022-02-07 Thread Ethan Furman
On 2/7/22 4:27 PM, Greg Ewing wrote: > On 8/02/22 8:51 am, Chris Angelico wrote: >> Some day, we'll have people on Mars. They won't have TCP connections - >> at least, not unless servers start supporting connection timeouts >> measured in minutes or hours - but it wouldn't surprise me if some >>

Re: Aw: PYT - How can I subscribe to a topic in the mailing list?

2022-02-27 Thread Ethan Furman
On 2/21/22 3:19 AM, vanyp wrote: > The option to filter by topic is offered in the mailing list subscription customization page, although > no option list is given. Topics may have been a project that was never implemented. Topics are not currently enabled. I suspect for them to be useful, pe

Re: Behavior of the for-else construct

2022-03-03 Thread Ethan Furman
On 3/3/22 5:32 PM, Rob Cliffe via Python-list wrote: > There are three types of programmer: those that can count, and those that can't. Actually, there are 10 types of programmer: those that can count in binary, and those that can't. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/pyt

PSA: Linux vulnerability

2022-03-08 Thread Ethan Furman
https://arstechnica.com/information-technology/2022/03/linux-has-been-bitten-by-its-most-high-severity-vulnerability-in-years/ -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-15 Thread Ethan Furman
On 4/15/22 04:19, Sam Ezeh wrote: Elsewhere, the idea of supporting new syntax to automatically initialise attributes provided as arguments to __init__ methods was raised. [...] Good post! You'll want to send this to python-ideas at some point (that's where most new python features are discu

Re: Why can't I define a variable like "miles_driven" with an underscore in Python 3.4.3 ?

2016-08-10 Thread Ethan Furman
On 08/10/2016 01:57 PM, Cai Gengyang wrote: Yea, using IDLE on OSX, Python 3.4.3. Yeah it works now ... I had to increase the font size and the indentation width. When that happened , it could define miles_driven I suspect you were defining it before, you just couldn't see the underscore. --

Re: Asynchronous programming

2016-08-13 Thread Ethan Furman
On 08/11/2016 07:14 AM, Steven D'Aprano wrote: On Thu, 11 Aug 2016 03:06 pm, Paul Rubin wrote: The basic characteristic of asynchronous programming is that it involves changing all your usual blocking i/o calls to non-blocking ones, so your program can keep running as soon as your request is st

Re: Asynchronous programming

2016-08-13 Thread Ethan Furman
On 08/11/2016 10:47 PM, Paul Rudin wrote: Steven D'Aprano writes: [...] In this case, all the work is pure computation, so I don't expect to save any time by doing this, because the work is still all being done in the same process/thread, not in parallel. It may even take a little bit longer,

<    1   2   3   4   5   6   7   8   9   10   >