Re: sys.modules

2019-02-21 Thread DL Neil
Hello, On 22/02/19 5:40 AM, ast wrote: Is it normal to have 151 entries in dictionary sys.modules just after starting IDLE or something goes wrong ? >>> import sys >>> len(sys.modules) 151 I don't use Idle. Written in python, doesn't it require various packages to run before it even talks

Re: How to format a datetime MySQL database field to local using strftime()

2019-02-24 Thread DL Neil
Vergos, Please provide more information and show how you've debugged the code so far... On 25/02/19 7:03 AM, [email protected] wrote: pymydb.execute( '''SELECT host, ref, location, useros, browser, visits, hits, downloads, authuser FROM guests

Re: How to format a datetime MySQL database field to local using strftime()

2019-02-24 Thread DL Neil
Vergos, On 25/02/19 11:53 AM, [email protected] wrote: Τη Δευτέρα, 25 Φεβρουαρίου 2019 - 12:38:43 π.μ. UTC+2, ο χρήστης [email protected] έγραψε: Τη Κυριακή, 24 Φεβρουαρίου 2019 - 8:52:03 μ.μ. UTC+2, ο χρήστης DL Neil έγραψε: Vergos, Please provide more information and show how

Re: How to format a datetime MySQL database field to local using strftime()

2019-02-25 Thread DL Neil
On 26/02/19 7:47 AM, Dennis Lee Bieber wrote: On Mon, 25 Feb 2019 13:00:03 -0500, Dennis Lee Bieber declaimed the following: My apologies for the mis-attribution -- due to spam, I tend to filter out @gmail.com posts (the one flaw with Forte Agent -- it only filters news groups on subje

Re: Quirk difference between classes and functions

2019-02-25 Thread DL Neil
On 26/02/19 5:25 AM, ast wrote: I noticed a quirk difference between classes and functions >>> x=0 >>> class Test:     x = x+1     print(x)     x = x+1     print(x) ... Previous code doesn't generate any errors. x at the right of = in first "x = x+1" line is the global on

Re: Connector/Python, MySQL Workbench Issue

2019-02-25 Thread DL Neil
Scott, On 26/02/19 2:15 PM, Scott Sorgent wrote: I was trying to install MySQL Workbench and it asked me to install the Connector/Python 3.7. I installed Python 3.7.2, restarted the computer and tried to install MySQL workbench again and it told me again that I needed to install Connector/P

Re: Connector/Python, MySQL Workbench Issue

2019-02-25 Thread DL Neil
r.  I opted for the Full Installation on the MySQL Workbench program though which tries to install everything.  I'm going to be using for a big MySQL database through AWS. *From:* Python-list on behalf of DL Ne

Re: Using PyArg_ParseTuple to with optional fields.

2019-02-28 Thread DL Neil
Anthony, On 28/02/19 10:18 PM, Anthony Flury via Python-list wrote: I am trying to write an extension module with a function (actually an __init__ method, but I am not sure that matters) where the function can be called as either :     my_func() or     my_func( a, b, c, d) - where a,b,c,d a

Re: Class Issue`

2019-03-05 Thread DL Neil
Milt, On 6/03/19 11:39 AM, Milt wrote: The following code gives me unusual results - base on experience with C++. class Car:    # carColor = None    # mileage = None    def __init__(self, color = None, miles = None):   self.mileage = miles   self.carColor = color    def print(self)

Re: System Beep?

2019-03-08 Thread DL Neil
Dear Squeak, sorry, Dear Steve, Back in the ?good, old days when we used to walk alongside a mainframe CPU whilst it cogitated, we would often use the BEL character to alert us to job completion (and meantime bunk-off to go have a coffee, cakes, ...) - more seriously, it alerted telegraph and

Re: System Beep?

2019-03-08 Thread DL Neil
Steve, On 9/03/19 11:03 AM, Steve wrote: I tried all three, nothing audio. I am beginning to wonder if something I the operating system is at fault. The three lines do produce symbols. The first two are a rectangle with a space in the middle and the last one spelled out "bel" in short/small

Re: Python resources recommendations

2019-03-09 Thread DL Neil
Hello Arup, On 10/03/19 3:01 AM, Arup Rakshit wrote: Hello Python, This is my first time in this mailing list. I am a Ruby/JS developer by day. I have decided to learn Python now this year. Being an experienced developer as I said above which resources I should pick to learn Python in and out?

Re: Python resources recommendations

2019-03-09 Thread DL Neil
AK, On 10/03/19 12:41 PM, Alex Kaye wrote: DL, Good advice. U of M is well done and interesting. Actually, I criticised them - but was looking at matters such as "delivery" and from a cognitive psychology perspective - on behalf of, but quite different to, the needs of 'the average' trainee

Re: Help!!! How to apply my created function to another function

2019-03-10 Thread DL Neil
Dear Joyce, On 11/03/19 7:30 AM, [email protected] wrote: ... A = [ 4, 5, 1] #TASK0 def displayVector(v) : print(v) displayVector(A) ... B = buildRandomVector(A) def vectorMagnitude(v) : tsum = 0 for i in v: tsum = tsum + i**2 x = math.sqrt(tsum)

Re: Help!!! How to apply my created function to another function

2019-03-10 Thread DL Neil
Luuk, On 11/03/19 8:02 AM, Luuk wrote: On 10-3-2019 19:30, [email protected] wrote: Please see the last line When reading above, i was thinking about this joke: ...> ;) Yes, I had a similar reaction to the wording: why not put *it* first. Having lived and worked in many countries/culture

Re: "use strict"

2019-03-11 Thread DL Neil
Abdur-Rahmaan, with greetings, On 12/03/19 6:45 AM, Abdur-Rahmaan Janhangeer wrote: Greetings, would it be a good idea to add a use strict in py like js? recently i was helping someone and that was one annoying part where a typo in a var name caused an unintended variable to slip in. maybe some

Re: "use strict"

2019-03-11 Thread DL Neil
On 12/03/19 8:00 AM, Abdur-Rahmaan Janhangeer wrote: about the editor part i think yes it'd underline unused variables or somewhat similar. is that the best we can hope for (coupled with type annotations)? the problem was that i was reviewing the code, since everything worked (no errors but

Re: Python scope question

2019-03-12 Thread DL Neil
Arup, On 13/03/19 3:38 AM, Arup Rakshit wrote: I have questions how nonlocal and global affecting the variable assignment. Also how each print statement looking up the values for the spam variable. This scope thing in python is very confusing too me still. Can anyone help me to understand th

Re: UG Announcement - Python Mauritius User-Group (pymug)

2019-03-14 Thread DL Neil
On 14/03/19 6:53 PM, Abdur-Rahmaan Janhangeer wrote: As per requirements, i'm announcing the existence of the Python User-Group for Mauritius, an island in the Indian Ocean. Below are some info. Congratulations! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Not Defined error in basic code

2019-03-14 Thread DL Neil
Jack, On 15/03/19 3:05 AM, Jack Dangler wrote: Just getting started with tutorials and such, and don't understand this - Did you answer the post asking which tutorial you were following/copying? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Not Defined error in basic code

2019-03-14 Thread DL Neil
Just getting started with tutorials and such, and don't understand this - Did you answer the post asking which tutorial you were following/copying? Sorry - it is this - https://www.learnpython.org/en/ .. The section is on classes and objects - https://www.learnpython.org/en/Classes_and_Objects

Re: Not Defined error in basic code

2019-03-14 Thread DL Neil
Thank you sir. I think you may be on to something there. I've done mainframe, machine, 3GL, and 4GL languages, but the last couple I've taken on have given me headaches. I guess I'll have to just read a bunch first and then try and write something simpler than what I'm attempting to take on...

Re: I wrote a free book about TDD and clean architecture in Python

2019-03-19 Thread DL Neil
On 17/03/19 12:29 AM, [email protected] wrote: I published on Leanpub a free book, "Clean Architectures in Python". It's a humble attempt to organise and expand some posts I published on my blog in the last years. You can find it here: https://leanpub.com/clean-architectures-in-python

Re: I wrote a free book about TDD and clean architecture in Python

2019-03-19 Thread DL Neil
On 20/03/19 7:18 AM, Leonardo Giordani wrote: Ha ha ha, yes I get it! =) I'm sorry, that depends entirely on the LeanPub processing chain (I believe, I'll have a look just to be sure). I hope the book will be useful even with this little issue. Thanks for reading it! To be fair, that was one

Re: File not closed

2019-03-20 Thread DL Neil
On 2019-03-20, ast wrote: In the following snippet, a file is opened but without any variable referring to it. So the file can't be closed. [line.split(":")[0] for line in open('/etc/passwd') if line.strip() and not line.startswith("#")] What do you think about this practice ? As other

Re: Might be doing this wrong? (Turtle graphics)

2019-03-20 Thread DL Neil
Jason, On 21/03/19 12:34 PM, [email protected] wrote: So, I typed in code: from turtle import * forward(100) right(120) clear() It didn't work! It kept on saying that there was an indent and the first line was wrong. Help! It would be most helpful if you gave us the exact error msg, in

Re: log file

2019-03-21 Thread DL Neil
On 22/03/19 4:25 PM, Sharan Basappa wrote: I am running a program and even though the program runs all fine, the log file is missing. I have pasted first few lines of the code. Any suggestions where I maybe going wrong? import os import csv import logging import assertion_design as asd import

Re: Multiple log files using logging module

2019-03-24 Thread DL Neil
On 25/03/19 6:13 AM, Sharan Basappa wrote: I have a test program that imports a design program. Both the programs need to log messages. ...> I would like to get comment from members here as well as some simple programs to illustrate this ... Have you copied this code from somewhere? Which tu

Re: Python 3.7 Bug

2019-03-25 Thread DL Neil
Bassam, Greetings. On 26/03/19 1:14 AM, Bassam Abdul-Baki wrote: Greetings, In the following code, there's a bug on certain parameters. -- def per(n, steps = 0): digits = [int(i) for i in str(n)] result = 1 for j in digits: result *= j steps += 1 print(steps, result, sep

Re: Your IDE's?

2019-03-25 Thread DL Neil
On 26/03/19 10:38 AM, John Doe wrote: What is your favorite Python IDE? In case you are tempted to reply, neither of "John"'s supposed domains resolves (to a web site)/has been registered. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Your IDE's?

2019-03-25 Thread DL Neil
On 26/03/19 12:55 PM, Gene Heskett wrote: On Monday 25 March 2019 18:20:29 DL Neil wrote: On 26/03/19 10:38 AM, John Doe wrote: What is your favorite Python IDE? In case you are tempted to reply, neither of "John"'s supposed domains resolves (to a web site)/has been register

Re: configparser - which one?

2019-03-25 Thread DL Neil
Dave, On 26/03/19 1:10 PM, Dave wrote: I use Python3 3, and expected learning how to use configparser would be no big deal.  Well!  Seems there is configparser, stdconfigparser, and safeconfigparser, and multiple ways to set the section and entries to the section.  A little confusing.  I want

OT Re: Your IDE's?

2019-03-26 Thread DL Neil
Those of delicate disposition should look away now... The invention is not mine: aside from his name, have a look at the OP's purported email address, and his requested ReplyTo: address. Then check the veracity of those domainNMs... I only rarely do so as I can usually detect such from the pu

Re: configparser - which one?

2019-03-26 Thread DL Neil
On 27/03/19 2:44 AM, Grant Edwards wrote: On 2019-03-26, Cameron Simpson wrote: Like JSON, YAML etc are far far easier than XML for the reader. If "far far easier than XML for the reader" is the bar, then we'll have to keep "nailgun to the eyeballs" on the list... That said, I agree with th

Handy utilities = Friday Filosofical Finking

2019-03-28 Thread DL Neil
How do you keep, use, and maintain those handy snippets, functions, classes... - units of code, which you employ over-and-over again? Having coded 'stuff' once, most of us will keep units of code, "utilities", which we expect will be useful in-future (DRY principle), eg functions to rename fi

Re: Handy utilities = Friday Filosofical Finking

2019-03-29 Thread Neil Cerutti
On 2019-03-28, DL Neil wrote: > How do you keep, use, and maintain those handy snippets, > functions, classes... - units of code, which you employ > over-and-over again? > > Having coded 'stuff' once, most of us will keep units of code, > "utilities", which w

Re: Understanding the MRO with multiple inheritance

2019-03-29 Thread DL Neil
Arup, There is a minefield here. Are you using Python 2 or 3? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Handy utilities = Friday Filosofical Finking

2019-04-01 Thread DL Neil
Gidday Cameron, Thanks for this - some thoughts below:- On 2/04/19 11:57 AM, Cameron Simpson wrote: On 29Mar2019 09:32, DL Neil wrote: How do you keep, use, and maintain those handy snippets, functions, classes... - units of code, which you employ over-and-over again? Having coded '

Re: Handy utilities = Friday Filosofical Finking

2019-04-01 Thread DL Neil
On 2/04/19 1:25 PM, Chris Angelico wrote: On Tue, Apr 2, 2019 at 11:16 AM DL Neil wrote: One of the points which intrigue me is that my colleagues don't keep snippets/a library, preferring to remember (hah!) when/where they used particular techniques in the past, and copying/duplicatin

Re: Handy utilities = Friday Filosofical Finking

2019-04-01 Thread DL Neil
On 2/04/19 1:56 PM, Cameron Simpson wrote: On 02Apr2019 13:14, DL Neil wrote: On 2/04/19 11:57 AM, Cameron Simpson wrote: On 29Mar2019 09:32, DL Neil wrote: Do you 'keep' these, or perhaps next time you need something you've 'done before' do you remember when/w

Re: Clicking a specific item within a drop down list

2019-04-02 Thread DL Neil
On 3/04/19 7:53 AM, [email protected] wrote: What code would allow me to automatically select and click the "Quarterly" value from the drop-down box labeled "Statement Type" on the web page below. I'm new to Python and have been struggling with this one. Any help is immensely appreciated. Tha

Re: Clicking a specific item within a drop down list

2019-04-02 Thread DL Neil
Richard, (this is a Python list, and whilst the question is quite proper - your are using Python after all, the answer delves into Selenium and then dives into HTML and finally disappears into 'the dark side' of JavaScript!) On 3/04/19 2:02 PM, [email protected] wrote: Hi dn, Thank you kind

Re: fs package question - cp -p semantics when copying files?

2019-04-02 Thread DL Neil
Skip, On 3/04/19 8:06 AM, Skip Montanaro wrote: I posed this yesterday on the PyFilesystem discussion Google Group but it's so far not even garnered a single view, so perhaps that group is defunct. I turn to the knowledgeable folks here: I am copying files from one filesystem instance to anothe

Re: Logging module and datetime - oil & water for some reason?

2019-04-02 Thread DL Neil
Skip, On 2/04/19 9:54 AM, Skip Montanaro wrote: I assiduously avoided using Python's logging package for about the first dozen years of its existence. I eventually gave in and started I'm glad you're stepping-up! I'm never sure whether to be amazed or dismayed by the huge number of folk exp

Re: I want understand how this word wrap program playing on input

2019-04-04 Thread DL Neil
Arup, On 5/04/19 7:33 AM, Arup Rakshit wrote: I am reading a Python book, where the author used a simple word wrap program to explain another concept. But I am not understanding some parts of the program. ... A technique for solving this sort of comprehension-problem is to simulate the opera

Logging cf Reporting = Friday Filosofical Finking

2019-04-04 Thread DL Neil
Is the logging module an ideal means to provide (printed) user reports, or is it a 'bad fit' and not designed/fit for such a purpose? PSL's logging module (per discussion 'here' earlier this week) is often quietly avoided by 'the average Python programmer'. It is unwieldy, yet that is, in-par

Re: I want understand how this word wrap program playing on input

2019-04-06 Thread DL Neil
er come to me. Thanks again to all of you. Thanks, Arup Rakshit [email protected] On 05-Apr-2019, at 1:24 AM, DL Neil wrote: Arup, On 5/04/19 7:33 AM, Arup Rakshit wrote: I am reading a Python book, where the author used a simple word wrap program to explain another concept. But I am not understand

Re: Logging cf Reporting = Friday Filosofical Finking

2019-04-08 Thread DL Neil
Is logging an unpopular package? Is extending its use, as described, interesting/inappropriate/illogical/downright-crazy? On 5/04/19 8:34 AM, DL Neil wrote: Is the logging module an ideal means to provide (printed) user reports, or is it a 'bad fit' and not designed/fit for such

Python list and Python Journeymen*

2019-04-13 Thread DL Neil
se if it feels embarrassing. Please allow me to explain... Hello DL Neil, Sorry if it feels like random. I need some advices about the Python. I am learning Python to learn basically Flask, because I am a web developer and understands it well. Having prior knowledge in Ruby, JS, I thought it

Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
(I know it's not Friday [exp], and after personal apologies[apo]) Do you bother with exception handling for import statements? Most of the code I read, both in books and during code review, eschews any form of ImportError check. Even data science people who 'clean' every data field towards i

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
On 18/04/19 8:53 AM, Larry Martell wrote: On 2019-04-17 21:20, DL Neil wrote: Do you bother with exception handling for import statements? I often have to do something like this: try: from settings import SITE_WAFER_DIAMETER except ImportError: SITE_WAFER_DIAMETER = 300 That&#

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
On 18/04/19 8:45 AM, MRAB wrote: On 2019-04-17 21:20, DL Neil wrote: Do you bother with exception handling for import statements? Can we assume that if such a catastrophic error occurs, it is quite acceptable for the code to fall-over in a tumbling-fumble? [snip] Catch only what you (well

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
On 18/04/19 8:44 AM, Grant Edwards wrote: On 2019-04-17, DL Neil wrote: Do you bother with exception handling for import statements? Sometimes. There are two cases when I do that: 1. When the module has different names under Python2 and Python3 and the program tries first one, then

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
On 18/04/19 8:29 AM, Chris Angelico wrote: On Thu, Apr 18, 2019 at 6:21 AM DL Neil wrote: Do you bother with exception handling for import statements? Can we assume that if such a catastrophic error occurs, it is quite acceptable for the code to fall-over in a tumbling-fumble? I try/except

Re: Friday Filosofical Finking: Import protections

2019-04-17 Thread DL Neil
On 18/04/19 1:24 PM, Cameron Simpson wrote: On 17Apr2019 21:45, MRAB wrote: On 2019-04-17 21:20, DL Neil wrote: Do you bother with exception handling for import statements? [...] Catch only what you (well, the script) can fix. If it needs numpy, but can't import numpy, then when can

Re: Function to determine list max without itertools

2019-04-17 Thread DL Neil
On 18/04/19 4:10 PM, Sayth Renshaw wrote: I have created a function that takes a list as an argument. Without using itertools I want to compare each item in the list to find the max. However instead of the max I keep getting the last item in the list. Where is my logic wrong here? ... Seems

Re: Function to determine list max without itertools

2019-04-18 Thread DL Neil
On 19/04/19 5:22 PM, Sayth Renshaw wrote: In English rather than Python, how do you find the maximum element in a list? -- Rob Gaddi, Highland Technology Get first 1 item in the list and compare it to the rest. If it is larger than rest its the max. However if another list member is larger

Re: Function to determine list max without itertools

2019-04-19 Thread DL Neil
> On 19/04/19 7:23 PM, Sayth Renshaw wrote: In English: Set the first item in the list as the current largest. Compare each subsequent integer to the first. if this element is larger, set integer. Criticism: (because this does NOT match the code, below!) - should

Re: Function to determine list max without itertools

2019-04-19 Thread DL Neil
On 20/04/19 4:41 AM, Rob Gaddi wrote: On 4/19/19 12:23 AM, Sayth Renshaw wrote: On Friday, 19 April 2019 17:01:33 UTC+10, Sayth Renshaw  wrote: Set the first item in the list as the current largest. Compare each subsequent integer to the first. if this element is large

Re: Is this a "gotcha" in Python?

2019-04-20 Thread DL Neil
On 21/04/19 8:16 AM, Chris Angelico wrote: On Sun, Apr 21, 2019 at 2:14 AM Dennis Lee Bieber wrote: Only use short (single character) names for items that only exist as loop control, and are not rebound within the loop, nor used outside of the scope of that loop (but can be reused in a

Re: Better ways for implementing two situations

2019-04-21 Thread DL Neil
Olá Paulo, On 22/04/19 6:23 AM, Paulo da Silva wrote: Hi all. I am looking for improved solutions to these two problems. They are to be in a program that deals with big data. So, they need to be fast and save memory. ... Given that we're talking "big data", which Python Data Science tools a

Re: Is this a "gotcha" in Python?

2019-04-22 Thread DL Neil
Isn't there an argument that in this context, using the single letter "l" as a variable name is 'lazy'? That the "l" could be used in different contexts (per OP). That it conveys no meaning as to the variable's purpose? In this specific case, I actually think that "l" is a bad choice, but not be

Re: Most "pythonic" syntax to use for an API client library

2019-04-28 Thread DL Neil
On 29/04/19 6:58 AM, Jonathan Leroy - Inikup via Python-list wrote: 1/ api.customers_list() api.customers_info(1) api.customers_update(1, name='Bob') api.customers_delete(1) Dislike this because it mixes point and underscore - easy to mistake! 2/ api.customers.list() api.customers.info(1) ap

Re: Most "pythonic" syntax to use for an API client library

2019-04-28 Thread DL Neil
On 29/04/19 3:55 PM, Chris Angelico wrote: On Mon, Apr 29, 2019 at 1:43 PM DL Neil wrote: Well, seeing you ask: a more HTTP-ish approach *might* be: api.update.customer( 1, name='Bob' ) ie api.verb.subject( adjectives and adverbs ) Thus: api_label/intro/ID.what_we're_

Re: Most "pythonic" syntax to use for an API client library

2019-04-28 Thread DL Neil
On 29/04/19 4:52 PM, Chris Angelico wrote: On Mon, Apr 29, 2019 at 2:43 PM DL Neil wrote: On 29/04/19 3:55 PM, Chris Angelico wrote: On Mon, Apr 29, 2019 at 1:43 PM DL Neil wrote: Well, seeing you ask: a more HTTP-ish approach *might* be: api.update.customer( 1, name='Bob&#

Generating generations of files

2019-04-29 Thread DL Neil
Are you aware of a library/utility which will generate and maintain the file names of multiple generations of a file? The system generates multiple output files. For example, one might be called "output.rpt". However, we do not want to 'lose' the output file(s) from any previous run(s). In th

Re: Generating generations of files

2019-04-29 Thread DL Neil
On 30/04/19 8:12 AM, Grant Edwards wrote: On 2019-04-29, DL Neil wrote: Are you aware of a library/utility which will generate and maintain the file names of multiple generations of a file? Well, the FILES-11 filesystem on VAX/VMS did that automatically, but that's probably not too he

Re: Generating generations of files

2019-04-29 Thread DL Neil
On 30/04/19 8:17 AM, MRAB wrote: On 2019-04-29 20:59, DL Neil wrote: Are you aware of a library/utility which will generate and maintain the file names of multiple generations of a file? OTOH, using generation-numbers when there are many versions, (?surely) requires a 'ripple' o

Re: Generating generations of files

2019-04-29 Thread DL Neil
On 30/04/19 9:04 AM, Peter J. Holzer wrote: On 2019-04-29 20:12:28 -, Grant Edwards wrote: On 2019-04-29, DL Neil wrote: Are you aware of a library/utility which will generate and maintain the file names of multiple generations of a file? Well, the FILES-11 filesystem on VAX/VMS did

Re: Generating generations of files

2019-04-29 Thread DL Neil
On 30/04/19 10:59 AM, Chris Angelico wrote: On Tue, Apr 30, 2019 at 8:16 AM Eli the Bearded <*@eli.users.panix.com> wrote: bet a FAT filesystem would produce a different error Probably it'd raise BadFileSystemError or something. Which is a subclass of OSError, SystemError, TimeoutError, Overfl

Re: Generating generations of files

2019-04-29 Thread DL Neil
On 30/04/19 8:04 AM, Chris Angelico wrote: On Tue, Apr 30, 2019 at 6:00 AM DL Neil wrote: Are you aware of a library/utility which will generate and maintain the file names of multiple generations of a file? Commit it to a git repository. All the generations have the same name, but you can

Re: Generating generations of files

2019-04-29 Thread DL Neil
On 30/04/19 11:57 AM, Chris Angelico wrote: On Tue, Apr 30, 2019 at 9:46 AM Eli the Bearded <*@eli.users.panix.com> wrote: In comp.lang.python, DL Neil wrote: On 30/04/19 10:59 AM, Chris Angelico wrote: bet a FAT filesystem would produce a different error Probably it&#

Re: Python best practice instantiating classes in app

2019-04-29 Thread DL Neil
Dave, On 30/04/19 7:36 AM, Dave wrote: On 4/29/19 3:26 PM, Terry Reedy wrote: On 4/29/2019 1:38 PM, Dave wrote: As apps get more complex we add modules, or Python files, to organize things.  One problem I have is a couple of data classes (list of dictionary objects) in a few modules that are

Re: Errorcode when running scripts in PyCharm

2019-05-02 Thread DL Neil
On 2/05/19 11:05 PM, Hampus Sjödin wrote: Hey guys, so I've managed to ruin PyCharm for myself.. I just finished my first script in PyCharm and I tried renaming the file, so I closed PyCharm to reenter the file using the file manager.. And now it won't run when I try to. This is what I get: C

Re: Help a noob out

2019-05-02 Thread DL Neil
On 2/05/19 9:30 PM, Arup Rakshit wrote: The input function returns the string value. So you need to convert it to number before the math you do. birth_year = input("What year are you born? ") current_year = 2019 print(type(birth_year)) age = current_year - int(birth_year) print(age) — py

Re: How to pass username and password in the curl requests using requests python module

2019-05-02 Thread DL Neil
On 2/05/19 11:30 PM, Pradeep Patra wrote: Can anyone pls help in this regard? Yes! | | | | | | | | | | | | | | | | | | | | | | V However, whilst accurate, that answer in NOT helpful? The question is so wide. Which part(s) should we answer? Why

Configuration confusion = Friday Filosofical Finking

2019-05-03 Thread DL Neil
When configuring an application, which mechanisms do you [not] use for setting particular operating-parameters, and/or do you *only* utilise a particular method to initialise certain categories of configuration-data? Apologies: as they say in football, this is a game of two halves... 1 In th

Re: Populating a timetable with subjects

2019-05-03 Thread DL Neil
On 4/05/19 11:51 AM, Cameron Simpson wrote: On 01May2019 19:22, [email protected] wrote: We have to populate a timetable with subjects. What would be the best approach? That's a pretty open ended question. Often a constraint on generating timetables involves ensuring that no 2 subjects use

Re: Getter is not returning the data it should be

2019-06-01 Thread DL Neil
Bonjour Barb, Please allow me to answer your question, somewhat, backwards:- There is a principle in program design known as "separation of concerns". If you look at the class SimpleGrid and consider that the bulk of its code lies after the first comment, how would you summarise (in English)

Re: How to concatenate strings with iteration in a loop?

2019-06-01 Thread DL Neil
On 21/05/19 8:40 PM, Paul Moore wrote: On Tue, 21 May 2019 at 09:25, Frank Millman wrote: On 2019-05-21 9:42 AM, Madhavan Bomidi wrote: Hi, I need to create an array as below: tempStr = year+','+mon+','+day+','+str("{:6.4f}".format(UTCHrs[k]))+','+ \ str("{:9.7f}".format(AExt[k,0]))+','+str

Re: Understand workflow about reading and writing files in Python

2019-06-18 Thread DL Neil
I've not gone 'back' to refer to any ComSc theory on buffer-management. Perhaps you might benefit from such? I like your use of the word "shift", so I'll continue to use it. There are three separate units of data to consider - each of which could be called a "buffer". To avoid confusing (mysel

Re: Python refactoring question and create dynamic attributes

2019-06-23 Thread DL Neil
On 23/06/19 7:56 PM, Arup Rakshit wrote: In the below code: @classmethod def find(self, id): if isinstance(id, list): rows = self.__table__().get_all(*id).run(self.__db__().conn) result = [] for row in rows: acategory = C

Re: Understand workflow about reading and writing files in Python

2019-06-23 Thread DL Neil
Yes, better to reply to list - others may 'jump in'... On 20/06/19 5:37 PM, Windson Yang wrote: Thank you so much for you review DL Neil, it really helps :D. However, there are some parts still confused me, I replyed as below. It's not a particularly easy topic... DL Neil

Re: Understand workflow about reading and writing files in Python

2019-06-25 Thread DL Neil
On 25/06/19 11:50 AM, Windson Yang wrote: DL Neil <mailto:[email protected]>> 于2019年6月24日周一 上午11:18写道: Yes, better to reply to list - others may 'jump in'... On 20/06/19 5:37 PM, Windson Yang wrote: > Thank you so much for you review DL Ne

Re: pandas split and melt()

2019-06-25 Thread DL Neil
On 26/06/19 6:13 PM, Sayth Renshaw wrote: Hi Having fun with pandas filtering a work excel file. My current script opens selected and filters the data and saves as excel. ... This leaves me with a set of several columns. The main column of concern for this example is a consultant Session date

Re: Plumbing behind super()

2019-06-27 Thread DL Neil
On 28/06/19 12:13 PM, [email protected] wrote: I'm trying to mimick Python 3.6 as a .NET science project and have started to get into subclassing. The super() not-a-keyword-honestly-guys has tripped me up. I have to admit that I've professionally been doing a ton Python 2.7, so I'm not goo

Re: Use global, or not

2019-06-28 Thread DL Neil
On 29/06/19 1:44 AM, Cecil Westerhof wrote: I have written a GUI program where I have quit a few global variables. I did not like this, so I now use one global dict. Something like: global global_dict ... Is that an acceptable way to do this? If it works, isn't that the largest part of

Re: Use global, or not

2019-06-29 Thread DL Neil
On 29/06/19 11:42 PM, Cecil Westerhof wrote: DL Neil writes: On 29/06/19 1:44 AM, Cecil Westerhof wrote: I have written a GUI program where I have quit a few global variables. I did not like this, so I now use one global dict. Something like: global global_dict ... Is that an

Re: Cannot delete or modify

2019-07-09 Thread DL Neil
Hi, welcome to the Python community! On 10/07/19 12:24 PM, Hla Kyi via Python-list wrote: Dear Sir / Madam,     I have subscribed mailing Python-list.    I have installed and used " Python 3.7.2". I try to modify or uninstall it. Please see the attached screen shot.    Please help me how to

Re: Problem to delete or modify Python program and to read "signature.asc"

2019-07-11 Thread DL Neil
On 12/07/19 1:52 PM, Hla Kyi via Python-list wrote: Dear Sir/ Madam,     1. I try to modify, some of the check boxes can not be selected.    2. I try to uninstall, "successfully uninstall" message is come out. When I exit it "if you have any problem, please contact  [email protected] " me

Re: Books for Python 3.7

2019-07-15 Thread DL Neil
Wlfraed probably knows a thing-or-two about kicking-over ants' nests/wasps' nests... Talking about books is one thing. Judging them by asyncio coverage is quite another - and rather unfair. The use and methods of asyncio have changed frequently and markedly since '3.0'. Books take time to prod

Embedding classes' names

2019-07-15 Thread DL Neil
When used, do you embed a class's name within its own code, as a literal? In the thread "super or not super?", the OP asked: <<< C1.__init__(self) or super().__init__() >>> One of the answers recommended super() [agreed!] in order to avoid embedding "C1" into the code. The expl

Re: Class initialization with multiple inheritance

2019-07-15 Thread DL Neil
On 16/07/19 12:13 PM, Joseph L. Casale wrote: I am trying to find explicit documentation on the initialization logic for a Base class when multiple exist. For the example in the documentation at https://docs.python.org/3/tutorial/classes.html#multiple-inheritance, if Base1 and Base2 both themselv

Re: Embedding classes' names

2019-07-17 Thread DL Neil
On 16/07/19 10:57 PM, Cameron Simpson wrote: On 16Jul2019 10:20, Chris Angelico wrote: On Tue, Jul 16, 2019 at 10:17 AM DL Neil wrote: When used, do you embed a class's name within its own code, as a literal? [...] So, what about other situations where one might need to access the cl

Re: super() in Python 3

2019-07-17 Thread DL Neil
On 16/07/19 10:08 PM, אורי wrote: Hi, 1. When we use super() in Python 3, we don't pass it the first argument (self). Why? What happens if the first argument is not self? def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) I think it would make more sense to use someth

Re: How to execute shell command in Python program?

2019-07-20 Thread DL Neil
On 21/07/19 5:07 AM, Peter J. Holzer wrote: On 2019-07-20 15:39:58 +0100, Chris Narkiewicz via Python-list wrote: Madhavan Bomidi wrote: import subprocess subprocess.call(['./opac'],shell=True) There may be an os.chdir() missing here. subprocess.call(['./opac', "my-input.inp"], shell=True)

Namespaces: memory vs 'pollution'

2019-07-20 Thread DL Neil
How do you remember to from-import- 'everything' that is needed? I have a 'utility module' which contains a bunch of classes which examine/check/log aspects of the execution environment. One of which is PythonEnvironment, another relates to the HostSystem (as examples). They are most-frequent

Re: Namespaces: memory vs 'pollution'

2019-07-21 Thread DL Neil
On 22/07/19 5:30 AM, Roel Schroeven wrote: DL Neil schreef op 21/07/2019 om 2:02: How do you remember to from-import- 'everything' that is needed? ... > Upon closer inspection, I realised it didn't just fail; it failed badly! Some silly, little, boy had imported the Pytho

Re: Namespaces: memory vs 'pollution'

2019-07-22 Thread DL Neil
On 23/07/19 11:00 AM, Ethan Furman wrote: On 07/20/2019 05:02 PM, DL Neil wrote: Upon closer inspection, I realised it didn't just fail; it failed badly! Some silly, little, boy had imported the PythonEnvironment class but failed to ALSO import PythonVersionError. So, the reported erro

Nesting Custom Errors in Classes

2019-07-22 Thread DL Neil
Do you use nested classes? [following-on from the earlier, "Namespaces: memory vs 'pollution'" discussion thread, wherein a certain 'someone' remembered to from ... import ... as ... an 'action' class but forgot to also import the related custom error class! The original quest was for a wild-c

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