Re: Can math.atan2 return INF?

2016-06-22 Thread Dan Sommers
On Thu, 23 Jun 2016 13:59:46 +1000, Steven D'Aprano wrote: > Given: > > x = INF > y = INF > assert x == y > > there is a reason to pick atan2(y, x) = pi/4: > > Since x == y, the answer should be the same as for any other pair of x == y. When x == y == 0, then atan2(y, x) is 0. -- https://mail

Re: bottledaemon stop/start doesn't work if killed elsewhere

2018-11-18 Thread Dan Sommers
On 11/18/18 1:21 PM, MRAB wrote:> On 2018-11-18 17:50, Adam Funk wrote: >> Hi, >> >> I'm using bottledaemon to run a little REST service on a Pi that takes >> input from other machines on the LAN and stores stuff in a database. >> I have a cron job to call 'stop' and 'start' on it daily, just in c

Re: on the prng behind random.random()

2018-11-19 Thread Dan Sommers
On 11/19/18 6:49 PM, Robert Girault wrote: > I think I disagree with your take here. With mt19937, given ANY seed, > I can eventually predict all the sequence without having to query the > oracle any further. Even if that's true, and I use mt19937 inside my program, you don't [usually|necessari

Re: Question about implementing immutability

2018-11-21 Thread Dan Sommers
On 11/21/18 11:45 AM, Iwo Herka wrote: Hello, Let's say I want to implement immutability for user-defined class. More precisely, a class that can be modified only in its (or its super-class') __init__ method. My initial idea was to do it the following fashion: def __setattr__(self, *args,

Re: Odd truth result with in and ==

2018-11-21 Thread Dan Sommers
On 11/21/18 6:45 PM, Ian Kelly wrote: > On Wed, Nov 21, 2018 at 2:53 PM Serhiy Storchaka wrote: >> >> 21.11.18 22:17, Cameron Simpson пише: >>> Can someone show me a real world, or failing that - sane looking, >>> chained comparison using "in"? >> >> s[0] == s[-1] in '\'"' >> >> Tests tha

Re: Odd truth result with in and ==

2018-11-21 Thread Dan Sommers
On 11/21/18 7:09 PM, Chris Angelico wrote: > On Thu, Nov 22, 2018 at 11:04 AM Dan Sommers > <2qdxy4rzwzuui...@potatochowder.com> wrote: >> But the second one has to do an expensive subset operation. If I think >> "is elem in both sets," then I'd never writ

Re: ValueError vs IndexError, unpacking arguments with string.split

2018-11-30 Thread Dan Sommers
before failing part way through. Effectively, Python is saying that you can't unpack a one-element array into two pieces *before* it gets to the indexing logic. HTH, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: ValueError vs IndexError, unpacking arguments with string.split

2018-11-30 Thread Dan Sommers
On 11/30/18 10:57 AM, Morten W. Petersen wrote: > On Fri, Nov 30, 2018 at 4:25 PM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: >> Python validates that the right hand side contains exactly the right >> number of elements before beginning to unpack, p

Re: ValueError vs IndexError, unpacking arguments with string.split

2018-11-30 Thread Dan Sommers
On 11/30/18 12:00 PM, Morten W. Petersen wrote: > I guess syntax could be added, so that > > a, b, @c = some sequence > > would initialize a and b, and leave anything remaining in c. We could > then call this @ syntax "teh snek". Close. ;-) Try this: a, b, *c = [4, 5, 6, 7] -- https://ma

Re: Are all items in list the same?

2019-01-08 Thread Dan Sommers
t;>> would that still not return true if the list was a palindrome? >> ignore me, just tried & ok >> > > You were right the first time. The above comparison should have been > > a == a[::-1] > > A palindrome will pass. Let's find out (vertical space

Re: Exercize to understand from three numbers which is more high

2019-01-25 Thread Dan Purgert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 ^Bart wrote: > > if number1 > number2 and number1 > number3: > print("Max number is: ",number1) > > if number2 > number1 and number2 > number3: > print("Max number is: ",number2) > > else: > print("Max number is: ",number3) > > Try

Re: Exercize to understand from three numbers which is more high

2019-01-29 Thread Dan Sommers
On 1/29/19 9:27 AM, Jack Dangler wrote: wow. Seems like a lot going on. You have 3 ints and need to determine the max? Doesn't this work? N1, N2, N3 if N1>N2   if N1>N3     MaxNum = N1 elif N2>N3   MaxNum = N2 elif N1 No. Assuing that you meant to include colons where I think you did, wh

Re: Instance of 'dict' has no 'replace' member

2019-02-01 Thread Dan Sommers
#x27;re trying to replace strings inside particular dict entries; perhaps you meant something like this: querystring["key"] = querystring["key"].replace("placeholder", "value") HTH, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Switch function

2019-02-03 Thread Dan Sommers
On 2/3/19 5:40 PM, Avi Gross wrote: Bottom line, does anyone bother using anything like this? It is actually a bunch of hidden IF statements matched in order but may meet many needs. I sure don't. In the rare case that I might use a switch statement in another language, I just use a series of

Re: Switch function

2019-02-03 Thread Dan Sommers
On 2/3/19 9:03 PM, Avi Gross wrote: > The example I show above could in many cases be done as you describe > but what are you gaining? > > I mean if I subtract the integer representation of a keyboard > alphabetic letter (ASCII for the example) from letter 'a' or 'A' then > A maps to 0 and B maps

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Dan Sommers
ithin mine. Optionally, instead of separate calls to xxyy, set a flag and only call xxyy at the end if the flag is set. Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Why float('Nan') == float('Nan') is False

2019-02-13 Thread Dan Sommers
On 2/13/19 7:21 AM, ast wrote: Hello >>> float('Nan') == float('Nan') False Why ? Because the IEEE-754 Standard demands it, and people smarter than I worked on the IEEE-754 Standard. is a quick starting point for a deeper dive. -- https://mail.python.org/

Re: Why float('Nan') == float('Nan') is False

2019-02-13 Thread Dan Sommers
On 2/13/19 1:53 PM, Grant Edwards wrote: Floating point is sort of the quantum mechanics of computer science. At first glance, it seems sort of weird. But after you work with it a while, it gets even worse. Yep! :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: revisiting the "What am I running on?" question

2019-02-17 Thread Dan Sommers
On 2/17/19 8:46 PM, songbird wrote: simply put. if i'm running on a computer and i don't easily know why kind of computer how can i answer this in a quick way without getting overly complicated that also will cover most of the easy cases? i came up with this: comments? additions? c

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Dan Sommers
On 2/27/19 9:37 AM, Dave wrote: I have two Python 3 (3.6) apps that will get the full GUI treatment very soon. I'm in the process of choosing a GUI, and that may be where you/your book can help. Seems this is not a trivial effort (wishing that Python was like VB6 from the 90's). Anyway, here

Re: Not Defined error in basic code

2019-03-14 Thread Dan Sommers
On 3/14/19 9:05 AM, Jack Dangler wrote: Just getting started with tutorials and such, and don't understand this - class weapon:     weaponId     manufacturerName The previous two lines attempt to refer to existing names, but neither name exists.     def printWeaponInfo(self):  

Re: subprocess svn checkout password issue

2019-03-16 Thread Dan Sommers
On 3/16/19 1:50 AM, Martin De Kauwe wrote: On Saturday, 16 March 2019 16:50:23 UTC+11, dieter wrote: Martin De Kauwe writes: > I'm trying to write a script that will make a checkout from a svn repo and build the result for the user. However, when I attempt to interface with the shell it asks

Re: Can my python program send me a text message?

2019-03-19 Thread Dan Sommers
ail-to-SMS gateways. Most of them will be HTTP-based APIs, so you will do well to use the "requests" module. Send email over SMTP; use Python's standard smtplib module. Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: What does "TypeError: unsupported operand type(s) for +: 'function' and 'int'" mean?

2019-03-25 Thread Dan Sommers
On 3/25/19 2:30 PM, CrazyVideoGamez wrote: I have no idea what "TypeError: unsupported operand type(s) for +: 'function' and 'int'" means It means that you're trying to add an int to a function. > ... and I don't know how to fix it. Help! Don't do that? It's possible that with the correct c

Re: Library for parsing binary structures

2019-03-29 Thread Dan Sommers
On 3/29/19 12:13 PM, Peter J. Holzer wrote: Obviously you need some way to describe the specific binary format you want to parse - in other words, a grammar. The library could then use the grammar to parse the input - either by interpreting it directly, or by generating (Python) code from it. Th

Re: How call method from a method in same class?

2019-04-01 Thread Dan Sommers
On 4/1/19 10:02 PM, Dave wrote: def validScale(self, scaleName): if scaleName.upper == 'F' or 'C' or 'K': return True else: return False def convertTemp(self): """ Converts temperature scale if scales valid.""" if v

Re: Function to determine list max without itertools

2019-04-19 Thread Dan Sommers
n't a float or an int? For instance, what if the list is ['a', 'b', 'c']? What about ['a', 'b', 3]? Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Accumulate , Range and Zeros

2019-07-13 Thread Dan Sommers
an and the output that it produced. (2) What is range(5)? Okay, what is list(range(5))? What do you (the person) get when you multiply those five integers together? HTH, Dan -- https://mail.python.org/mailman/listinfo/python-list

Counting Python threads vs C/C++ threads

2019-07-16 Thread Dan Stromberg
I'm looking at a performance problem in a large CPython 2.x/3.x codebase with quite a few dependencies. I'm not sure what's causing the slowness yet. The CPU isn't getting hit hard, and I/O on the system appears to be low - but throughput is poor. I'm wondering if it could be CPU-bound Python thr

Re: Counting Python threads vs C/C++ threads

2019-07-16 Thread Dan Stromberg
On Tue, Jul 16, 2019 at 11:13 AM Barry Scott wrote: > I'm going to assume you are on linux. > Yes, I am. Ubuntu 16.04.6 LTS sometimes, Mint 19.1 other times. On 16 Jul 2019, at 18:35, Dan Stromberg wrote: > > > > I'm looking at a performance problem in a la

Re: Proper shebang for python3

2019-07-25 Thread Dan Sommers
ys, but my current Linux PATH is just $HOME/bin, $HOME/local/bin, and /usr/bin. Get Off My Lawn, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Boolean comparison & PEP8

2019-07-29 Thread Dan Sommers
d its notion of truthiness make this algorithm natural. Perhaps a better name is path_to_shell, but I'd still end up with: if path_to_shell: execute_program(path_to_shell, ...) else: raise NoShellException() Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: if bytes != str:

2019-08-04 Thread Dan Sommers
On 8/4/19 10:56 AM, Hongyi Zhao wrote: Hi, I read and learn the the following code now: https://github.com/shadowsocksr-backup/shadowsocksr-libev/blob/master/src/ ssrlink.py In this script, there are the following two customized functions: -- def to_bytes(s): if bytes != str:

Re: Python help needed

2019-08-08 Thread Dan Sommers
nal list is "spam and eggs": >>> spam = ['apples', 'spam and eggs', 'bananas', 'tofu', 'cats'] >>> s = " and ".join(spam) >>> s.replace(" and ", ", ", len(spam) - 2) # except the last 'apples, spam, eggs, bananas and tofu and cats' Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: String slices

2019-08-09 Thread Dan Sommers
On 8/9/19 10:13 AM, Paul St George wrote: In the code (below) I want a new line like this: Plane rotation X: 0.0 Plane rotation Y: 0.0 Plane rotation Z: 0.0 But not like this: Plane rotation X: 0.0 Plane rotation Y: 0.0 Plane rotation Z: 0.0 Is it possible? (I am using Python 3.5 within Blend

Re: Which editor is suited for view a python package's source?

2019-08-19 Thread Dan Stromberg
Uh oh. Editor wars. The most popular choices today are probably PyCharm and VSCode. I prefer vim with the syntastic plugin (and a few other plugins including Jedi), but I've heard good things about the other two. And emacs almost certainly can edit/view Python files well, though I haven't heard

Re: Your IDE's?

2019-08-19 Thread Dan Stromberg
I just mentioned essentially this in another thread, but I really like vim with syntastic and jedi plus a few other plugins. I keep all my vim config at http://stromberg.dnsalias.org/svn/vimrc/trunk/ so it's easy to set up a new machine. I haven't used it on anything but Debian/Ubuntu/Mint recent

Re: itertools cycle() docs question

2019-08-21 Thread Dan Sommers
le loop is infinite. Dan On Wed, Aug 21, 2019 at 2:30 PM Tobiah wrote: In the docs for itertools.cycle() there is a bit of equivalent code given: def cycle(iterable): # cycle('ABCD') --> A B C D A B C D A B C D ... saved = [] for element in iterable:

Re: fileinput module not yielding expected results

2019-09-07 Thread Dan Sommers
On 9/7/19 11:12 AM, Jason Friedman wrote: $ grep "File number" ~/result | sort | uniq File number: 3 I expected that last grep to yield: File number: 1 File number: 2 File number: 3 File number: 4 File number: 5 File number: 6 As per https://docs.python.org/3/library/fileinput.html#fileinput.

Re: Spread a statement over various lines

2019-09-17 Thread Dan Sommers
On 9/17/19 2:59 PM, Manfred Lotz wrote: > def regex_from_filepat(fpat): > rfpat = fpat.replace('.', '\\.') \ >.replace('%', '.') \ >.replace('*', '.*') > > return '^' + rfpat + '$' > > As I don't want to have the replace() functions in on

Re: Recursive method in class

2019-09-27 Thread Dan Sommers
On 9/27/19 7:54 AM, ast wrote: Hello Is it feasible to define a recursive method in a class ? (I don't need it, it's just a trial) Here are failing codes: class Test: def fib(self, n): if n < 2: return n return fib(self, n-2) + fib(self, n-1) return self.fib(n

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 4:28 AM, Barry Scott wrote: On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: Should pathlib reflect changes it has made to the file-system? I think it should not. A Path() is the name of a file it is not the file itself. Why should it track changes in the file system f

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 8:40 AM, Barry Scott wrote: > > >> On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: >> >> On 9/30/19 4:28 AM, Barry Scott wrote: >>>> On 30 Sep 2019, at 05:40, DL Neil via Python-list wrote: >>

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 10:33 AM, Barry Scott wrote: On 30 Sep 2019, at 14:20, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com <mailto:2qdxy4rzwzuui...@potatochowder.com>> wrote: That's the wording I read.  I inferred that "path-handling operations which don't actually ac

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 12:51 PM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: In the totality of a Path object that claims to represent paths to files, including the arguably troublesome read_bytes and write_bytes methods, and a rename

Re: pathlib

2019-09-30 Thread Dan Sommers
On 9/30/19 3:56 PM, Barry Scott wrote: On 30 Sep 2019, at 16:49, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com <mailto:2qdxy4rzwzuui...@potatochowder.com>> wrote: In the totality of a Path object that claims to represent paths to files, It represents string that *should* i

Re: pathlib

2019-10-02 Thread Dan Sommers
On 10/2/19 4:14 AM, DL Neil via Python-list wrote: In the case that sparked this enquiry, and in most others, there is no need for a path that doesn't actually lead somewhere. The paths that are used, identify files, open them, rename them, create directories, etc. The idea of a path that just '

Re: pathlib

2019-10-03 Thread Dan Sommers
On 10/2/19 6:58 PM, DL Neil via Python-list wrote: > On 3/10/19 12:42 AM, Dan Sommers wrote: > Certainly, although some may have quietly given-up talking to a > non-OOP native - and one so 'slow', I am appreciative of all > help-given! I also speak OO as a second lan

Re: Python 3.6 on Windows - does a python3 alias get created by installation?

2019-10-09 Thread Dan Purgert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Malcolm Greene wrote: > I'm jumping between Linux, Mac and Windows environments. On Linux and > Mac we can invoke Python via python3 but on Windows it appears that > only python works. Interestingly, Windows supports both pip and pip3 > flavors. Am I

Artifact repository?

2019-10-31 Thread Dan Stromberg
Hi folks. Can anyone please recommend an opensource "Artifact Repository" suitable for use with CPython, including dozens of wheels, tar.gz's and .py's? By an Artifact Repository, I mean something that can version largish binaries that are mostly produced by a build process. It doesn't necessari

Speeding up a test process with a local pypi and/or web proxy?

2019-11-15 Thread Dan Stromberg
Hi folks. I'm looking at a test process that takes about 16 minutes for a full run. Naturally, I'd like to speed it up. We've already parallelized it - mostly. It seems like the next thing to look at is setting up a local pypi, and building some of the packages that're compiled from C/C++ every

Re: What do you use for slides?

2019-11-15 Thread Dan Stromberg
I mostly use Libreoffice Impress, but I've also tried Google Slides. I don't think Impress does syntax highlighting out of the box, but there's a plugin that claims to. Also, Google Slides purportedly supports highlighting just by cut-and-pasting from a GUI editor/IDE with syntax highlighting. H

Re: low-level csv

2019-11-17 Thread Dan Sommers
that would allow for this using a csv.reader and csv.writer but that would be some convoluted code. Anyone some suggestions? Wrap your string in a list; csv.reader takes an iterator: s = "some, string, with, commas" r = csv.reader([s]) for x in r: p

Re: Speeding up a test process with a local pypi and/or web proxy?

2019-11-19 Thread Dan Stromberg
On Fri, Nov 15, 2019 at 1:11 PM Dan Stromberg wrote: > Hi folks. > > I'm looking at a test process that takes about 16 minutes for a full run. > Anyone? > Naturally, I'd like to speed it up. We've already parallelized it - > mostly. > > It seems like th

Re: IOError: cannot open resource

2019-12-07 Thread Dan Sommers
On 12/7/19 9:43 AM, RobH wrote: When I run a python project with an oled display on a rasperry pi zero, it calls for the Minecraftia.ttf font. I have the said file in home/pi/.fonts/ Do you mean /home/pi/.fonts (with a leading slash, an absolute path rather than a relative one)? Dan -- https

Re: urllib unqoute providing string mismatch between string found using os.walk (Python3)

2019-12-21 Thread Dan Sommers
ive string? I'm going to guess that the trailing characters are newline (U+0010) and/or carriage return (U+001D) characters. Use str.strip() to remove them before comparing: a = a.strip() Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Grepping words for match in a file

2019-12-28 Thread Dan Sommers
ant to match "ADD" instructions, you'll have to use word.startswith or some other method to separate the "ADD" from the ".MOV." Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Grepping words for match in a file

2019-12-28 Thread Dan Sommers
On 12/28/19 12:29 AM, Mahmood Naderan via Python-list wrote: Hi I have some lines in a text file like ADD R1, R2 ADD3 R4, R5, R6 ADD.MOV R1, R2, [0x10] If I grep words with this code for line in fp: if my_word in line: Then if my_word is "ADD", I get 3 matches. However, if I grep word with t

Re: Friday Finking: Source code organisation

2019-12-28 Thread Dan Sommers
at aren't "def"ed notwithstanding), even when it calls some other method in the class? Dan -- https://mail.python.org/mailman/listinfo/python-list

With distutils, "optional" C extension module error is fatal

2019-12-29 Thread Dan Stromberg
Hi folks. I'm putting a little time into getting my treap module (like a dict, but always sorted by key) working with distutils. I want it to be able to compile and install the Cython version from an included .c file, or to fall back on a pure python version if that fails. I'm currently using: s

Re: Threading

2020-01-24 Thread Dan Sommers
(for whatever definition of job you have) from a queue. Once > the queue is exhausted, the threads terminate cleanly, and then you > can join() each thread to wait for the entire queue to be completed. Or use a thread pool: https://docs.python.org/3/library/concurrent.futures.html D

Re: Nested Loop Code Help

2020-01-26 Thread Dan Purgert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 ferzan saglam wrote: > Hello people, I have written the code below which works fine, but it > has one small problem. Instead of printing one (x) on the first line, > it prints two. > I have tried everything in my knowledge, but cannot fix the problem

Re: Suggestions on mechanism or existing code - maintain persistence of file download history

2020-01-29 Thread Dan Sommers
; digits of the hash in the file name, so > http://some.domain.example/some/path/filename.html might get saved > into "a39321604c - filename.html". That way, if you want to know if > it's been downloaded already, you just hash the URL and see if any > file begins with those dig

Re: Was: Dynamic Data type assignment

2020-01-30 Thread Dan Sommers
trings to parser.parse_args instead of letting that function default to the list of command line arguments. ¹ e.g., https://docs.python.org/3/library/argparse.html#parents Dan -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.pyth

Re: Suggestions on mechanism or existing code - maintain persistence of file download history

2020-01-30 Thread Dan Sommers
e words C, Fortran, and Common Lisp crossed out and Python and ACID Database written in crayon. Dan -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.python.org/mailman/listinfo/python-list

Re: What I learned today

2020-02-14 Thread Dan Stromberg
On Fri, Feb 14, 2020 at 3:10 PM Stefan Ram wrote: > By trial and error (never read documentation!) I found > that you can count the number of e's in a text by just > > Counter( text ).get( 'e' ) > > (after »from collections import Counter« that is). > Even simpler, though not suitable for a

Re: iterate through an irregular nested list in Python

2020-03-06 Thread Dan Stromberg
On Fri, Mar 6, 2020 at 6:55 AM Pieter van Oostrum wrote: > sinnd...@gmail.com writes: > > > Hi All, > > I am new to python. > > I have a irregular nested lists in a list. > > Please help me to iterate through each element. > > > > Thanks much in advance. > > > > Sample Ex > > > > aList = [[2,'jkj

Re: iterate through an irregular nested list in Python

2020-03-06 Thread Dan Stromberg
On Fri, Mar 6, 2020 at 6:55 AM Pieter van Oostrum wrote: > sinnd...@gmail.com writes: > > > Hi All, > > I am new to python. > > I have a irregular nested lists in a list. > > Please help me to iterate through each element. > > > > Thanks much in advance. > > > > Sample Ex > > > > aList = [[2,'jk

Re: iterate through an irregular nested list in Python

2020-03-06 Thread Dan Stromberg
On Fri, Mar 6, 2020 at 6:55 AM Pieter van Oostrum wrote: > sinnd...@gmail.com writes: > > > Hi All, > > I am new to python. > > I have a irregular nested lists in a list. > > Please help me to iterate through each element. > > > > Thanks much in advance. > > > > Sample Ex > > > > aList = [[2,'jk

Re: iterate through an irregular nested list in Python

2020-03-07 Thread Dan Stromberg
On Fri, Mar 6, 2020 at 6:55 AM Pieter van Oostrum wrote: > sinnd...@gmail.com writes: > > > Hi All, > > I am new to python. > > I have a irregular nested lists in a list. > > Please help me to iterate through each element. > > > > Thanks much in advance. > > > > Sample Ex > > > > aList = [[2,'jk

Re: Installation of python

2020-03-10 Thread Dan Stromberg
On Mon, Mar 9, 2020 at 7:20 AM Tim Ko wrote: > Hello, > > I am trying to install a custom Python package but ran into an error. The > error presumably associated with cython. I tried a different compiler since > Intel compiler often crashes when using cython, but couldn't get it > working. > Does

Re: How to build python binaries including external modules

2020-03-18 Thread Dan Stromberg
I'm not completely sure I understand what the question is. You can 'python3 -m pip install cython'. You can use a shell/powershell wrapper that invokes the two things in series. Does that help? On Wed, Mar 18, 2020 at 4:10 PM James via Python-list < python-list@python.org> wrote: > When you bu

Re: How to build python binaries including external modules

2020-03-18 Thread Dan Stromberg
Wed, Mar 18, 2020 at 4:50 PM Dan Stromberg wrote: > > I'm not completely sure I understand what the question is. > > You can 'python3 -m pip install cython'. > > You can use a shell/powershell wrapper that invokes the two things in > series. > > Does that

Re: PEP Idea: Multi-get for lists/tuples and dictionaries (inspired in NumPy)

2020-03-19 Thread Dan Stromberg
On Thu, Mar 19, 2020 at 7:47 AM Peter J. Holzer wrote: > On 2020-03-19 14:24:35 +, Rhodri James wrote: > > On 19/03/2020 13:00, Peter J. Holzer wrote: > > > It's more compact, especially, if "d" isn't a one-character variable, > > > but an expression: > > > > > > fname, lname = > db[peop

Re: queue versus list

2020-03-20 Thread Dan Stromberg
On Thu, Mar 19, 2020 at 6:11 PM Cameron Simpson wrote: > >> 4. If it doesn't need to be thread-safe, why not try deques instead? > > > >Bingo. Performance is indistinguishable from that of the list. > > A deque is implement using a list. > Actually, I think a deque is a doubly linked list of pyt

Re: queue versus list

2020-03-20 Thread Dan Sommers
On Fri, 20 Mar 2020 06:50:29 -0700 Dan Stromberg wrote: > On Thu, Mar 19, 2020 at 6:11 PM Cameron Simpson wrote: > > > >> 4. If it doesn't need to be thread-safe, why not try deques instead? > > > > > >Bingo. Performance is indistinguishable from that

yield from

2020-03-24 Thread Dan Stromberg
Some time ago, when I first heard about yield from, it wasn't faster than a for loop yielding. Has that improved? -- https://mail.python.org/mailman/listinfo/python-list

Re: How come logging.error writes to a file, but not logging.debug or logging.info?

2020-03-27 Thread Dan Campbell
Got it. I had to set the minimum level, in the basic config, thus: logging.basicConfig( filename = "whatthe.log", level=logging.INFO ) All set, thanks for the tip. Regards, DC On Thu, Mar 26, 2020 at 5:35 PM Cameron Simpson wrote: > On 26Mar2020 14:02, dcwhat...@gmail.com wrote: > >Wh

Re: How come logging.error writes to a file, but not logging.debug or logging.info?

2020-03-27 Thread Dan Campbell
Cameron, thanks. I read something similar elsewhere, but I don't understand what levels to set, and how many times. Are we saying that we execute root_logger = logging.getLogger() root_logger.setLevel(1) #Or some other level , prior to running logging.basicConfig(...), for each typ

Re: Confusing textwrap parameters, and request for RE help

2020-03-27 Thread Dan Stromberg
On Fri, Mar 27, 2020 at 1:23 PM Grant Edwards wrote: > On 2020-03-26, Chris Angelico wrote: > > > You know what's a lot more fun? Perfect block justification, no ragged > > edges, no extra internal spaces. I'm not sure whether it's MORE > > annoying or LESS than using internal spaces, but it's c

Re: Confusing textwrap parameters, and request for RE help

2020-03-27 Thread Dan Sommers
On Fri, 27 Mar 2020 15:46:54 -0600 Michael Torrie wrote: > On 3/27/20 3:28 PM, Dan Stromberg wrote: > > Back when I was a kid, and wordprocessors were exemplified by > > WordStar, I heard about a study the conclusion of which was that > > aligned right edges were harder

Re: How come logging.error writes to a file, but not logging.debug or logging.info?

2020-03-28 Thread Dan Campbell
I probably won't need to do that, in this case. But good advice, in other contexts ; I'll put it in the pim, for further reference, thanks. On Fri, Mar 27, 2020 at 7:09 PM Cameron Simpson wrote: > On 27Mar2020 16:18, Dan Campbell wrote: > >Got it. I had to set the mi

Re: python script to give a list of prime no.

2020-04-05 Thread Dan Sommers
if a%i == 0: # once we found a divisor, it is no use to continue break else: # magic here! print(a) a = a + 2 The Time Machine Strikes Again, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Floating point problem

2020-04-18 Thread Dan Sommers
le.com/cd/E19957-01/806-3568/ncg_goldberg.html; YMMV. Yes, it's highly technical, but well worth the effort. Or an extended session at the feet of the timbot, which is much harder to come by. Dan -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.python.org/mailman/listinfo/python-list

What user-defined request error levels are recommended?

2020-04-30 Thread Dan Campbell
Hi, what range of error codes are recommended, if we wanted to return a user-defined code? Obviously, we don't want to use a code in the 200+ range, or the 400+ range, e.g. I want to throw, or just return, a code that represents that the size of a web page (len(response.content)) is less than

Re: What user-defined request error levels are recommended?

2020-04-30 Thread Dan Campbell
On Thursday, April 30, 2020 at 4:42:41 PM UTC-4, Ed Leafe wrote: > On Apr 30, 2020, at 15:14, dc wrote: > > > > Hi, what range of error codes are recommended, if we wanted to return a > > user-defined code? > > > > Obviously, we don't want to use a code in the 200+ range, or the 400+ > > range,

Re: What user-defined request error levels are recommended?

2020-04-30 Thread Dan Sommers
On Thu, 30 Apr 2020 13:14:42 -0700 (PDT) Dan Campbell wrote: > Hi, what range of error codes are recommended, if we wanted to return > a user-defined code? > Obviously, we don't want to use a code in the 200+ range, or the 400+ > range, e.g. > I want to throw, or just

Re: =+ for strings

2020-05-03 Thread Dan Sommers
;.format(day) > > Why can't I do the shortcut on strings? ITYM: dt += "{:02d}".format(day) Note += rather than =+ (which is parsed as an assignment operator followed by a unary plus operator). -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.python.org/mailman/listinfo/python-list

Re: why no camelCase in PEP 8?

2020-05-18 Thread Dan Sommers
On Tue, 19 May 2020 09:55:04 +1200 Juergen Brendel wrote: > ... he prefers snake-case. That's not snake_case. That's kebab-case.¹ ¹ https://wiki.c2.com/?KebabCase -- https://mail.python.org/mailman/listinfo/python-list

Re: exiting a while loop

2020-05-22 Thread Dan Sommers
> n += 1 > > print("\n", n, "terms are required.") -- “Atoms are not things.” – Werner Heisenberg Dan Sommers, http://www.tombstonezero.net/dan -- https://mail.python.org/mailman/listinfo/python-list

Re: How to design a class that will listen on stdin?

2020-05-23 Thread Dan Sommers
On Saturday, May 23, 2020, at 07:24 -0400, zljubi...@gmail.com wrote: > I have to talk to outer system by stdin/stdout. > Each line that comes to stdin should be processed and its result returned > back to stdout. Logging should go to stderr. > > How to design a class that will listed to stdin

Re: Subprocess Connection Error

2020-10-17 Thread Dan Stromberg
Does this help? https://stackoverflow.com/questions/29567051/python-error-idles-subprocess-didnt-make-connection-either-idle-cant-start On Sat, Oct 17, 2020 at 12:44 PM Dave Dungan via Python-list < python-list@python.org> wrote: > Hello, > > I bought a book called Coding for Beginners to learn

Re: GUI: I am also looking for a nudge into the best (GUI) direction.

2020-10-29 Thread Dan Stromberg
On Thu, Oct 29, 2020 at 4:48 PM Ethan Furman wrote: > On 10/29/20 11:30 AM, Igor Korot wrote: > > > If you have any further questions you can contact me directly. > > Please do not. By keeping the discussion on the list many people can > participate and learn. > This list isn't terribly overnois

Re: Best way to determine user's screensize?

2020-10-31 Thread Dan Stromberg
On Sat, Oct 31, 2020 at 4:18 PM Peter J. Holzer wrote: > On 2020-10-31 17:12:36 -0500, 2qdxy4rzwzuui...@potatochowder.com wrote: > > On 2020-10-31 at 19:24:34 +0100, > > "Peter J. Holzer" wrote: > > > On 2020-10-31 11:58:41 -0500, 2qdxy4rzwzuui...@potatochowder.com > wrote: > > > > I never claim

Re: Getting rid of virtual environments with a better dependency system

2020-11-11 Thread Dan Stromberg
On Wed, Nov 11, 2020 at 3:00 AM j c wrote: > Hello all, > > I don't know if this suggestion is missing some point, or it's part of > something already proposed before. > > In a professional environment, we've came to a point in which most people > use virtual environments or code environments to

Re: Getting rid of virtual environments with a better dependency system

2020-11-11 Thread Dan Stromberg
On Wed, Nov 11, 2020 at 10:38 AM Chris Angelico wrote: > On Thu, Nov 12, 2020 at 4:35 AM Dan Stromberg wrote: > > > > On Wed, Nov 11, 2020 at 3:00 AM j c wrote: > > > > > Hello all, > > > > > > I don't know if this suggestion is missin

Re: Debugging native cython module with visual studio toolchain

2020-11-14 Thread Dan Stromberg
I can happily say I haven't used a Microsoft compiler/linker in decades, but: 1) Maybe clang-cl will do what you want? 2) Maybe it'd be easier to put debugging print's/printf's/cout <<'s in your code? HTH On Sat, Nov 14, 2020 at 1:55 PM Jeff wrote: > > > > Hi, > > > > We developed a Python modu

Re: ssl connection has been closed unexpectedly

2020-11-29 Thread Dan Stromberg
What happens if you execute this from a shell prompt on a system with openssl installed? openssl s_client -connect host.com:443 (replacing host.com with your server's hostname and 443 with your port of interest) On Sat, Nov 28, 2020 at 3:30 PM Shaozhong SHI wrote: > Hi, > > I keep getting the

Re: problem in installation of python 3.9.0

2020-12-02 Thread Dan Stromberg
On Wed, Dec 2, 2020 at 9:45 AM Mats Wichmann wrote: > On 12/2/20 10:57 AM, Priyankgasree K wrote: > > Hello, > > I am Priyankgasree, i am facing problem in installing > python3.9.0. > > after i finish download it always says you have to repair or uninstall. I > > have repaired and uninst

Re: Fw: See example

2020-12-04 Thread Dan Stromberg
On Fri, Dec 4, 2020 at 12:01 PM dn via Python-list wrote: > On 05/12/2020 07:57, Arthur R. Ott wrote: > ... > > > Microsoft Windows [Version 10.0.19042.630] > > (c) 2020 Microsoft Corporation. All rights reserved. > > I am sure you can help me > > From the Windows10 command li

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