Re: Comparing sequences with range objects

2022-04-10 Thread Dan Stromberg
It sounds a little like you're looking for interval arithmetic. Maybe https://pypi.org/project/python-intervals/1.5.3/ ? On Thu, Apr 7, 2022 at 4: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 conta

Re: Comparing sequences with range objects

2022-04-10 Thread Dan Stromberg
ing a bloom filter. EG: https://pypi.org/project/drs-bloom-filter/ On Sun, Apr 10, 2022 at 5:31 PM Dan Stromberg wrote: > > It sounds a little like you're looking for interval arithmetic. > > Maybe https://pypi.org/project/python-intervals/1.5.3/ ? > > On Thu, Apr 7, 2022 at

Re: Python app on a Mac

2022-04-15 Thread Dan Stromberg
On Fri, Apr 15, 2022 at 11:43 AM Alan Gauld wrote: > I've just migrated from a Linux PC to a Mac mini running Monterey. > I'm using a Mac for work lately. I miss Linux. I feel like MacOS isn't nearly as good at multimonitor setups as Cinnamon. Does anyone know how to launch a Python program fr

Signals and Threads in Python 3.5 or so

2016-10-09 Thread Dan Stromberg
I have a program http://stromberg.dnsalias.org/~dstromberg/looper/ that I use and maintain. It's like GNU parallel or similar - yet another "run n processes, m at a time" implementation. Interestingly, I've only used/tested it on Linux, but it's under a Microsoft copyright because Microsoft acqui

Re: Signals and Threads in Python 3.5 or so

2016-10-24 Thread Dan Stromberg
On Mon, Oct 10, 2016 at 12:05 AM, dieter wrote: > Dan Stromberg writes: >> I have a program http://stromberg.dnsalias.org/~dstromberg/looper/ >> that I use and maintain. >> >> It's like GNU parallel or similar - yet another "run n processes, m at >> a

Sphinx + autodoc + apidoc

2016-10-24 Thread Dan Stromberg
Hi folks. I'm attempting to set up Sphinx to document several API's based on docstrings. I've got something browseable for one example API using Sphinx + autodoc + apidoc. However, we aren't really a PEP8 shop; we use hard tabs expanded to 4 columns, and we use 120 columns total width (and somet

Re: sphinx (or other means to document python)

2016-10-24 Thread Dan Stromberg
On Sat, Sep 24, 2016 at 6:30 PM, Yann Kaiser wrote: > pydoctor may be something you're looking for. I don't know if it supports > exporting to PDF like Sphinx does. > > As you've no doubt figured out by now, Sphinx doesn't revolve around the > Python files themselves, but rather .rst files in whic

Re: Sphinx + autodoc + apidoc

2016-10-24 Thread Dan Stromberg
On Mon, Oct 24, 2016 at 2:39 PM, Ned Batchelder wrote: > On Monday, October 24, 2016 at 5:00:47 PM UTC-4, Dan Stromberg wrote: >> However, we aren't really a PEP8 shop; we use hard tabs expanded to 4 >> columns, and we use 120 columns total width (and sometimes a little >

Fwd: Problems with Anaconda and Pyzo

2016-11-14 Thread Dan Pineau
Hello, I'm a french student and I'm running Python 3.5.2 on windows. When I installed Anaconda3 4.2.0 version, Pyzo couldn't find a module named conda. Then I registered it as my default Python 3.5.2 version, but I couldn't use Pyzo anymore (I sent you a screenshot). So I tried to fix this problem

Re: Access to the caller's globals, not your own

2016-11-14 Thread Dan Sommers
f your use case. Yes, I'm willing to have missed something subtle (or not so subtle). Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Access to the caller's globals, not your own

2016-11-16 Thread Dan Sommers
On Thu, 17 Nov 2016 16:17:51 +1100, Steven D'Aprano wrote: > ... factory functions are great. But I'm saying that as the writer of > the library, not the user of the library. Can you imagine expecting > users to do this? > from math import trig > sin = trig.build('sine') > result = sin(0.1) No,

Re: Clickable hyperlinks

2017-01-03 Thread Dan Sommers
On Wed, 04 Jan 2017 16:40:00 +1100, Steven D'Aprano wrote: > On Wednesday 04 January 2017 15:46, Deborah Swanson wrote: > >> Steven D'Aprano wrote, on January 03, 2017 8:04 PM > [...] >>> Of course you have to put quotes around them to enter them in >>> your source code. >>> We don't expect this

Re: Clickable hyperlinks

2017-01-06 Thread Dan Sommers
On Wed, 04 Jan 2017 16:40:00 +1100, Steven D'Aprano wrote: > On Wednesday 04 January 2017 15:46, Deborah Swanson wrote: > >> Steven D'Aprano wrote, on January 03, 2017 8:04 PM > [...] >>> Of course you have to put quotes around them to enter them in >>> your source code. >>> We don't expect this t

Re: The hardest problem in computer science...

2017-01-06 Thread Dan Sommers
ne drawing characters," and took a slightly different approach (I think) to the command line argument(s): The default is ASCII, or you can specify -G to specify the VT100 line drawing characters (G for Graphic, I assume), or you can specify -U for the UTF-8 line drawing characters. Dan --

Re: How an editor can help with block nesting (was Re: How coding in Python is bad for you)

2017-01-24 Thread Dan Sommers
;t get out of the way and let me edit my own code get deleted). In Python, I prefer to get the indent right myself before I press ENTER. Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Dan Sommers
On Sat, 04 Feb 2017 12:56:58 -0600, Wildman wrote: > On Sat, 04 Feb 2017 18:25:03 +, Grant Edwards wrote: >> It allows a malicous user to put an evil executable someplace public >> like /tmp and have it executed accidentally. For example, let's say >> this executable file was named "sl" and

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Dan Sommers
On Sat, 04 Feb 2017 21:19:06 +0200, Marko Rauhamaa wrote: > Now, that's why the distros are careful to place $HOME/bin as the > final entry of PATH; the system commands take precedence over the > user's personal ones. However, the user is free to define the PATH any > way they like. I deliberatel

Re: Which part of the loop is it going through in this class frame?

2018-03-07 Thread Dan Stromberg
On Wed, Mar 7, 2018 at 1:57 PM, C W wrote: > I set time to 6:30, but it's coming out to 5:30. I guess it's because I > passed in 5:30, so, it's replaced? time and self.time are 2 different things. > How does line-by-line execution run inside a frame To quickly come to grips with execution order

Re: Which part of the loop is it going through in this class frame?

2018-03-07 Thread Dan Sommers
elf.time are not the same (at least not in Python; other languages may (and do) work differently). Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Which part of the loop is it going through in this class frame?

2018-03-07 Thread Dan Sommers
time() > 5:30 > > I set time to 6:30, but it's coming out to 5:30. I guess it's because I > passed in 5:30, so, it's replaced? Hint: in Python, self.time and time are not the same (unless you've played some sort of weird trick somewhere). Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Python gotcha of the day

2018-03-13 Thread Dan Sommers
x27; That's (a) a triple quoted string containing a single escaped quote, followed by (b) a quoted empty string. The two consecutive strings are concatenated into a single string. (Too many years of shell programming to miss this one!) Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: number of loops

2018-03-15 Thread Dan Stromberg
On Thu, Mar 15, 2018 at 8:25 AM, Bob Gailer wrote: > On Mar 15, 2018 9:30 AM, wrote: >> >> I would like to have this offer 6 guesses, but instead it gives one guess > and prints the if statement/output 6 timesany ideas where I went wrong? > > I suggest you conduct a walk-through. That means p

Re: Best practice for managing secrets (passwords, private keys) used by Python scripts running as daemons

2018-03-23 Thread Dan Stromberg
I'd put them in a file with access to the daemon.. Putting credentials in an environment variable is insecure on Linux, because ps auxwwe lists environment variables. On Fri, Mar 23, 2018 at 9:37 AM, Malcolm Greene wrote: > Looking for your suggestions on best practice techniques for managing >

Re: Since when builtin dict preserve key order?

2018-03-24 Thread Dan Stromberg
On Fri, Mar 23, 2018 at 9:34 PM, Arkadiusz Bulski wrote: > I already asked on PYPY and they confirmed that any version of pypy, > including 2.7, has dict preserving insertion order. I am familiar with > ordered **kw which was introduced in 3.6 but I also heard that builtin dict > preserves order s

Re: Code for Using Keyboard to Play music notes "ABCDEFG"

2018-03-25 Thread Dan Stromberg
I imagine pygame could do this, if you give it: https://freesound.org/people/pinkyfinger/packs/4409/ On Sun, Mar 25, 2018 at 1:31 PM, Bernard via Python-list wrote: > > Pyton Friends, > Do you have any code that will play the notes "ABCDEFG" from my computer > keyboard when a key is pressed ? Fo

Re: A question related to the PYTHONPATH

2018-03-26 Thread Dan Stromberg
On Sun, Mar 25, 2018 at 11:10 PM, dieter wrote: > adrien oyono writes: >> I have recently read the documentation about how imports work on python, >> and I was wondering why, when you execute a python file, the current >> directory is not added by default to the PYTHONPATH ? > > Maybe, to avoid s

Re:

2018-03-27 Thread Dan Stromberg
Please at least skim http://www.catb.org/esr/faqs/smart-questions.html On Tue, Mar 27, 2018 at 12:27 AM, kevon harris wrote: > Unable to pull up IDLE after downloading Python 3.6.4 -- https://mail.python.org/mailman/listinfo/python-list

Re: Pep8 for long pattern

2018-03-27 Thread Dan Stromberg
On Tue, Mar 27, 2018 at 8:18 AM, Michael Torrie wrote: > But when it's exactly what you need, why do > you need to shoehorn the expression into 79 characters? Seems pointless > in a case like this. PEP8 is a guideline, not an absolute rule. It's > okay to bend it a bit in cases like this. I thi

Re: Pep8 for long pattern

2018-03-27 Thread Dan Stromberg
On Tue, Mar 27, 2018 at 4:37 PM, Rick Johnson wrote: > On Tuesday, March 27, 2018 at 4:02:37 PM UTC-5, Dan Stromberg wrote: >> On Tue, Mar 27, 2018 at 8:18 AM, Michael Torrie wrote: >> > But when it's exactly what you need, why do you need to >> > shoehorn t

Re: String Formatting with new .format()

2018-03-28 Thread Dan Stromberg
On Wed, Mar 28, 2018 at 7:30 AM, Ganesh Pal wrote: >> >> Or maybe they're not giving the same result. I'm a little confused here. >> > > > My Bad and Apologies , I should be fined for pasting wrong question. > > Actually I wanted to know if its ok to use just empty {} with .format() > or use {

Re: Distributing Python virtual environments

2018-03-29 Thread Dan Stromberg
On Thu, Mar 29, 2018 at 7:06 AM, Malcolm Greene wrote: > We're using virtual environments with Python 3.6. Since all our pip > installed modules are in our environment's local site-packages folder, > is the distribution of a virtual environment as simple as recursively > zipping the environment's

Re: How to apply LR over gridded time series datasets ?

2018-03-29 Thread Dan Stromberg
On Wed, Mar 28, 2018 at 7:18 PM, wrote: > Hello all, > > This code is written for multivariate (multiple independent variables > x1,x2,x3..xn and a dependent variable y) time series analysis using logistic > regression (correlation and prediction). > This code is based on one point location (o

Re: Slow tarfile extract on armv7l Linux machine

2018-04-16 Thread Dan Stromberg
I'm not super-familiar with tarfile, though I did use it in one project. First off, note that CPython is commonly 4x slower than C. In fact, it can be much worse at times. Also... Have you considered trying your code on Pypy3? On Mon, Apr 16, 2018 at 9:10 AM, Jim MacArthur wrote: > Hi, I'm se

Fwd: Python Import Impossibility

2018-04-17 Thread Dan Stromberg
Given that the list does not allow pictures, would it make sense to have the software that strips the pictures also send an e-mail to the picture sender indicating that pictures are disallowed? I see a lot of people responding individually saying that images are stripped. It's looking like a bit

Re: error from Popen only when run from cron

2018-04-17 Thread Dan Stromberg
On Tue, Apr 17, 2018 at 4:11 PM, wrote: > W dniu sobota, 27 stycznia 2018 16:59:50 UTC+1 użytkownik larry@gmail.com > napisał: >> I have a script that does this: >> >> subprocess.Popen(['service', 'some_service', 'status'], >> stdout=subprocess.PIPE, stderr=subprocess.STDOUT) >> >> When I ru

Re: best way to remove leading zeros from a tuple like string

2018-05-23 Thread Dan Stromberg
On Sun, May 20, 2018 at 12:54 PM, wrote: > Lets say I have the following tuple like string. > (128, 020, 008, 255) > > What is the best way to to remove leading zeroes and end up with the > following. > (128, 20, 8, 255)-- I do not care about spaces > > This is the solution I came up

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-23 Thread Dan Stromberg
On Sat, May 19, 2018 at 3:58 PM, wrote: > On Thursday, 29 January 2009 12:09:29 UTC-5, Anjanesh Lekshminarayanan wrote: >> > It does auto-detect it as cp1252- look at the files in the traceback and >> > you'll see lib\encodings\cp1252.py. Since cp1252 seems to be the wrong >> > encoding, try ope

Re: why do I get syntax error on if : break

2018-05-25 Thread Dan Stromberg
On Thu, May 24, 2018 at 7:12 PM, wrote: > here is the code, i keep getting an error, "break outside loop". if it is > false just exit function > > > def d(idx): > if type(idx) != int: > break > > d('k') Not what you asked, but I believe pylint recommends using not isinstance instead

Re: Raw string statement (proposal)

2018-05-27 Thread Dan Stromberg
On Thu, May 24, 2018 at 9:34 PM, Mikhail V wrote: > Hi. > I've put some thoughts together, and > need some feedback on this proposal. > Main question is: Is it convincing? > Is there any flaw? > My own opinion - there IS something to chase. > Still the justification for such syntax is hard. > Th

Re: version

2018-06-01 Thread Dan Stromberg
On Fri, Jun 1, 2018 at 6:34 PM, Mike McClain wrote: > On Fri, Jun 01, 2018 at 08:02:27AM -0700, Mike McClain wrote: > > On Thu, May 31, 2018 at 07:44:35PM -0700, Mike McClain wrote: > > > > > Is there a way in a script to know which version of python is being > > > run so I can write: > > >

Re: Indented multi-line strings

2018-06-02 Thread Dan Stromberg
On Fri, Jun 1, 2018 at 2:57 PM, Chris Angelico wrote: > If you dislike adding features to a language on the basis that it > makes the language harder to learn, remember that you instead force > one of three even worse options: > > 1) Messy code because people unindent inside their source code, >

Re: Why exception from os.path.exists()?

2018-06-02 Thread Dan Stromberg
On Sat, Jun 2, 2018 at 4:28 AM, Chris Angelico wrote: > On Sat, Jun 2, 2018 at 9:13 PM, Steven D'Aprano > wrote: > > On Sat, 02 Jun 2018 20:58:43 +1000, Chris Angelico wrote: > Can someone confirm whether or not all the listed signals are actually > supported? We know that Ctrl-C maps to the int

Re: Indented multi-line strings

2018-06-02 Thread Dan Stromberg
On Sat, Jun 2, 2018 at 11:43 AM, Chris Angelico wrote: > >> 1) Messy code because people unindent inside their source code, > >> creating wonky indentation (which Python usually avoids) > >> > >> 2) Forcing readers to look up the third-party module you're using > >> before they can understand you

Re: syntax difference

2018-06-17 Thread Dan Stromberg
On Sun, Jun 17, 2018 at 1:23 PM, Marko Rauhamaa wrote: > Jim Lee : > > IMHO, trying to shoehorn static type checking on top of a dynamically > > typed language shows that the wrong language was chosen for the job. > > I'm also saddened by the type hinting initiative. When you try to be > best for

Re: Understanding memory location of Python variables

2018-06-17 Thread Dan Stromberg
On Sun, Jun 17, 2018 at 5:05 AM, Marko Rauhamaa wrote: > Bart : > > So, how /do/ you obtain the memory address of those values are > > located? For example, in order to pass it to some foreign C function > > that takes a void* parameter. > > That is dependent on the Python implementation. CPython

Re: syntax difference (type hints)

2018-06-18 Thread Dan Stromberg
On Mon, Jun 18, 2018 at 5:45 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Mon, 18 Jun 2018 14:57:30 +, Schachner, Joseph wrote: > > I believe the proposed type hints are only necessary > > for function definitions, > > What is the basis of this belief? How much exper

Re: syntax difference

2018-06-18 Thread Dan Stromberg
On Mon, Jun 18, 2018 at 5:52 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Mon, 18 Jun 2018 21:03:14 +0100, Bart wrote: > > > In the case of Python, it is > > already so big and has so many features crammed in that adding type > > hints probably makes little difference. >

Re: syntax difference

2018-06-18 Thread Dan Stromberg
On Mon, Jun 18, 2018 at 10:08 PM, Chris Angelico wrote: > On Tue, Jun 19, 2018 at 1:46 PM, Dan Stromberg > wrote: > > Great languages are small but extensible, easy to read, and don't require > > learning a lot before you can get started writing code or reading

Re: Writing an assembler in Python

2018-06-19 Thread Dan Stromberg
On Tue, Jun 19, 2018 at 7:33 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Tue, 19 Jun 2018 17:41:11 -0700, iansuderman wrote: > > > What does the code look like to insert assembler into python and how > > does that code send information back to python. > > > > It seems y

Re: moving to Python from Java/C++/C

2018-06-25 Thread Dan Stromberg
On Mon, Jun 25, 2018 at 3:40 AM, wrote: > Hey, > I already have quite an experience in programming, and I wish to study > Python as well. I need to study it before I continue with my comp. science > academic studies. > How do you recommend studying it? As mentioned in the headline, I already > kn

Re: moving to Python from Java/C++/C

2018-06-26 Thread Dan Stromberg
From: Dan Stromberg On Mon, Jun 25, 2018 at 3:40 AM, wrote: > Hey, > I already have quite an experience in programming, and I wish to study > Python as well. I need to study it before I continue with my comp. science > academic studies. > How do you recommend studying it? As m

Re: sigmoid function and derivative

2018-06-27 Thread Dan Stromberg
On Tue, Jun 26, 2018 at 8:26 PM, Sharan Basappa wrote: > Folks, > > I know this is not a machine learning forum but I wanted to see if anyone > can explain this to me. > > In artificial neural network, I can understand why sigmoid is used but I > see that derivative of sigmoid output function is

Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-27 Thread Dan Stromberg
On Wed, Jun 27, 2018 at 10:44 AM, T Berger wrote: > On Wednesday, June 27, 2018 at 1:40:20 PM UTC-4, Marko Rauhamaa wrote: > > Joaquin Henriquez : > > > > >>Subject: EXTERNAL: OSError: [Errno 48] Address already in use > > > > > > The best way to help if got you to put the relevant code here. > >

Re: OSError: [Errno 48] Address already in use

2018-06-28 Thread Dan Stromberg
On Wed, Jun 27, 2018 at 8:49 AM, T Berger wrote: > Why am I getting this error? I'm not sure what additional information I > need to supply, so please let me know. AIUI, there are 2 possible causes. You either have some other process listening on the requested port, or a process that Was using

Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-28 Thread Dan Stromberg
On Wed, Jun 27, 2018 at 10:31 PM, Marko Rauhamaa wrote: > Dan Stromberg : > >> > The problem can be solved by turning on the SO_REUSEADDR flag of > >> > the socket. > > BTW, it's a security feature you're turning off. If you're on a > >

Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-28 Thread Dan Stromberg
On Thu, Jun 28, 2018 at 1:27 PM, Marko Rauhamaa wrote: > Dan Stromberg : > > On Wed, Jun 27, 2018 at 10:31 PM, Marko Rauhamaa > wrote: > >> Dan Stromberg : > >> >> > The problem can be solved by turning on the SO_REUSEADDR flag of > >> >> &g

Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-29 Thread Dan Stromberg
On Thu, Jun 28, 2018 at 10:30 PM, Marko Rauhamaa wrote: > Well, the same security issue can be demonstrated without SO_REUSEADDR: > > The security issue can be real but is not directly related with > SO_REUSEADDR. > Yes, it can. It just takes longer. -- https://mail.python.org/mailman/listinfo

Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-30 Thread Dan Stromberg
On Sat, Jun 30, 2018 at 11:19 AM, Peter J. Holzer wrote: > On 2018-06-28 18:04:16 -0700, Dan Stromberg wrote: > > On Thu, Jun 28, 2018 at 1:27 PM, Marko Rauhamaa > wrote: > > Start an echo server process P that listens on tcp/. > > > > Initiate a connection fr

Re: Getting posts to sort chronologically in tree view

2018-07-02 Thread Dan Stromberg
On Mon, Jul 2, 2018 at 11:02 AM, T Berger wrote: > Is there any way to set posts to appear chronologically in tree view? And > why is the tree view completely out of order? My last two posts in this > view are from 6/27 and 6/28. > I'm thinking you may want to specify what software you're talkin

Re: PEP 526 - var annotations and the spirit of python

2018-07-02 Thread Dan Stromberg
On Sun, Jul 1, 2018 at 8:51 PM, Jim Lee wrote: > Languages that used to be small, lean, and exceptional at doing things > really well in a given domain have morphed into large, monolithic, bloated > language *systems* that do many things in many domains, and have many ways > to do the *same* thin

Re: PEP 526 - var annotations and the spirit of python

2018-07-02 Thread Dan Stromberg
On Mon, Jul 2, 2018 at 6:10 PM, Jim Lee wrote: > On 07/02/18 17:34, Dan Stromberg wrote: > > The fact of the matter is the economics have changed a lot since then. > Machine time used to be really expensive compared to developer time. > Today, it's the opposite: deve

Re: PEP 526 - var annotations and the spirit of python

2018-07-03 Thread Dan Stromberg
On Mon, Jul 2, 2018 at 5:51 PM, Tim Daneliuk wrote: > In particular, there is little interest in having programmers > learn on the job, only that they be as productive as possible > as fast they can. Hiring specific languages skills - the theory > goes - means that the individual will be fluent

Re: Unicode [was Re: Cult-like behaviour]

2018-07-16 Thread Dan Sommers
On Mon, 16 Jul 2018 10:39:49 +, Steven D'Aprano wrote: > ... people who think that if ISO-8859-7 was good enough for Jesus ... It may have been good enough for his disciples, but Jesus spoke Aramaic. Also, ISO-8859-7 doesn't cover ancient polytonic Greek; it only covers modern monotonic Gree

Re: Cult-like behaviour [was Re: Kindness]

2018-07-16 Thread Dan Sommers
On Tue, 17 Jul 2018 08:48:55 +1000, Chris Angelico wrote: > That said, though, the fact that indexing a byte string yields an int > instead of a one-byte string is basically unable to be changed now ... Agreed. > ... and IMO it'd be better to be consistent with text strings than > with bytearray

Re: pattern block expression matching

2018-07-21 Thread Dan Sommers
On Sat, 21 Jul 2018 17:37:00 +0100, MRAB wrote: > On 2018-07-21 15:20, aldi.kr...@gmail.com wrote: >> Hi, >> I have a long text, which tells me which files from a database were >> downloaded and which ones failed. The pattern is as follows (at the end of >> this post). Wrote a tiny program, but

Re: Pylint false positives

2018-08-17 Thread Dan Sommers
though, then those ten stubs tell me that I have to override them, and their docstrings tell me how. That is a huge improvement in long term maintainability. Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint false positives

2018-08-20 Thread Dan Sommers
; > (Not that I do this using "inner classes", but I do often want to use > a class as a container for functions, without caring about "self" or > wrapping everything in staticmethod.) Isn't that what modules are for? (I suspect that I'm missing

Re: Pylint false positives

2018-08-20 Thread Dan Sommers
On Mon, 20 Aug 2018 22:55:26 +0300, Marko Rauhamaa wrote: > Dan Sommers : > >> On Mon, 20 Aug 2018 14:39:38 +, Steven D'Aprano wrote: >>> I have often wished Python had proper namespaces, so I didn't have to >>> abuse classes as containers in this wa

Re: Help Needed : script weird result.

2018-09-01 Thread Dan Sommers
and the behavior. Script x = input ("Enter the numbers separated by space and press ENTER :") Think about what x is here, and what x.split does. x = x.split(" ") Now think about what x is again, and recall that Python is strongly typed. Dan -- https://mail.python.org/mai

Re: "glob.glob('weirdness')" Any thoughts?

2018-09-11 Thread Dan Sommers
=True/False. In their simplest form, the brackets match alternatives. For example, file[1234].text matches file1.text, file2.text, file3.text, and file4.text, but not file_something_else.text. Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] master/slave debate in Python

2018-09-24 Thread Dan Purgert
Robin Becker wrote: > [...] just thought control of the wrong sort.. Is there "thought control of the right sort"? -- |_|O|_| Registered Linux user #585947 |_|_|O| Github: https://github.com/dpurgert |O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281 -- https://mail.python.org/mai

Re: [OT] master/slave debate in Python

2018-09-26 Thread Dan Purgert
David Raymond wrote: > [...] > HAL.open(ship.pod_bay.doors) I'm sorry Dave, I'm afraid I can't do that. -- |_|O|_| Registered Linux user #585947 |_|_|O| Github: https://github.com/dpurgert |O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281 -- https://mail.python.org/mailman/listinf

Re: What's an elegant way to test for list index existing?

2018-09-29 Thread Dan Sommers
On 9/28/18 2:00 PM, Chris Green wrote: I have a list created by:- fld = shlex.split(ln) It may contain 3, 4 or 5 entries according to data read into ln. What's the neatest way of setting the fourth and fifth entries to an empty string if they don't (yet) exist? Using 'if len(fld) < 4:' fee

Re: python not working on RHEL6

2018-10-02 Thread Dan Purgert
Thomas Jollans wrote: > [...] (preferably, not in /usr - that's for OS-installed files only. > /usr/local is a nice place to put things you installed from source). While I agree that /usr(/bin) is incorrect, I believe that "for OS-installed files only" is taking it a bit far. My (admittedly, dim)

Re: python not working on RHEL6

2018-10-03 Thread Dan Purgert
Thomas Jollans wrote: > On 02/10/2018 19:22, Dan Purgert wrote: >> Thomas Jollans wrote: >>> [...] (preferably, not in /usr - that's for OS-installed files only. >>> /usr/local is a nice place to put things you installed from source). >> >> While I a

Re: python not working on RHEL6

2018-10-03 Thread Dan Purgert
Chris Angelico wrote: > On Wed, Oct 3, 2018 at 5:17 AM Thomas Jollans wrote: >> [...] >> Whether we agree on the terminology here or not, of course we can agree >> that you have to be bloody careful if you *do* decide to put things in >> /usr/bin yourself :-) > > [...] On my system (Debian GNU/Lin

Re: Observations on the List - "Be More Kind"

2018-10-10 Thread Dan Purgert
jf...@ms4.hinet.net wrote: > Chris Angelico at 2018.10.10 UTC+8 AM 10:31:33 wrote: >> On Wed, Oct 10, 2018 at 1:21 PM wrote: >> > [...] 3) Google group is a more free land to live. >> > >> > >> >> Well, just be aware that a lot of people block ALL posts that come >> from Google Groups. [...] > >

Re: Observations on the List - "Be More Kind"

2018-10-11 Thread Dan Purgert
Larry Martell wrote: > On Fri, Oct 5, 2018 at 6:54 AM Bruce Coram wrote: > [...] > We don't like you. We don't want you here. We never will. Save us all > the trouble and go away. That's the best code of conduct I've ever read ... 10/10, would read again. -- |_|O|_| Registered Linux user #58594

Re: Observations on the List - "Be More Kind"

2018-10-12 Thread Dan Purgert
Chris Angelico wrote: > On Fri, Oct 12, 2018 at 5:07 AM Ian Kelly wrote: >> >> On Thu, Oct 11, 2018 at 9:28 AM Dan Purgert wrote: >> > >> > Larry Martell wrote: >> > > On Fri, Oct 5, 2018 at 6:54 AM Bruce Coram >> > > wrote: >>

Re: [beginner] What's wrong?

2016-04-03 Thread Dan Sommers
English (and many other languages), it is wrong to spell my first name with an initial lower case letter. Therefore, Dan and dan are not, and should not be, the same identifier. ObPython: if my identifiers are case-insensitive, then what about the language's keywords? Can I spell class an

Re: [beginner] What's wrong?

2016-04-03 Thread Dan Sommers
On Sun, 03 Apr 2016 08:46:59 -0700, Rustom Mody wrote: > On Sunday, April 3, 2016 at 8:58:59 PM UTC+5:30, Dan Sommers wrote: >> Yes, it's marginally annoying, and a security hole waiting to happen, >> that A and A often look very much alike. > > "A security hole w

Re: [beginner] What's wrong?

2016-04-03 Thread Dan Sommers
On Sun, 03 Apr 2016 08:39:02 -0700, Rustom Mody wrote: > On Sunday, April 3, 2016 at 8:58:59 PM UTC+5:30, Dan Sommers wrote: >> On Sun, 03 Apr 2016 07:30:47 -0700, Rustom Mody wrote: >> >> > So here are some examples to illustrate what I am saying: >> >&g

Re: [beginner] What's wrong?

2016-04-03 Thread Dan Sommers
On Sun, 03 Apr 2016 10:18:45 -0700, Rustom Mody wrote: > On Sunday, April 3, 2016 at 9:56:24 PM UTC+5:30, Dan Sommers wrote: >> On Sun, 03 Apr 2016 08:39:02 -0700, Rustom Mody wrote: >> >> > On Sunday, April 3, 2016 at 8:58:59 PM UTC+5:30, Dan Sommers wrote: >> &

Re: [beginner] What's wrong?

2016-04-03 Thread Dan Sommers
On Sun, 03 Apr 2016 09:49:03 -0700, Rustom Mody wrote: > On Sunday, April 3, 2016 at 9:41:11 PM UTC+5:30, Dan Sommers wrote: >> On Sun, 03 Apr 2016 08:46:59 -0700, Rustom Mody wrote: >> >> > On Sunday, April 3, 2016 at 8:58:59 PM UTC+5:30, Dan Sommers wrote: >> &g

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Dan Sommers
On Mon, 11 Apr 2016 01:33:10 +0100, MRAB wrote: > There _is_ one exception though: (). It's the empty tuple (a 0-element > tuple). It doesn't have a comma and the parentheses are mandatory. > There's no other way to write it. The other way to write it is: tuple() -- https://mail.python.org/

Re: Convert input to upper case on screen as it is typed

2016-04-13 Thread Dan Sommers
e input driver does that for me. (Be careful; it's tricky at that point to "fix" your shell.) HTH, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Falsehoods People Believe about PEP 8 (was: Guido sees the light: PEP 8 updated)

2016-04-16 Thread Dan Sommers
On Sat, 16 Apr 2016 16:44:30 -0400, Random832 wrote: > On Sat, Apr 16, 2016, at 16:21, Ben Finney wrote: >> * Oh, come on, no-one would use U+000C FORM FEED in source code. > > Some text editors have shortcuts to navigate to the previous/next line > that begins with a form feed. Add these to the

Re: Falsehoods People Believe about PEP 8 (was: Guido sees the light: PEP 8 updated)

2016-04-16 Thread Dan Sommers
On Sun, 17 Apr 2016 07:34:20 +1000, Chris Angelico wrote: > On Sun, Apr 17, 2016 at 7:22 AM, Dan Sommers wrote: >> On Sat, 16 Apr 2016 16:44:30 -0400, Random832 wrote: >> >>> On Sat, Apr 16, 2016, at 16:21, Ben Finney wrote: >>>> * Oh, come on, no-one would

Re: Falsehoods People Believe about PEP 8 (was: Guido sees the light: PEP 8 updated)

2016-04-16 Thread Dan Sommers
On Sun, 17 Apr 2016 11:48:11 +1000, Steven D'Aprano wrote: > On Sun, 17 Apr 2016 09:35 am, Dan Sommers wrote: > >> We (this mailing list, or maybe it was the python-ideas mailing list) >> just had a thread about non-ASCII characters in identifiers. One of >> the

Re: Python path and append

2016-04-25 Thread Dan Sommers
On Tue, 26 Apr 2016 11:51:23 +1000, Steven D'Aprano wrote: > ... (Possible a few very old operating systems on supercomputers from > the 1970s or 80s may have supported inserting... I seem to recall that > VMS may have allowed that... but don't quote me.) Some [non-supercomputer] OSes/filesystems

Re: Pylint prefers list comprehension over filter...

2016-05-05 Thread Dan Sommers
On Thu, 05 May 2016 18:37:11 -0700, Stephen Hansen wrote: > ''.join(x for x in string if x.isupper()) > The difference is, both filter and your list comprehension *build a > list* which is not needed, and wasteful. The above skips building a > list, instead returning a generator ... filter u

Re: Pylint prefers list comprehension over filter...

2016-05-05 Thread Dan Sommers
On Fri, 06 May 2016 02:46:22 +, Dan Sommers wrote: > Python 2.7.11+ (default, Apr 17 2016, 14:00:29) > [GCC 5.3.1 20160409] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >

Re: pylint woes

2016-05-08 Thread Dan Sommers
e to some other module and not notice that you don't have > a verbosity check at the top, and then wonder why disabling verbose > doesn't fully work. Both problems are solved by having a dedicated > spam function, which will simply error out if you didn't set it up &g

Re: Is there a reason zip() wipes out data?

2016-05-08 Thread Dan Sommers
On Mon, 09 May 2016 00:22:46 -0400, DFS wrote: > python 2.7.11 docs: "The returned list is truncated in length to the > length of the shortest argument sequence." > > > a = ['who','let','the'] > b = ['dogs','out?'] > c = zip(a,b) > > print c > [('who', 'dogs'), ('let', 'out?')] > > > Wouldn'

Re: Summing/combining tuples

2016-05-20 Thread Dan Sommers
sum(map(itemgetter(2), v)), sum(map(itemgetter(3), v))) for (k, v) in [(k, list(v)) for (k, v) in groupby(aList, itemgetter(1))]]) Shorter? In terms of number of expressions, yes. In terms of characters typed, no. Sweeter? YMMV. HTH, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Summing/combining tuples

2016-05-20 Thread Dan Sommers
On Sat, 21 May 2016 03:19:49 +, Dan Sommers wrote: >> Is there something shorter and sweeter for the summation? > > from itertools import groupby > from operator import itemgetter > > result = [(k, >sum(map(itemgetter(2), v)), >

Re: for / while else doesn't make sense

2016-06-06 Thread Dan Sommers
On Mon, 06 Jun 2016 17:51:24 -0700, Lawrence D’Oliveiro wrote: > It is nice to have a common, versatile looping form which can be > arranged in different ways to suit the problem at hand. That’s why I > like the C-style for-statement. [example snipped] I used to write a lot of assembly code, for

Re: for / while else doesn't make sense

2016-06-07 Thread Dan Sommers
On Tue, 07 Jun 2016 00:53:31 -0700, Lawrence D’Oliveiro wrote: > On Tuesday, June 7, 2016 at 3:34:39 PM UTC+12, Dan Sommers wrote: > >> I used to write a lot of assembly code, for a lot of different CPUs, and >> they all had a common, versatile looping form which co

Re: Unexpected NANs in complex arithmetic

2016-06-21 Thread Dan Sommers
On Wed, 22 Jun 2016 12:57:55 +1000, Chris Angelico wrote: > On Wed, Jun 22, 2016 at 12:48 PM, Steven D'Aprano wrote: >> I'm doing some arithmetic on complex numbers involving INFs, and getting >> unexpected NANs. >> >> py> INF = float('inf') >> py> z = INF + 3j >> py> z >> (inf+3j) [...] >> Is

Re: Unexpected NANs in complex arithmetic

2016-06-22 Thread Dan Sommers
On Wed, 22 Jun 2016 16:30:49 +1000, Chris Angelico wrote: > On Wed, Jun 22, 2016 at 4:17 PM, Steven D'Aprano > wrote: >> On Wednesday 22 June 2016 13:54, Dan Sommers wrote: >> >>> By the time Python returns a result for inf+3j, you're already in >>

<    3   4   5   6   7   8   9   10   11   12   >