Re: Why does __ne__ exist?

2018-01-08 Thread Thomas Nyberg
On 01/08/2018 12:36 PM, Thomas Jollans wrote: > > Interesting sentence from that PEP: > > "3. The == and != operators are not assumed to be each other's > complement (e.g. IEEE 754 floating point numbers do not satisfy this)." > > Does anybody here know how

Re: Why does __ne__ exist?

2018-01-08 Thread Thomas Nyberg
On 01/08/2018 03:25 PM, Oren Ben-Kiki wrote: > I am hard pressed to think of a case where __ne__ is actually useful. Assuming you're talking about a case specifically for IEEE 754, I'm starting to agree. In general, however, it certainly is useful for some numpy objects (as mentioned elsewhere in

Re: Why does __ne__ exist?

2018-01-08 Thread Thomas Jollans
ing and say that _if_ one specifies a single > __cmp__ method, it should return one of LT, EQ, GT, and this will > automatically give rise to all the comparison operators. This used to be the case. (from version 2.1 to version 2.7, AFAICT) > > "Trade-offs... trafe-offs as far as the

Re: How to create "transitional" package?

2018-01-09 Thread Thomas Jollans
On 09/01/18 05:09, INADA Naoki wrote: > Hi, all. > > Yesterday, I released msgpack-0.5, which was msgpack-python. > Both packages provide "msgpack" python package. > > I used msgpack in early days, but easy_install crawling website > and download msgpack-1.0.0.tar.gz, which is msgpack for C inste

Re: pyplot: change the number of x labels (from 6)

2018-01-10 Thread Thomas Jollans
On 2018-01-10 05:22, Paulo da Silva wrote: > Hi all. > > I want to have dates as major ticks labels of X axis. > This fragment of code works fine except that I need more dates to appear > instead the 6 I am getting. The number of dates in dtsd is for ex. 262. > > Thanks for any help. > > BTW, I

Re: Simple graphic library for beginners

2018-01-10 Thread Thomas Jollans
c) graphs and figures, go matplotlib. It's not the nicest library, but it's powerful and well-represented on stack overflow. If you want buttons and stuff, go for PyQt or Tkinter. Both are messy and complicated, and Tkinter looks terrible by default, but that's just the way it is. -- Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Pandas printing in jupyter

2018-01-11 Thread Thomas Jollans
On 2018-01-11 09:59, Rustom Mody wrote: > On Thursday, January 11, 2018 at 2:13:46 PM UTC+5:30, Paul Moore wrote: >> The HTML representation is supplied by the object's _repr_html_ >> method. See https://ipython.org/ipython-doc/3/config/integrating.html >> for some details. >> > import pandas

Re: Generating SVG from turtle graphics

2018-01-12 Thread Thomas Jollans
On 2018-01-11 12:03, Steven D'Aprano wrote: > I'd like to draw something with turtle, then generate a SVG file from it. > > Is this possible? > > If not, is there something I can do which lets me plot lines, shapes and > curves and output to SVG? > > Ideally, I'd like to draw a figure pixel by

Re: requests / SSL blocks forever?

2018-01-13 Thread Thomas Jollans
the server is simply not sending a response (because it's waiting for you to send more data, or whatever) but *is* keeping the TCP connection alive - this could make sense. Are you setting a timeout? -- Thomas > > It is possible that there are network outages on this machine, but I

pip --user by default

2018-01-13 Thread Thomas Jollans
kages - into the user directories if possible - into the environment when in an environment by default? Thanks, Thomas * the path obviously depends on the OS: https://pip.pypa.io/en/stable/user_guide/#config-file -- https://mail.python.org/mailman/listinfo/python-list

Re: Where is the usage of (list comprehension) documented?

2018-01-15 Thread Thomas Jollans
On 2018-01-15 00:01, Peng Yu wrote: > Hi, > > I see the following usage of list comprehension can generate a > generator. Does anybody know where this is documented? Thanks. > > $ cat main.py > #!/usr/bin/env python > > import sys > lines = (line.rstrip('\n') for line in sys.stdin) > print lines

Re: pip --user by default

2018-01-15 Thread Thomas Jollans
On 2018-01-15 18:33, Rob Gaddi wrote: > > Inside of a virtualenv, what's the difference between a --user install > and a system one? > It errors out: % pip install --user urllib3 Can not perform a '--user' install. User site-packages are not visible in this virtualenv. -- https://mail.pyth

Re: pip --user by default

2018-01-15 Thread Thomas Jollans
ally interpreted the term > "virtual environment" in a fairly generic way. > > Skip > I just tried that and it turns out that that installs the package into the main anaconda/miniconda installation rather than the conda env. Definitely not what you want. -- Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Anaconda installation problem

2018-01-19 Thread Thomas Jollans
On 2018-01-19 05:47, Jingshen Tai (jingshen) wrote: > > Hi, > > When I was installing windows Anaconda 3 64 bit, there is a pop up window > saying that the 'python program is closing'. I ignored it and continued the > installation. > > When the Anaconda Prompt is launched, I have this error p

Re: Fourth example from PEP 342

2018-01-20 Thread Thomas Jollans
value = coroutine.throw(value,*exc) else: value = coroutine.send(value) Now, listen on is running again and has the value yielded by nonblocking_accept. I wish I knew how exactly nonblocking_accept was supposed to work here, but that's beside the point as the world of Python corout

Re: Can't get python running

2018-01-21 Thread Thomas Jollans
On 21/01/18 02:52, Chris Angelico wrote: > On Sun, Jan 21, 2018 at 12:40 PM, bartc wrote: >> On 21/01/2018 01:21, Chris Angelico wrote: >>> >>> On Sun, Jan 21, 2018 at 12:08 PM, bartc wrote: On 20/01/2018 17:16, Jim Sadler wrote: > > > I downloaded python 3.6.4 and although

Re: How to reset system proxy using pyhton code

2018-02-19 Thread Thomas Jollans
XDG_SESSION_DESKTOP') print('removing') del os.environ['XDG_SESSION_DESKTOP'] os.system('echo desktop $XDG_SESSION_DESKTOP') % python del_env.py desktop gnome removing desktop % echo $XDG_SESSION_DESKTOP gnome -- Thomas > > [trex@sumlnxvm ~]$ > > > Please suggest how to reset system proxy using Python Code > > Regards, > Sumit > -- https://mail.python.org/mailman/listinfo/python-list

Re: solve_ivp problem (scipy 1.0.0)

2018-02-19 Thread Thomas Jollans
of termination (the value of independent variable) is > to be found in "t_events", but I cannot find the dependent variable(s) > value(s) at the termination moment. > Am I missing something? Or it's simply not possible (hopefully 'not yet')? > > Regards &

Functions unnecessarily called in Python/pylifecycle.c:_Py_InitializeCore() ?

2018-03-01 Thread Thomas Nyberg
ce to ask, but I'm not sure where is. Thanks for any enlightenment! Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Functions unnecessarily called in Python/pylifecycle.c:_Py_InitializeCore() ?

2018-03-01 Thread Thomas Nyberg
gets init'ed" is also a fair strategy. Half of my question was simply whether that is the case or if possible it was just a mistake when older versions that did something could be removed (e.g. the code example you put int). Thanks for the response! Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Functions unnecessarily called in Python/pylifecycle.c:_Py_InitializeCore() ?

2018-03-01 Thread Thomas Nyberg
On 03/01/2018 04:58 PM, Ned Batchelder wrote: > This sounds like it could make a good contribution to CPython :) > > --Ned. Thanks for the recommendation. Issue/PR created: https://bugs.python.org/issue32980 https://github.com/python/cpython/pull/5953 Cheers, Thomas

Invoice

2022-05-19 Thread Poppy Thomas
[image: Invoice.jpg] .. -- https://mail.python.org/mailman/listinfo/python-list

Python-announce] ANN: GF4 Now Has A Plugin Capability

2022-09-06 Thread Thomas Passin
A new plugin capability for the GF4 Waveform Calculator lets a Python file in the new plugins directory add a new command and command button. This is helpful for adding or developing new functionality. Basic information for writing and using plugins is included in the README file in the plugin

Re: any author you find very good has written a book on Python?

2022-09-06 Thread Thomas Passin
Mark Pilgram's "Dive Into Python" was good. Now he's updated it for Python 3: https://diveintopython3.net On 9/6/2022 11:36 AM, Meredith Montgomery wrote: Paul Rubin writes: Meredith Montgomery writes: So that's my request --- any author you find very good has written a book on Python?

Re: any author you find very good has written a book on Python?

2022-09-06 Thread Thomas Passin
On 9/6/2022 5:10 PM, jkn wrote: On Tuesday, September 6, 2022 at 9:06:31 PM UTC+1, Thomas Passin wrote: Mark Pilgram's "Dive Into Python" was good. Now he's updated it for Python 3: like, about ten years ago? (I think Mark Pilgrim dropped off the 'net many years ag

Re: Question about learning Python

2022-09-07 Thread Thomas Passin
On 9/7/2022 6:28 AM, Maruful Islam wrote: I want to start learning python. I have a question about learning python. Is learning C essential or not for learning python? Not at all. -- https://mail.python.org/mailman/listinfo/python-list

Re: [py-usr] flake8 gives me a W605 but Python don't

2022-09-10 Thread Thomas Passin
I don't know what flake8 is complaining about, but I think you want a literal "." character in front of the two "\d" escapes. So "." should be replaced by "\." in two places. In addition to using a raw string, that is. If you may need to detect versions larger than 9 in any position, you wo

Re: How to replace an instance method?

2022-09-16 Thread Thomas Passin
Here is an example of probably the easiest way to add an instance method: class Demo: def sqr(self, x): return x*x # Function to turn into a instance method def cube(self, x): return x*x*x d = Demo() print(d.sqr(2)) d.cube = cube.__get__(d) print(d.cube(3)) As for when someone

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

2022-10-09 Thread Thomas Passin
https://stackoverflow.com/questions/4284313/how-can-i-check-the-syntax-of-python-script-without-executing-it People seemed especially enthusiastic about the one-liner from jmd_dk. On 10/9/2022 12:17 PM, Peter J. Holzer wrote: On 2022-10-09 12:09:17 +0200, Antoon Pardon wrote: I would like a to

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

2022-10-09 Thread Thomas Passin
On 10/9/2022 1:29 PM, Peter J. Holzer wrote: > On 2022-10-09 12:59:09 -0400, Thomas Passin wrote: >> https://stackoverflow.com/questions/4284313/how-can-i-check-the-syntax-of-python-script-without-executing-it >> >> People seemed especially enthusiastic about the one-lin

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

2022-10-10 Thread Thomas Passin
On 10/10/2022 9:21 AM, Michael F. Stemper wrote: On 09/10/2022 10.49, Avi Gross wrote: Anton There likely are such programs out there but are there universal agreements on how to figure out when a new safe zone of code starts where error testing can begin? For example a file full of function

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

2022-10-11 Thread Thomas Passin
On 10/11/2022 3:10 AM, [email protected] wrote: I see resemblances to something like how a web page is loaded and operated. I mean very different but at some level not so much. I mean a typical web page is read in as HTML with various keyword regions expected such as ... or ... with thin

Re: Cannot import gdal in jupyter notebook

2022-10-11 Thread Thomas Passin
On Windows, when I tried to install gdal using pip, it needed to compile part of it. I'm not set up with the Microsoft compiler and header files, so that failed. If you are on Windows, you will need to look for a binary wheel to install, or install and configure the compiler and header files.

Re: flattening lists

2022-10-11 Thread Thomas Passin
Is this what you usually do? l1 = [[1,2,3],[4,5,6,7],[8,9]] l2 = [] for lz in l1: l2.extend(lz) print(l2) # [1,2,3,4,5,6,7,8,9] Not all that "tedious", perhaps... I tend to accumulate little utilities like this in a file and point to it with a .pth file. Of course, you have to remember

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

2022-10-11 Thread Thomas Passin
On 10/11/2022 4:00 PM, Chris Angelico wrote: On Wed, 12 Oct 2022 at 05:23, Thomas Passin wrote: On 10/11/2022 3:10 AM, [email protected] wrote: I see resemblances to something like how a web page is loaded and operated. I mean very different but at some level not so much. I mean a

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

2022-10-11 Thread Thomas Passin
On 10/11/2022 5:09 PM, Thomas Passin wrote: The OP wants to get help with problems in his files even if it isn't perfect, and I think that's reasonable to wish for.  The link to a post about the lezer parser in a recent message on this thread is partly about how a real, practical

Re: Fail 3.10.8 version installation on Windows 11 21H2

2022-10-12 Thread Thomas Passin
You probably need to install from an administrator account to install for all users. On 10/12/2022 5:20 AM, Kirill Ratkin via Python-list wrote: Hi All, Do anyone face issue like in log below? I got last installer (3.10.8) and try to install it 'for all users' with downloading precompiled (

Re: Find the path of a shell command

2022-10-12 Thread Thomas Passin
On 10/12/2022 12:00 AM, Paulo da Silva wrote: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reason: I have python program that launches a detached rm. It works pretty well

Re: Apparent Issue with Administrator Privileges

2022-10-18 Thread Thomas Passin
Looking at the ChemPlugin site, it looks like by default it would install into "C:\Program Files". Typically ordinary users do not have full privileges there, although they may have read privileges. If this is the case, either you would need to run it in an elevated (adminstrator) session, or

Re: Apparent Issue with Administrator Privileges

2022-10-18 Thread Thomas Passin
n not recognizing the script calls, but this is my first hint of success in 3 days. Thanks again, I'll start troubleshooting the next obstacle now -Original Message- From: Python-list On Behalf Of Thomas Passin Sent: Tuesday, October 18, 2022 3:10 PM To: python-list@pyt

Re: Portable executable on OSX

2022-10-20 Thread Thomas Passin
"Portable executable" usually means that the program resides on removable media, like a USB stick. You can go to a computer, plug the stick in, and run the program. If it's Python, then the installation on the removable medium needs to set up all the paths and directories correctly before act

Re: A trivial question that I don't know - document a function/method

2022-10-22 Thread Thomas Passin
On 10/22/2022 4:58 PM, Paulo da Silva wrote: Hi all! What is the correct way, if any, of documenting a function/method? 1. def foo(a,b): """ A description. a: Whatever 1 b: Whatever 2 """ [snip] 5. Any other ... Any comments/suggestions are welcome. Thanks. Paulo

Re: A trivial question that I don't know - document a function/method

2022-10-23 Thread Thomas Passin
On 10/23/2022 2:37 PM, Karsten Hilbert wrote: Am Sat, Oct 22, 2022 at 09:49:55PM -0400 schrieb Thomas Passin: def make_title_from_headline(self, p, h): """From node title, return title with over- and underline- strings. ... RETURNS a string "&qu

Re: Typing: Is there a "cast operator"?

2022-10-23 Thread Thomas Passin
On 10/23/2022 11:14 PM, Dan Stromberg wrote: On Sun, Oct 23, 2022 at 2:11 PM Paulo da Silva < [email protected]> wrote: Hello! I am in the process of "typing" of some of my scripts. Using it should help a lot to avoid some errors. But this is new for me and I'm facing some p

Re: Any PyQt developers here?

2022-10-25 Thread Thomas Passin
On 10/25/2022 1:03 PM, DFS wrote: Having problems with removeRow() on a QTableView object. removeRow() isn't listed as being a method of a QTableView, not even an inherited method, so how are you calling removeRow() on it? (See https://doc.qt.io/qt-6/qtableview-members.html) After calling r

Re: score function in linear regression model

2022-10-26 Thread Thomas Passin
There's a fairly good rundown of score() here: "[Python/Sklearn] How does .score() works?" https://www.kaggle.com/getting-started/27261 On 10/26/2022 2:18 AM, Fatemeh Heydari wrote: On Monday, October 24, 2022 at 7:14:10 AM UTC-7, Reto wrote: On Sun, Oct 23, 2022 at 05:11:10AM -0700, Fatemeh H

Re: Any PyQt developers here?

2022-10-27 Thread Thomas Passin
On 10/27/2022 11:15 AM, DFS wrote: On 10/25/2022 1:45 PM, Thomas Passin wrote: On 10/25/2022 1:03 PM, DFS wrote: Having problems with removeRow() on a QTableView object. removeRow() isn't listed as being a method of a QTableView, not even an inherited method, so how are you ca

Re: Any PyQt developers here?

2022-10-27 Thread Thomas Passin
This looks like a useful tutorial - https://doc.qt.io/qt-6/modelview.html On 10/27/2022 3:47 PM, Thomas Passin wrote: On 10/27/2022 11:15 AM, DFS wrote: On 10/25/2022 1:45 PM, Thomas Passin wrote: On 10/25/2022 1:03 PM, DFS wrote: Having problems with removeRow() on a QTableView object

Re: Any PyQt developers here?

2022-10-28 Thread Thomas Passin
On 10/28/2022 1:01 AM, Thomas Passin wrote: {snip] You might also be able to make the item bold using CSS, but I'm not sure. Apparently so: QTreeView::item:selected { background-color: #1d3dec; color: white; } See https://joekuan.wordpress.com/2015/10/02/styling-qt-qtreeview

Re: str.replace() when str contains \

2022-10-29 Thread Thomas Passin
Better to use raw strings whenever backslashes are involved. On 10/29/2022 2:21 PM, Bernard LEDRU wrote: Hello, https://docs.python.org/3/library/stdtypes.html#string-methods str.replace(old, new[, count])¶ Return a copy of the string with all occurrences of substring old replaced by new. If

Re: A typing question

2022-10-29 Thread Thomas Passin
On 10/29/2022 1:45 PM, Paulo da Silva wrote: Hi! Consider this simple script ... ___ from typing import List, Optional class GLOBALS:     foos=None class Foo:     def __init__(self):     pass class Foos:     Foos: List[Foo]=[]     # SOME GLOBALS ARE USED HERE in a r

Re: Fwd: A typing question

2022-10-30 Thread Thomas Passin
On 10/30/2022 6:26 AM, Peter J. Holzer wrote: On 2022-10-29 23:59:44 +0100, Paulo da Silva wrote: Às 22:34 de 29/10/22, dn escreveu: Solution (below) will not work if the mention of Foos in GLOBALS is a forward-reference. Either move GLOBALS to suit, or surround "Foos" with quotes.

Re: Fwd: Issues in python 3.11.0 (64-bit) installation

2022-11-03 Thread Thomas Passin
I just downloaded the 64-bit Windows installer. On my Windows 10 machine, both "py launcher" and "available for all users" options were available. They were available whether I checked the "administrative" box or not. Note that when I unchecked "administrative", then the "available for all use

Re: How to manage python shebang on mixed systems?

2022-11-07 Thread Thomas Passin
The problem is that some Linux systems - I think - still use Python2 to perform various system-related tasks. When they call "python", they need it to be Python2. If someone has a system like that, they can't have the "python" command run Python3. On 11/7/2022 1:07 PM, Schachner, Joseph (US)

Re: How to manage python shebang on mixed systems?

2022-11-07 Thread Thomas Passin
More discussion: https://unix.stackexchange.com/questions/29608/why-is-it-better-to-use-usr-bin-env-name-instead-of-path-to-name-as-my On 11/7/2022 5:35 PM, Cameron Simpson wrote: On 07Nov2022 09:28, Chris Green wrote: Chris Green wrote: > 3: with your pseudo "python3" script in place, make

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-09 Thread Thomas Passin
On 11/9/2022 7:02 PM, [email protected] wrote: Is there no one who can help? Is there a reason why you tried to install a 32-bit version? Most personal computers are 64-bit ones these days. Also, I don't remember if you are running Windows or not. One problem for getting help from the

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-09 Thread Thomas Passin
Sorry about the typo at the end. If you need to search the entire disk, use this command instead of the one I had in my last post: where /R c:\ python.exe On 11/9/2022 9:00 PM, Thomas Passin wrote: On 11/9/2022 7:02 PM, [email protected] wrote: Is there no one who can help? Is there

Re: Argument name should be lowercase

2022-11-11 Thread Thomas Passin
This is a matter of convention. Historically, many language practitioners got used to using all-caps for key constants. This makes it easier to tell when you are using (or misusing) one, for one thing. For myself, I also will use all-caps for quasi-constants, ones that are set only once, for

Re: Superclass static method name from subclass

2022-11-11 Thread Thomas Passin
You can define a classmethod in SubClass that seems to do the job: class SuperClass(object): @staticmethod def spam(): # "spam" and "eggs" are a Python tradition print('spam from SuperClass') class SubClass(SuperClass): @classmethod def eggs(self): super().

Re: Need max values in list of tuples, based on position

2022-11-11 Thread Thomas Passin
On 11/11/2022 2:22 PM, Pancho via Python-list wrote: On 11/11/2022 18:53, DFS wrote: On 11/11/2022 12:49 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 02:22:34 -0500, DFS declaimed the following: [(0,11), (1,1),  (2,1),   (0,1) , (1,41), (2,2),   (0,9) , (1,3),  (2,12)] The set of value

Re: Need max values in list of tuples, based on position

2022-11-11 Thread Thomas Passin
On 11/11/2022 2:22 AM, DFS wrote: [(0,11), (1,1),  (2,1),  (0,1) , (1,41), (2,2),  (0,9) , (1,3),  (2,12)] The set of values in elements[0] is {0,1,2} I want the set of max values in elements[1]: {11,41,12} This request is ambiguous. Do you want to get the maximum value for each row, and

Re: Create a Python Launcher on Desktop

2022-11-11 Thread Thomas Passin
On 11/11/2022 4:44 PM, [email protected] wrote: Hello, I am real a beginner of Python. Not able to create a Python launcher (shortcut) on Desktop after the installation. Would you kindly instruct how to do it? Windows 11-Home, 64 bits, HP desktop If you get an offer of Python wh

Re: Superclass static method name from subclass

2022-11-11 Thread Thomas Passin
On 11/11/2022 5:07 PM, Ian Pilcher wrote: On 11/11/22 11:02, Thomas Passin wrote: You can define a classmethod in SubClass that seems to do the job: class SuperClass(object):    @staticmethod    def spam():  # "spam" and "eggs" are a Python tradition    

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-12 Thread Thomas Passin
t;", line 1, in ImportError: DLL load failed while importing _tkinter: Das angegebene Modul wurd e nicht gefunden. How can I go gon, to make it work? *Von:* Thomas Passin <mailto:[email protected]> *Gesendet:* ‎Donnerstag‎, ‎10‎. ‎November‎ ‎2022 ‎03‎:‎00 *An:* python-list@python

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-12 Thread Thomas Passin
On 11/12/2022 11:48 AM, [email protected] wrote: Hello Thomas, there is a “_tkinter.pyd” in the *.dll Directory. Is there something more, I can check? Yes, look in the "Lib" (NOT "libs") subdirectory of the Python tree and see if it has a subdirectory named "tki

Re: Python 3.7+ cannot print unicode characters when output is redirected to file - is this a bug?

2022-11-13 Thread Thomas Passin
On 11/13/2022 9:49 AM, Jessica Smith wrote: Consider the following code ran in Powershell or cmd.exe: $ python -c "print('└')" └ $ python -c "print('└')" > test_file.txt Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python38\lib\encodings\cp1252.py", line

Re: Are these good ideas?

2022-11-14 Thread Thomas Passin
For parameter passing like your #2, I have packaged them into a dictionary and passed that around. It was easy enough, and worked well. The only potential problem is in documenting the key/value pairs the dictionary is supposed to contain. You had better make sure it's made clear somewhere,

Re: Are these good ideas?

2022-11-14 Thread Thomas Passin
On 11/14/2022 5:36 PM, Barry wrote: On 14 Nov 2022, at 22:06, Thomas Passin wrote: For parameter passing like your #2, I have packaged them into a dictionary and passed that around. It was easy enough, and worked well. I used to use a dict but having been burnt with issues now create a

Re: Passing information between modules

2022-11-18 Thread Thomas Passin
On 11/18/2022 10:19 AM, Tobiah wrote: On 11/18/22 02:53, Stefan Ram wrote:    Can I use "sys.argv" to pass information between modules    as follows?    in module A: import sys sys.argv.append( "Hi there!" )    in module B: import sys message = sys.argv[ -1 ] Kind of seems like a code smel

Re: Passing information between modules

2022-11-19 Thread Thomas Passin
On 11/19/2022 4:28 PM, Thomas Passin wrote: On 11/19/2022 3:46 PM, Michael F. Stemper wrote: On 18/11/2022 04.53, Stefan Ram wrote:    Can I use "sys.argv" to pass information between modules    as follows?    in module A: import sys sys.argv.append( "Hi there!" )   

Re: Passing information between modules

2022-11-19 Thread Thomas Passin
On 11/19/2022 3:46 PM, Michael F. Stemper wrote: On 18/11/2022 04.53, Stefan Ram wrote:    Can I use "sys.argv" to pass information between modules    as follows?    in module A: import sys sys.argv.append( "Hi there!" )    in module B: import sys message = sys.argv[ -1 ] I just tried and

Re: Logging

2022-11-19 Thread Thomas Passin
On 11/19/2022 5:27 PM, Cameron Simpson wrote: On 19Nov2022 11:08, Stefan Ram wrote: writes: You are expected to implement logging feature to an existing code which uses the function below. [...] You are not allowed to make changes in my_ugly_debug, so find another way.  If found a solution

Re: Superclass static method name from subclass

2022-11-19 Thread Thomas Passin
On 11/13/2022 7:27 AM, Axy via Python-list wrote: On 11/11/2022 16:21, Ian Pilcher wrote: Is it possible to access the name of a superclass static method, when defining a subclass attribute, without specifically naming the super- class? A instance's __bases__ attribute is a sequence that conta

Re: An email from a user

2022-11-20 Thread Thomas Passin
On 11/20/2022 7:32 AM, Hoe Tee wrote: Hi, I recently installed Python 3.11.0 on my laptop. However, there was no folder named 'Python' in my Program folder after the software was installed. I'm writing this letter since I'm a python learner and the loss of the Python folder in the Program folder

Re: Passing information between modules

2022-11-20 Thread Thomas Passin
On 11/20/2022 1:50 PM, Roel Schroeven wrote: Stefan Ram schreef op 20/11/2022 om 11:39:    The idea is about parameterizing the behavior of a module.    For example, the module "M" may contain functions that contain    "input.read()" to get input and "output.write()" to write    output. Then one

Re: Passing information between modules

2022-11-20 Thread Thomas Passin
On 11/20/2022 4:07 PM, Roel Schroeven wrote: Thomas Passin schreef op 20/11/2022 om 20:33: https://devblogs.microsoft.com/oldnewthing/20050607-00/?p=35413 https://devblogs.microsoft.com/oldnewthing/20101125-00/?p=12203 Now that I think about it, The Old New Thing is also where I got the

Re: Passing information between modules

2022-11-20 Thread Thomas Passin
On 11/21/2022 12:01 AM, dn wrote: On 21/11/2022 12.07, Dan Kolis wrote: If you understand its meaning, it achieves my purpose. If you don't I you're perhaps not a programmer... Ouch! Does the first sentence imply who is the more important person in the interaction? Does the second further th

Re: Passing information between modules

2022-11-21 Thread Thomas Passin
On 11/21/2022 12:24 AM, dn wrote: My original question probably was intended to be something    like: "Today, we can add attributes to a module from the    outside. How large is the risk that this will be forbidden    one day, so that all code using this will stop working?". This can happen tod

Re: Python 3.11.0 installation and Tkinter does not work

2022-11-21 Thread Thomas Passin
On 11/21/2022 1:24 PM, Stefan Ram wrote: [email protected] writes: import _tkinter I don't know why you get this error message. Here, I do not get an error message from that line. However, the normal way to use tkinter, as far as I know, is without the underscore! You can import

Re: Preprocessing not quite fixed-width file before parsing

2022-11-23 Thread Thomas Passin
On 11/23/2022 11:00 AM, Loris Bennett wrote: Hi, I am using pandas to parse a file with the following structure: Name filesettype KB quota limit in_doubt grace |files quotalimit in_doubtgrace shortname sharedhome USR14097664 52428800

Re: is mypy failing here

2022-11-24 Thread Thomas Passin
On 11/24/2022 5:05 AM, Robin Becker wrote: I haven't used dataclasses or typing very much, but while playing about I found this didn't give me an expected error (.py312) robin@minikat:~/devel/reportlab $ cat tmp/examples/tdc.py && python tmp/examples/tdc.py && mypy tmp/examples/tdc.py ###

Re: is mypy failing here

2022-11-24 Thread Thomas Passin
On 11/24/2022 7:34 AM, Thomas Passin wrote: On 11/24/2022 5:05 AM, Robin Becker wrote: I haven't used dataclasses or typing very much, but while playing about I found this didn't give me an expected error (.py312) robin@minikat:~/devel/reportlab $ cat tmp/examples/tdc.py &am

Re: Preprocessing not quite fixed-width file before parsing

2022-11-24 Thread Thomas Passin
On 11/24/2022 9:06 AM, Loris Bennett wrote: Thomas Passin writes: On 11/23/2022 11:00 AM, Loris Bennett wrote: Hi, I am using pandas to parse a file with the following structure: Name filesettype KB quota limit in_doubtgrace |files quotalimit

Re: is mypy failing here

2022-11-25 Thread Thomas Passin
On 11/25/2022 12:00 PM, Robin Becker wrote: On 24/11/2022 14:10, Thomas Passin wrote: . C:\temp\python>py -V Python 3.10.4 C:\temp\python>py tdc.py DC(a=, b='B') C:\temp\python>mypy tdc.py tdc.py:10: error: Argument 1 to "DC" has incompatible ty

Re: pip issue

2022-11-30 Thread Thomas Passin
On 11/30/2022 1:49 PM, Gisle Vanem via Python-list wrote: Dieter Maurer wrote: Otherwise no issues. But where is this text "-arkupsafe" stored and how to get rid it it? I've searched through all of my .pth files and found no such string. Have you looked at the content of the folder mentioned

Re: Contributing to cpython

2022-12-06 Thread Thomas Passin
On 12/6/2022 3:24 PM, ramvikram singh wrote: Greetings, I learnt python this year and visiting the python issue tab for the last two months, but there is a problem which I am facing I understand the issue after reading the few times but I can't think about how to modify the code as per the issue.

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

2022-12-06 Thread Thomas Passin
On 12/6/2022 9:23 PM, Jach Feng wrote: s0 = r'\x0a' At this moment it was done by def to1byte(matchobj): return chr(int('0x' + matchobj.group(1), 16)) s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0) But, is it that difficult on doing this simple thing? --Jach I'm not tota

Re: Contributing to cpython

2022-12-06 Thread Thomas Passin
On 12/6/2022 11:18 PM, ramvikram singh wrote: the issue is that after reading the issue I am not able to think how to modify the code, this is where I am stuck On Wed, Dec 7, 2022 at 1:54 AM ramvikram singh wrote: Greetings, I learnt python this year and visiting the python issue tab for the

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

2022-12-08 Thread Thomas Passin
The original post started out with r'\x0a' but then talked about '\xdd'. I assumed that there was a pattern here, a raw string containing "\x" and two more characters, and made a suggestion for converting any string with that pattern. But the OP was very unclear what the task really was, so h

Re: New computer, new Python

2022-12-09 Thread Thomas Passin
It sounds like on your old computer, you used some kind of program to write python code and perhaps to run it too. It would help if you could say what that program was. Python itself - the actual program called "python.exe" on Windows - runs a Python interpreter inside a Windows console windo

Re: sqlite3 double quote behavior

2022-12-13 Thread Thomas Passin
On 12/13/2022 4:09 AM, Chris Angelico wrote: On Tue, 13 Dec 2022 at 19:52, Roel Schroeven wrote: Like Lars Liedtke this is not an exact answer to your question, but you can side-step the issue by using parametrized queries, i.e. instead of cur.execute('SELECT name, location FROM persons

Re: Subtracting dates to get hours and minutes

2022-12-13 Thread Thomas Passin
Your problem is that datetime.datetime does not accept a tuple as an argument. It expects an integer value for the first argument, but you supplied a tuple. In Python, you can use a sequence (e.g., tuple or list) the way you want by prefixing it with an asterisk. This causes the sequence of

Re: Subtracting dates to get hours and minutes

2022-12-14 Thread Thomas Passin
n with the "*" gives the same result as the first expression. That line is not needed by any code, it's just there to show you that the proposed expression gives the desired result. Thank you. -Original Message- From: Python-list On Behalf Of Thomas Passin Sent: Tuesday

Re: Keeping a list of records with named fields that can be updated

2022-12-14 Thread Thomas Passin
Dictionaries and sets are your friends here. On 12/14/2022 1:50 PM, songbird wrote: I'm relatively new to python but not new to programming in general. The program domain is accounting and keeping track of stock trades and other related information (dates, cash accounts, interest, divid

Re: Single line if statement with a continue

2022-12-14 Thread Thomas Passin
PEP-8, which is Guido's style guide and generally good to follow, does not completely discourage single-line usage like the example. It's not clear to me how Chris's example fits into the guidelines. PEP-8: "While sometimes it’s okay to put an if/for/while with a small body on the same line,

Re: Subtracting dates to get hours and minutes

2022-12-15 Thread Thomas Passin
c.total_seconds() / 60 minutes = c.seconds / 60 hours = 0 while (minutes > 59): minutes = minutes - 60 hours += 1 minutes = round(minutes) print ("77 Hours = <" + str(hours) + ">") print ("78 Minutes = <" + str(minutes) + ">") if hours > 7: print(" T

Re: sqlite3 double quote behavior

2022-12-15 Thread Thomas Passin
There is a Python adapter for SQLITE called "APSW". It has a config() function. I looked in the codebase and it defines the two configuration constants needed to turn off the double quote behavior (see https://sqlite.org/quirks.html). These constants are SQLITE_DBCONFIG_DQS_DDL and SQLITE_DB

Re: Single line if statement with a continue

2022-12-15 Thread Thomas Passin
On 12/15/2022 3:58 AM, Chris Green wrote: Thomas Passin wrote: I personally tend to use if test: return even inside larger blocks. I always try to avoid multiple returns from functions/methods, as soon as things get complex it's all to easy to miss clean-up etc.

Re: Subtracting dates to get hours and minutes

2022-12-15 Thread Thomas Passin
Oops, "items = dstr[1:-2].split(',')" should have read "items = dstr[1:-1].split(',')". On 12/15/2022 1:56 PM, Thomas Passin wrote: It's hard to be sure from what you have offered, but I suspect that you are taking the string "(2022, 12,

Re: Subtracting dates to get hours and minutes

2022-12-15 Thread Thomas Passin
On 12/15/2022 11:34 PM, MRAB wrote: On 2022-12-15 22:49, [email protected] wrote: Yes, it works like a charm. On the tupility of it all. Special thanks for the explanation too….. (Originally asked but I found the errors. All is working) Now that the code no longer produces the errors, I see

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