Re: OT: Addition of a .= operator

2023-06-09 Thread Simon Ward via Python-list
On Wed, May 24, 2023 at 05:18:52PM +1200, dn via Python-list wrote: Note that the line numbers correctly show the true cause of the problem, despite both of them being ValueErrors. So if you have to debug this sort of thing, make sure the key parts are on separate lines (even if they're all one

ipaddress (was: Re: for a 'good python')

2023-04-21 Thread Simon Ward
On Thu, Apr 13, 2023 at 04:00:59PM +0100, Barry wrote: Ipaddress was developed outside of the std lib and later added i recall. I used it prior to it being in the standard library: https://pypi.org/project/ipaddr/ Simon -- A complex system that works is invariably found to have evolved from

Re: Friday finking: IDE 'macro expansions'

2023-03-17 Thread Simon Ward
On Fri, Mar 17, 2023 at 02:05:50PM +0100, Roel Schroeven wrote: Even better than simply highlighting is (IMO) a thing called "Rainbow Braces" or "Bracket Pair Colorization" I recently learned about: both braces of a matching pair get the same color, while other pairs get other colors. I have

Re: Friday finking: IDE 'macro expansions'

2023-03-17 Thread Simon Ward
On Fri, Mar 17, 2023 at 11:55:38AM +1300, dn via Python-list wrote: Do you make use of your IDE's expansionist tendencies, and if-so, which ones? Unix (well, GNU/Linux) is my IDE ;) Simon -- https://mail.python.org/mailman/listinfo/python-list

Re: Implementing a plug-in mechanism

2023-03-16 Thread Simon Ward
On Thu, Mar 16, 2023 at 07:45:18AM +1300, dn via Python-list wrote: There is a PyPi library called pluggy (not used it). I've used informal approaches using an ABC as a framework/reminder (see @George's response). typing.Protocol is also useful here as the plugin interface can be defined

Re: Distributing program for Linux

2023-03-14 Thread Simon Ward
On Tue, Mar 14, 2023 at 04:43:14PM +0100, Loris Bennett wrote: If I write a system program which has Python >= 3.y as a dependency, what are the options for someone whose Linux distribution provides Python 3.x, where x < y? The docs suggest creating your own package or building and installing

Re: Baffled by readline module

2023-03-10 Thread Simon Ward
On Fri, Mar 10, 2023 at 06:37:56AM -0800, Grant Edwards wrote: On 2023-03-10, Weatherby,Gerard wrote: I'll have to remember that one. It doesn't really fit my current use case, but there are others where it would work nicely. However, cmd.Cmd does not provide command recall and editing.

Re: Python 3.10 Fizzbuzz

2023-03-01 Thread Simon Ward
On Tue, Feb 28, 2023 at 04:05:19PM -0500, avi.e.gr...@gmail.com wrote: Is it rude to name something "black" to make it hard for some of us to remind them of the rules or claim that our personal style is so often the opposite that it should be called "white" or at least shade of gray? The

RE: Python application launcher (for Python code)

2017-02-20 Thread Simon Ward
On 20 February 2017 22:56:31 GMT+00:00, Deborah Swanson wrote: > Basically, I now have quite a few Python programs I use frequently, > and > as time goes on my collection and uses of it will grow. Right now I > just > want a way to select which one I'd like to run

Re: numpy arrays

2016-03-23 Thread Simon Ward
On 23 March 2016 10:06:56 GMT+00:00, Heli wrote: >Hi, > >I have a 2D numpy array like this: > >[[1,2,3,4], > [1,2,3,4], > [1,2,3,4] > [1,2,3,4]] > >Is there any fast way to convert this array to > >[[1,1,1,1], > [2,2,2,2] > [3,3,3,3] > [4,4,4,4]] Use the transpose()

Re: Continuing indentation

2016-03-04 Thread Simon Ward
On 4 March 2016 23:31:43 GMT+00:00, Erik wrote: >On 04/03/16 21:14, sohcahto...@gmail.com wrote: >> You guys are spending way too much time fighting over something that >is clearly subjective. Nobody is "correct" here. There's no right and >wrong, just simple

Re: Bug!

2015-08-23 Thread Simon Ward
On 23 August 2015 00:06:44 BST, Chris Angelico ros...@gmail.com wrote: Precisely. Every time you support multiple versions of some dependency, you have to test your code on all of them, and in the common case (new features added in newer versions), you have to target the oldest and weakest

Re: Query on Python 3.2 and supported OpenSSL Versions

2015-05-25 Thread Simon Ward
On Mon, May 25, 2015 at 09:33:06AM +, Donal Duane wrote: Hi Python Users, I was hoping you might be able to assist me with a query: 2 Questions: 1. Could Python 3.2, when compiled against OpenSSL 1.0.0j, be affected by the poodle bug?

Re: Python Worst Practices

2015-02-27 Thread Simon Ward
On 26 February 2015 21:23:34 GMT+00:00, Ben Finney ben+pyt...@benfinney.id.au wrote: Simon Ward simon+pyt...@bleah.co.uk writes: 0 = success and non-zero = failure is the meme established, rather than 0 = true, non-zero = false. That is not the case: the commands ‘true’ (returns value 0

Re: Python Worst Practices

2015-02-27 Thread Simon Ward
On 27 February 2015 20:06:25 GMT+00:00, I wrote: I mentioned the true and false. OK, so it's a meme, but it's based on a false (pun intended) understanding of exit status codes. That success evaluates to true and failure evaluates to false does not mean the values of truth and falseness are

Re: Python Worst Practices

2015-02-27 Thread Simon Ward
On 27 February 2015 20:06:25 GMT+00:00, Simon Ward simon+pyt...@bleah.co.uk wrote: I mentioned the true and false. OK, so it's a meme, but it's based on a false (pun intended) understanding of exit status codes. That success evaluates to true and failure evaluates to false does not mean

Re: Python Worst Practices

2015-02-26 Thread Simon Ward
On 25 February 2015 21:24:37 GMT+00:00, Chris Angelico ros...@gmail.com wrote: On Thu, Feb 26, 2015 at 7:45 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: http://www.slideshare.net/pydanny/python-worst-practices Any that should be added to this list? Any that be removed as not that bad?

Re: Python Worst Practices

2015-02-26 Thread Simon Ward
On 26 February 2015 00:11:24 GMT+00:00, Ben Finney ben+pyt...@benfinney.id.au wrote: Yes, but my point is: You shouldn't need to rebind those names (or have names true and false for 0 and 1). That's not what you asked, though. You asked “When would 0 mean true and 1 mean false?” My answer:

Re: Tabs for indentation Spaces for alignment in Python 3?

2014-12-06 Thread Simon Ward
On 6 December 2014 03:04:48 GMT+00:00, Michael Torrie torr...@gmail.com wrote: On 12/05/2014 07:31 PM, Ned Batchelder wrote: This is a perfect example! The code (with tabs as --- and leading spaces as .) is: ---if (!list_empty(pending)) --ret =

Re: [OT] spelling colour / color was Re: Toggle

2014-10-11 Thread Simon Ward
On 11 October 2014 10:37:51 BST, Christian Gollwitzer aurio...@gmx.de wrote: I tend to agree that British English is the correct version for me, since I'm European, though not British. The usage of -ise in verbs, however, is a newer attempt to set the British English apart from the American:

Re: Teaching Python

2014-09-29 Thread Simon Ward
On 29 September 2014 14:18:31 BST, Gabor Urban urbang...@gmail.com wrote: my 11 years old son and his classmate told me, that they would like to learn Python. They did some programming in Logo and turtle graphics, bat not too much. Doesn anybody has an idea how to start? How to Think Like a

Re: Global indent

2014-08-22 Thread Simon Ward
On 22 August 2014 19:44:39 BST, Neil D. Cerutti ne...@norwich.edu wrote: This sort of simple task [indenting blocks of text] is why fancy text editors were invented. I use and recommend gvim (press in select mode using the standard python plugin), but there are plenty of options out there.

Re: PEP8 and 4 spaces

2014-07-04 Thread Simon Ward
On 4 July 2014 15:54:50 BST, Marko Rauhamaa ma...@pacujo.net wrote: Even if we accepted that to be bad style, there's nothing on the screen that would warn against such usage: the lines seemingly align perfectly, and the code runs as expected. If using vim, set list and listchars, you get to

Re: PEP8 and 4 spaces

2014-07-03 Thread Simon Ward
On 3 July 2014 18:31:04 BST, Tobiah tshep...@rcsreg.com wrote: Coworker takes PEP8 as gospel and uses 4 spaces to indent. I prefer tabs. Boss want's us to unify. This isn't worth arguing about. Pick a convention, it's probably going to be a compromise, get used to it. PEP8 is as good a base

Re: Python's re module and genealogy problem

2014-06-11 Thread Simon Ward
On 11 June 2014 13:23:14 BST, BrJohan brjo...@gmail.com wrote: For some genealogical purposes I consider using Python's re module. Rather many names can be spelled in a number of similar ways, and in order to match names even if they are spelled differently, I will build regular expressions,