Re: Printing dict value for possibly undefined key

2023-11-25 Thread DL Neil via Python-list
On 11/25/2023 3:31 AM, Loris Bennett via Python-list wrote: Hi, I want to print some records from a database table where one of the fields contains a JSON string which is read into a dict. I am doing something like print(f"{id} {d['foo']} {d['bar']}") However, the dict does not always have

Re: Newline (NuBe Question)

2023-11-26 Thread DL Neil via Python-list
On 11/27/2023 12:48 AM, Chris Angelico via Python-list wrote: On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list wrote: On 24/11/2023 21.45, avi.e.gr...@gmail.com wrote: Grizz[l]y, I think the point is not about a sorted list or sorting in general It is about reasons why mainta

Re: Newline (NuBe Question)

2023-11-26 Thread DL Neil via Python-list
On 11/27/2023 1:08 AM, Roel Schroeven via Python-list wrote: I prefer namedtuples or dataclasses over tuples. They allow you to refer to their fields by name instead of index: student.gpa is much clearer than student[2], and makes it less likely to accidentally refer to the wrong field. +1 re

Re: Newline (NuBe Question)

2023-11-26 Thread DL Neil via Python-list
On 11/27/2023 10:04 AM, Peter J. Holzer via Python-list wrote: On 2023-11-25 08:32:24 -0600, Michael F. Stemper via Python-list wrote: On 24/11/2023 21.45, avi.e.gr...@gmail.com wrote: Of course, for serious work, some might suggest avoiding constructs like a list of lists and switch to using m

Re: Newline (NuBe Question)

2023-11-26 Thread 'DL Neil' via Python-list
Avi, On 11/27/2023 4:15 PM, avi.e.gr...@gmail.com wrote: Dave, Back on a hopefully more serious note, I want to make a bit of an analogy with what happens when you save data in a format like a .CSV file. Often you have a choice of including a header line giving names to the resulting columns,

Re: "Edit With Python" option missing

2019-09-01 Thread DL Neil via Python-list
Hi Aakash, On 31/08/19 8:54 PM, Akash verma wrote: "Edit With Python" option missing from message context when right clicked with mouse . There are two stages to working with a Python program: editing the source-code, and executing the program. For the first, most use a text editor/IDE, eg

Re: Hi how do I import files inside a txt file?

2019-09-02 Thread DL Neil via Python-list
On 3/09/19 1:48 AM, Spencer Du wrote: On Monday, 2 September 2019 15:29:07 UTC+2, Joel Goldstick wrote: On Mon, Sep 2, 2019 at 9:21 AM Spencer Du wrote: On Monday, 2 September 2019 15:03:52 UTC+2, Joel Goldstick wrote: On Mon, Sep 2, 2019 at 8:46 AM Spencer Du wrote: On Monday, 2 Septem

Re: How to remove a string from a txt file?

2019-09-04 Thread DL Neil via Python-list
On 5/09/19 3:08 AM, Spencer Du wrote: Hi I want to remove a string from a txt file and then print out what I have removed. How do I do this. The txt file is in this format and should be kept in this format. txt.txt: laser,cameras, Is this a homework assignment? What code do you have so far

Re: Formatting floating point

2019-09-04 Thread DL Neil via Python-list
On 5/09/19 5:12 AM, Dave via Python-list wrote: ... My question is why, and where do I find a reliable source of information on formatting numbers?  Not interested in replacement values like '{} {}'.format(1, 2). Agreed: there's ton(ne)s of information 'out there', much of it old, eg Python

Re: Finding lines in .txt file that contain keywords from two different set()

2019-09-08 Thread DL Neil via Python-list
On 9/09/19 4:02 AM, A S wrote: My problem is seemingly profound but I hope to make it sound as simplified as possible.Let me unpack the details..: ... These are the folders used for a better reference ( https://drive.google.com/open?id=1_LcceqcDhHnWW3Nrnwf5RkXPcnDfesq ). The files are

WedWonder: Scripts and Modules

2019-09-11 Thread DL Neil via Python-list
In this day-and-age do you have a script in live/production-use, which is also a module? What is the justification/use case? (discounting distutils and similar installation tools, or unit testing methodology) There are over 500 questions on StackOverflow which refer to Python's if _

Re: WedWonder: Scripts and Modules

2019-09-11 Thread DL Neil via Python-list
On 12/09/19 8:43 AM, Chris Angelico wrote: On Thu, Sep 12, 2019 at 6:34 AM DL Neil via Python-list wrote: In this day-and-age do you have a script in live/production-use, which is also a module? What is the justification/use case? Yes, absolutely. It's the easiest way to share

Re: Email messages from grouped email using IMAPClient in Python.

2019-09-11 Thread DL Neil via Python-list
On 12/09/19 5:06 PM, Srinivas Pullabhotla wrote: Hello, I am trying to fetch email messages from a gmail inbox. So, there will be 1000s of messages sent to Inbox and since they are 1000s, the emails are grouped 100 per each email item. When I tried this method, the program only fetches some b

Re: WedWonder: Scripts and Modules

2019-09-11 Thread DL Neil via Python-list
On 12/09/19 10:37 AM, Alan Bawden wrote: DL Neil writes: ... However, reversing the question in my mind led me to ask (myself): how many scripts do I have (in "production use") which are ever used (also) as a module by some other script? I think the answer is/was: "none"! Accordingly, (spoiler

Re: WedWonder: Scripts and Modules

2019-09-12 Thread DL Neil via Python-list
On 12/09/19 10:59 AM, Cameron Simpson wrote: On 12Sep2019 08:24, DL Neil wrote: In this day-and-age do you have a script in live/production-use, which is also a module? What is the justification/use case? Many. Many many. 1: Many of my modules run their unit tests if invoked as the main pro

Re: WedWonder: Scripts and Modules

2019-09-12 Thread DL Neil via Python-list
On 12/09/19 8:22 PM, Barry Scott wrote: On 11 Sep 2019, at 21:24, DL Neil via Python-list wrote: In this day-and-age do you have a script in live/production-use, which is also a module? What is the justification/use case? (discounting distutils and similar installation tools, or unit

Friday Finking: 'main-lines' are best kept short

2019-09-12 Thread DL Neil via Python-list
(this follows some feedback from the recent thread: "WedWonder: Scripts and Modules" and commences a somewhat-related topic/invitation to debate/correct/educate) Is it a good idea to keep a system's main-line* code as short as possible, essentially consigning all of 'the action' to applicatio

Re: python is bugging

2019-09-21 Thread DL Neil via Python-list
On 22/09/19 5:08 AM, Dave Martin wrote: On Saturday, September 21, 2019 at 12:44:27 PM UTC-4, Brian Oney wrote: On Sat, 2019-09-21 at 08:57 -0700, Dave Martin wrote: On Saturday, September 21, 2019 at 11:55:29 AM UTC-4, Dave Martin wrote: what does expected an indented block *what does an in

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread DL Neil via Python-list
On 26/09/19 9:14 PM, RobH wrote: I have some sample/demo python code for scrolling and outputting text onto a 16x2 lcd display. I would like to put my own message or text outputting to the lcd on 2 lines. I have tried using lcd.message('my message',1) and lcd.message('my message', 2), but the

Re: NEWBIE: how to get text onto 2 lines on a 16x2 lcd display

2019-09-26 Thread DL Neil via Python-list
On 27/09/19 7:21 AM, RobH wrote: On 26/09/2019 17:51, Dennis Lee Bieber wrote: On Thu, 26 Sep 2019 11:58:15 +0100, RobH declaimed the following: ... Check out this guide for info on using character LCDs with the CircuitPython library: https://learn.adafruit.com/character-lcds/python-circuit

pathlib

2019-09-29 Thread DL Neil via Python-list
Should pathlib reflect changes it has made to the file-system? Sample code, below, shows pathlib identifying a data-file and then renaming it. Yet, after the rename operation, pathlib doesn't recognise its own change; whereas the file system does/proves the change was actioned. $ touch bef

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 6:13 AM, Dan Sommers wrote: On 9/30/19 12:51 PM, Chris Angelico wrote: On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers ... All I'm doing is defending the OP, who was surprised that renaming a file *using a Path instance* didn't reflect that operation *in that Path instance*.  I believe

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 30/09/19 9:28 PM, 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. The term "concrete" is applied to Path(), PosixPath(), and WindowsPath() - whereas the

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 1:09 AM, Chris Angelico wrote: On Mon, Sep 30, 2019 at 9:54 PM Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: I would have said the same thing, but the docs⁰ disagree: a PurePath represents the name of (or the path to) a file, but a Path represents the actual file. ⁰ https

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 1: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: Should pathlib reflect changes it has made to the file-system? I

Re: pathlib

2019-09-30 Thread DL Neil via Python-list
On 1/10/19 3:21 AM, Dan Sommers wrote: 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

Re: pathlib

2019-10-01 Thread DL Neil via Python-list
On 1/10/19 2:58 PM, Dan Sommers wrote: On 9/30/19 3:56 PM, Barry Scott wrote: On 30 Sep 2019, at 16:49, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com > wrote: In the totality of a Path object that claims to represent paths to files, It represent

Re: pathlib

2019-10-02 Thread DL Neil via Python-list
On 2/10/19 12:52 AM, Rhodri James wrote: On 01/10/2019 06:03, DL Neil via Python-list wrote: On 30/09/19 9:28 PM, 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. The term

Re: pathlib

2019-10-02 Thread DL Neil via Python-list
On 3/10/19 6:25 AM, Barry Scott wrote: On 2 Oct 2019, at 09:14, DL Neil via Python-list mailto:python-list@python.org>> wrote: On 2/10/19 12:52 AM, Rhodri James wrote: On 01/10/2019 06:03, DL Neil via Python-list wrote: On 30/09/19 9:28 PM, Barry Scott wrote: On 30 Sep 2019, at 05:40, D

Re: pathlib

2019-10-02 Thread DL Neil via Python-list
On 3/10/19 3:07 AM, Rhodri James wrote: On 02/10/2019 09:14, DL Neil via Python-list wrote: That said, it is one of the ways that a path can be shown to transition from some 'pure' state to become 'concrete'. However, A.N.Other has suggested that I might be mis-applying

Re: pathlib

2019-10-02 Thread DL Neil via Python-list
On 3/10/19 12:42 AM, Dan Sommers wrote: 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, c

Re: Formatting floating point

2019-10-07 Thread DL Neil via Python-list
On 8/10/19 4:04 AM, boffi wrote: DL Neil writes: Agreed: there's ton(ne)s of information 'out there', much of it old, eg Python2, "formatter" (deprecated since v3.4) ? are you referring to the `string.Formatter`[*] class? $ python Python 3.7.4 (default, Aug 13 2019, 20:35:49) [

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-07 Thread DL Neil via Python-list
On 8/10/19 3:45 PM, jf...@ms4.hinet.net wrote: For example: from my-dir import test I know it can be solved by renaming, but any alternative? The manual is your friend: - import - importlib (the latter allows modules to be identified by strings) However, Pythons has naming rules. If you try

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread DL Neil via Python-list
On 9/10/19 2:12 PM, jf...@ms4.hinet.net wrote: dieter於 2019年10月8日星期二 UTC+8下午1時33分20秒寫道: jf...@ms4.hinet.net writes: ... But most of the download from Github has a directory named '-master' which causes a trouble sometimes. Those are likely not meant to be imported directly. Typically, y

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread DL Neil via Python-list
On 9/10/19 2:46 PM, Chris Angelico wrote: On Wed, Oct 9, 2019 at 12:36 PM DL Neil via Python-list wrote: ... (Or just using pip to install directly from GitHub, although not everyone knows that that's possible.) Come on, you just knew I was going to ask how... -- Regards =dn --

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread DL Neil via Python-list
On 9/10/19 4:34 PM, jf...@ms4.hinet.net wrote: jf...@ms4.hinet.net於 2019年10月8日星期二 UTC+8上午10時45分36秒寫道: For example: from my-dir import test I know it can be solved by renaming, but any alternative? --Jach Maybe another (better?) solution is: import sys sys.path.append(r'my-dir') import test

Instantiating sub-class from super

2019-10-14 Thread DL Neil via Python-list
Is there a technique or pattern for taking a (partially-) populated instance of a class, and re-creating it as an instance of one of its sub-classes? In a medically-oriented situation, we have a Person() class, and start collecting information within an instance (person = Person(), etc). Du

Re: Instantiating sub-class from super

2019-10-14 Thread DL Neil via Python-list
Hi Greg, On 15/10/19 11:37 AM, Gregory Ewing wrote: DL Neil wrote: Is there a technique or pattern for taking a (partially-) populated instance of a class, and re-creating it as an instance of one of its sub-classes? Often you can assign to the __class__ attribute of an instance to change i

Re: Instantiating sub-class from super

2019-10-15 Thread DL Neil via Python-list
On 16/10/19 12:38 AM, Rhodri James wrote: On 14/10/2019 21:55, DL Neil via Python-list wrote: ... It seemed better (at the design-level) to have Man( Person ) and Woman( Person ) sub-classes to contain the pertinent attributes, source more detailed and specific questions, and collect such

Re: Instantiating sub-class from super

2019-10-15 Thread DL Neil via Python-list
On 16/10/19 1:55 PM, duncan smith wrote: On 15/10/2019 21:36, DL Neil wrote: On 16/10/19 12:38 AM, Rhodri James wrote: On 14/10/2019 21:55, DL Neil via Python-list wrote: ... So, yes, the "label" is unimportant - except to politicians and statisticians, who want precise answers

Re: Instantiating sub-class from super

2019-10-18 Thread DL Neil via Python-list
On 16/10/19 6:33 PM, Frank Millman wrote: On 2019-10-14 10:55 PM, DL Neil via Python-list wrote: Is there a technique or pattern for taking a (partially-) populated instance of a class, and re-creating it as an instance of one of its sub-classes? Here is a link to an article entitled

Re: Instantiating sub-class from super

2019-10-18 Thread DL Neil via Python-list
On 17/10/19 4:08 AM, Piet van Oostrum wrote: DL Neil writes: That said, if a "trans" person has ovaries or testes (for example) then a non-traditional sexual identification is irrelevant - for medical purposes. Diseases in those areas (and now I'm a long way from a research questionnaire and f

Re: Instantiating sub-class from super

2019-10-18 Thread DL Neil via Python-list
On 17/10/19 7:52 AM, MRAB wrote: On 2019-10-16 19:43, duncan smith wrote: On 16/10/2019 04:41, DL Neil wrote: On 16/10/19 1:55 PM, duncan smith wrote: On 15/10/2019 21:36, DL Neil wrote: On 16/10/19 12:38 AM, Rhodri James wrote: On 14/10/2019 21:55, DL Neil via Python-list wrote: ... So

Re: Instantiating sub-class from super

2019-10-18 Thread DL Neil via Python-list
On 18/10/19 9:27 AM, Eryk Sun wrote: On 10/17/19, MRAB wrote: On 2019-10-17 20:06, Eryk Sun wrote: I'm bugged by how the article mis-characterizes the fundamental problem. The operating system has nothing to do with the order of a directory listing, which varies even with an OS, depending on

Re: Black

2019-10-21 Thread DL Neil via Python-list
Top posting? Agreed. As my eyes age (they're even older than my teeth!) I find the additional horizontal white space improves (my) comprehension, particularly when dealing with a dense nesting of structures. Of course the more 'across' the text stretches, the more likely a vertical expansio

Re: TypeError: unhashable type: 'list'

2019-10-23 Thread DL Neil via Python-list
On 23/10/19 8:51 PM, joseph pareti wrote: I am experimnenting with this (reproducer) code: pattern_eur= ['Total amount'] mylines = []# Declare an empty list. with open ('tmp0.txt', 'rt') as myfile: # Open tmp.txt for reading text. for myline in myfile:

Re: Black

2019-10-23 Thread DL Neil via Python-list
On 22/10/19 3:18 AM, lizhollinshe...@gmail.com wrote: What do people think about black? I'm asking because one of my personal preferences is to use spaces for clarity: 1. right = mystr[ start : ] black version right=mystr[start:] 2. mtime = time.asctime( time.localtime( info.s

Fursday Flippancy: American Py

2019-10-23 Thread DL Neil via Python-list
[via PlanetPython] The "American Py" song. Lyrics which amused me, at https://www.reddit.com/r/Python/comments/dfm2zv/american_py/ 'Multi-taskers' may like to read and listen-along to: https://www.youtube.com/watch?v=uAsV5-Hv-7U For the benefit of us silver-surfers reliving our youth (or for t

Congratulations to @Chris

2019-10-24 Thread DL Neil via Python-list
Chris Angelico: [PSF's] 2019 Q2 Community Service Award Winner http://pyfound.blogspot.com/2019/10/chris-angelico-2019-q2-community.html ...and for the many assistances and pearls of wisdom he has contributed 'here'! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Instantiating sub-class from super

2019-10-24 Thread DL Neil via Python-list
On 25/10/19 4:29 AM, Frank Millman wrote: On 2019-10-19 12:37 AM, DL Neil via Python-list wrote: On 16/10/19 6:33 PM, Frank Millman wrote: On 2019-10-14 10:55 PM, DL Neil via Python-list wrote: Is there a technique or pattern for taking a (partially-) populated instance of a class, and re

Re: Installing Python 3.8 on PC with Python 3.7. How to do with version conflicts?

2019-10-28 Thread DL Neil via Python-list
Dottore, On 28/10/19 7:37 AM, Dott. Ugo Donini wrote: I cannot use Python 3.8 on my PC with installed Python 3.7. Is it possible to update the existing Python 3.7 without reinstalling Python 3.8. Conflicts problems. Thankyou Ugo Donini Inviato da Posta per Windows 10 If the question is abou

Friday finking: TDD and EAFP

2019-10-31 Thread DL Neil via Python-list
Is the practice of TDD fundamentally, if not philosophically, somewhat contrary to Python's EAFP approach? TDD = Test-Driven Development EAFP = it's easier to ask forgiveness than permission * WebRefs as footnote The practice of TDD* is that one writes test routines to prove a unit of code,

Re: How can i stop this Infinite While Loop - Python

2019-11-01 Thread DL Neil via Python-list
TLDR; declare if homework; doing someone's homework doesn't really help; Python is not ALGOL/Pascal/C/C++ by any other name; Python assignments should promote learning semantics as well as syntax; sometimes re-stating the problem leads to an alternate/better solution. On 31/10/19 12:55 AM, fe

Re: Friday finking: TDD and EAFP

2019-11-03 Thread DL Neil via Python-list
On 3/11/19 6:30 AM, Bev In TX wrote: On Nov 1, 2019, at 12:40 AM, DL Neil via Python-list mailto:python-list@python.org>> wrote: Is the practice of TDD fundamentally, if not philosophically, somewhat contrary to Python's EAFP approach? I’m not an expert on either TDD or Python

Re: Friday finking: TDD and EAFP

2019-11-03 Thread DL Neil via Python-list
On 2/11/19 4:32 PM, boB Stepp wrote: On Fri, Nov 1, 2019 at 12:42 AM DL Neil via Python-list wrote: Is the practice of TDD fundamentally, if not philosophically, somewhat contrary to Python's EAFP approach? [...] In encouraging my mind to think about testing the code, I find m

Re: Looking for python pentest scripts

2019-11-10 Thread DL Neil via Python-list
On 11/11/19 12:36 AM, nixuser wrote: can someone tell about good resource for python related pentesting scripts? any extensive list? What is the purpose of such scripts/list? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Looking for python pentest scripts

2019-11-11 Thread DL Neil via Python-list
On 11/11/19 4:39 PM, Terry Reedy wrote: On 11/10/2019 7:32 PM, Bob Gailer wrote: On Nov 10, 2019 6:40 AM, "nixuser" wrote: can someone tell about good resource for python related pentesting scripts? any extensive list? > Try Googling python pentesting. That will give you some relevant links.

Re: Hi there! We are here to answer any questions you have about Udacit...

2019-11-11 Thread DL Neil via Python-list
On 12/11/19 7:14 AM, joseph pareti wrote: i have done the first 6 lessons of python --- https://classroom.udacity.com/courses/ud1110/lessons/bbacebc6-406a-4dc5-83f6-ef7ba3371da6/concepts/50247542-7933-4afe-9130-ff1dff429b03 what do you recommend next? My goal is ML/AI As with any professional

Re: apologies for my latest email; it was not intended for this mailing list

2019-11-11 Thread DL Neil via Python-list
Because of something we said? (to upset you=joke!) -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Hi there! We are here to answer any questions you have about Udacit...

2019-11-12 Thread DL Neil via Python-list
On 12/11/19 9:48 PM, joseph pareti wrote: great, thank you so much for the advice. In fact, I sent this mail to the python mailing list by mistake, but now I am glad I did ... There's plenty of over-lap between lists - PyTutor is another. Meantime I've received email from IBM about their ML/AI

Re: Friday finking: TDD and EAFP

2019-11-12 Thread DL Neil via Python-list
Apologies for lateness - stuff happened... On 4/11/19 9:44 AM, Peter J. Holzer wrote: On 2019-11-04 07:41:32 +1300, DL Neil via Python-list wrote: On 3/11/19 6:30 AM, Bev In TX wrote: On Nov 1, 2019, at 12:40 AM, DL Neil via Python-list mailto:python-list@python.org>> wrote: Is the pr

Re: Friday finking: TDD and EAFP

2019-11-12 Thread DL Neil via Python-list
On 6/11/19 8:01 AM, Barry Scott wrote: On 1 Nov 2019, at 05:40, DL Neil via Python-list wrote: Is the practice of TDD fundamentally, if not philosophically, somewhat contrary to Python's EAFP approach? The practice of TDD* is that one writes test routines to prove a unit of code, eg m

Re: Writing a CPython extension - calling another sibbling method ?

2019-11-19 Thread DL Neil via Python-list
On 20/11/19 9:20 AM, Luciano Ramalho wrote: I apologize to all but the intended recipient for this. I’d have given him feedback in private if I knew his email. I will take leave from the list now. Keep up the good work, friendly responders. Please reconsider. Should your relationship with the

Re: Python Resources related with web security

2019-11-23 Thread DL Neil via Python-list
Curiosity: why have recent similar enquiries also come from non-resolving domain names? Recently we've seen security-related enquiries (on more than one Python Discussion List) which don't explicitly claim to come from 'white hat hackers' but which do have the potential to have less-than prod

Re: Python 3.8 with Anaconda

2019-11-24 Thread DL Neil via Python-list
On 25/11/19 6:26 AM, Ugo Donini wrote: It is lossible to update Anaconda to Pytho. 3.8? First 'hit' on DuckDuckGo.com: https://www.anaconda.com/keeping-anaconda-date/ If it is not yet available, they are the ones to ask if/when a 3.8 collection will be assembled... -- Regards =dn -- https

Re: Python Resources related with web security

2019-11-25 Thread DL Neil via Python-list
On 26/11/19 11:48 AM, Tim Chase wrote: On 2019-11-25 21:25, Pycode wrote: On Sun, 24 Nov 2019 10:41:29 +1300, DL Neil wrote: Are such email addresses 'open' and honest? you are not being helpful or answer the question.. What DL Neil seems to be getting at is that there's been an uptick in q

Re: Extract sentences in nested parentheses using Python

2019-12-02 Thread DL Neil via Python-list
On 3/12/19 6:00 AM, Peter Otten wrote: A S wrote: I think I've seen this question before ;) In addition to 'other reasons' for @Peter's comment, it is a common ComSc worked-problem or assignment. (in which case, we'd appreciate being told that you/OP is asking for help with "homework") I

Re: Unicode filenames

2019-12-06 Thread DL Neil via Python-list
On 7/12/19 7:17 AM, Bob van der Poel wrote: I have some files which came off the net with, I'm assuming, unicode characters in the names. I have a very short program which takes the filename and puts into an emacs buffer, and then lets me add information to that new file (it's a poor man's DB).

Re: Make warning an exception?

2019-12-06 Thread DL Neil via Python-list
On 7/12/19 9:58 AM, Israel Brewster wrote: I was running some code and I saw this pop up in the console: 2019-12-06 11:53:54.087 Python[85524:39651849] WARNING: nextEventMatchingMask should only be called from the Main Thread! This will throw an exception in the future. The only problem is, I

Re: Error getting data from website

2019-12-06 Thread DL Neil via Python-list
On 7/12/19 12:53 PM, Sam Paython wrote: This is the code I am writing: import requests from bs4 import BeautifulSoup request = requests.get("https://www.amazon.ca/dp/B07RZFQ6HC";) content = request.content soup = BeautifulSoup(content, "html.parser") element = soup.find("span",{"id":"priceblock_d

Re: Error getting data from website

2019-12-06 Thread DL Neil via Python-list
On 7/12/19 1:51 PM, Chris Angelico wrote: On Sat, Dec 7, 2019 at 11:46 AM Michael Torrie wrote: On 12/6/19 5:31 PM, DL Neil via Python-list wrote: If you read the HTML data that the REPL has happily splattered all over your terminal's screen (scroll back) (NB "soup" is easier

Re: Unicode filenames

2019-12-07 Thread DL Neil via Python-list
On 8/12/19 5:50 AM, Bob van der Poel wrote: On Sat, Dec 7, 2019 at 4:00 AM Barry Scott wrote: On 6 Dec 2019, at 18:17, Bob van der Poel wrote: I have some files which came off the net with, I'm assuming, unicode characters in the names. I have a very short program which takes the filename and

Re: Aw: Re: stuck on time

2019-12-08 Thread DL Neil via Python-list
On 8/12/19 9:18 PM, Karsten Hilbert wrote: Sorry, I should have said just the line, and it didn't return anything. OK, a bit strange, but then that might be due to Thonny. Is Thonny an interpreter then. It sort of is, or at least it runs one. We'd like to take that out of the equation. I me

Re: Aw: Re: stuck on time

2019-12-08 Thread DL Neil via Python-list
On 9/12/19 7:47 AM, RobH wrote: On 08/12/2019 16:49, Dennis Lee Bieber wrote: On Sun, 8 Dec 2019 09:44:54 +, RobH declaimed the following: def print_time():   current_time = time.strftime("%I:%M") ... I don't know if that is the correct way as I am just using the code from the proje

Re: Python3 - How do I import a class from another file

2019-12-08 Thread DL Neil via Python-list
On 9/12/19 7:29 AM, R.Wieser wrote: ... Note that in all cases when you import a module (either by import the_file or from the_file importe whatever) you actually import ALL of it So much for my assumption only the class itself would be loaded - and a wrench into my idea to have a number of cl

Re: ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package

2019-12-08 Thread DL Neil via Python-list
On 9/12/19 8:13 AM, b...@bbhoyer.com wrote: Just registered Thanks Hi @bob, welcome to the gang... I am a beginner in Python, been working on class material from Mosh ... from email.mime.multipart import MIMEMultipart ... Here is the error message: Trace

Re: Aw: Re: stuck on time

2019-12-08 Thread DL Neil via Python-list
It's a lot like the misuse of the word "theory". You mean to say that in theory there is no difference between theory and practice, but in practice there is? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: python 3 prefix to infix without too many parethesis

2019-12-09 Thread DL Neil via Python-list
On 10/12/19 8:40 AM, Terry Reedy wrote: On 12/9/2019 6:21 AM, jezka...@gmail.com wrote: Hi, I have got a problem. Is this homework? Same question - that way we know that our task is to help you learn to code in Python, cf a problem with Python itself... Similarly, you may like to know th

Re: Python3 - How do I import a class from another file

2019-12-09 Thread DL Neil via Python-list
It might be becoming 'long', but this discussion contains much of profit to many people! Us 'silver surfers' do need to periodically question those beliefs we hold as 'tenets' of ComSc. Amongst them is RAM (or "core"!) conservation. It remains a virtue somewhat, but at the same time, storage

Re: More efficient/elegant branching

2019-12-09 Thread DL Neil via Python-list
I agree with you, so I'm going to ignore def branch2(a, b, z): and def branch3(a, b, z) because they appear too contrived - and I guess that's fair, in that you've contrived to satisfy pylint. Question: are there other people/factors who/which should be regarded as more important than the lint

Re: distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread DL Neil via Python-list
On 17/12/19 5:19 am, Chris Angelico wrote: On Tue, Dec 17, 2019 at 3:16 AM duncan smith wrote: Hello, Not really specific to Python or matplotlib (but that's what I'm using). I'm looking for a good combination of colours and symbols for scatter plots, and combination of colours and line

Re: Python3 - How do I import a class from another file

2019-12-16 Thread DL Neil via Python-list
Wow, I turned my back to attend to $job and this conversation has 'exploded' (>80 msgs)! TLDR; With apologies, I started to reply to your reply, but then added 'bits' as I read the conversation thereafter. The result (below) is a messy hodge-podge, for which I can only apologise (as I don't ha

Re: distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread DL Neil via Python-list
On 17/12/19 3:37 pm, Dennis Lee Bieber wrote: If, by some chance, external nodes can get to it: http://wlfraed.microdiversity.freeddns.org/BW/BWConv.html } Works for me, no hacking necessary! (photo of ppl dressed-up in Mickey Mouse type costumes) -- Regards =dn -- https://mail.python.org/mail

Re: How to combine a group of lists together

2019-12-20 Thread DL Neil via Python-list
On 21/12/19 6:04 pm, wanghao7...@gmail.com wrote: I utilized .get_text() + .split() functions and obtain this: spe= ['$278.86as', 'of', 'Dec', '20,', '2019,', '06:47', 'PST', '-', 'Details'] ['4.7', 'inches'] ['750', 'x', '1334'] ['64', 'GB'] ['2', 'GB'] ['Apple', 'A11', 'Bionic,', 'Hexa-Core,',

Re: How to extend an object?

2019-12-20 Thread DL Neil via Python-list
On 21/12/19 2:50 pm, Greg Ewing wrote: On 21/12/19 1:59 am, Stefan Ram wrote:    I would like to add a method to a string.    This is not possible in Python? It's not possible. Built-in classes can't have methods added to them. You can define your own subclass of str and give it whatever met

Re: More efficient/elegant branching

2019-12-22 Thread DL Neil via Python-list
On 11/12/19 1:07 AM, Daniel Haude wrote: Hello Neil, thanks for the detailed answer. Question: are there other people/factors who/which should be regarded as more important than the linter's opinion? Yes. Mine. Um, see below... (unless humor) I was just puzzled at the linter's output (took

Re: Most elegant way to do something N times

2019-12-23 Thread DL Neil via Python-list
On 24/12/19 1:04 PM, Chris Angelico wrote: On Tue, Dec 24, 2019 at 10:45 AM Marco Sulla wrote: I encounter with cases like doing a function 6 time with no argument, or same arguments over and over or doing some structral thing N times and I dont know how elegant I can express that to the cod

Re: Lists And Missing Commas

2019-12-23 Thread DL Neil via Python-list
On 24/12/19 1:48 PM, Tim Daneliuk wrote: If I do this: foo = [ "bar", "baz" "slop", "crud" ] Python silently accepts that and makes the middle term "bazslop". BUT, if I do this: foo = [ "bar", "baz" 1, "crud" ] or this: foo = [ "bar", 2 1, "crud" ] The interpreter throws a s

Re: Lists And Missing Commas

2019-12-23 Thread DL Neil via Python-list
On 24/12/19 3:35 PM, Chris Angelico wrote: On Tue, Dec 24, 2019 at 12:56 PM DL Neil via Python-list wrote: However, your point involves the fact that whereas: 1 + 2 # 3 is *clearly* addition, and "a" + "b" # "ab" is *clearly* concatenation "

Re: Lists And Missing Commas

2019-12-23 Thread DL Neil via Python-list
On 24/12/19 5:20 PM, Tim Daneliuk wrote: On 12/23/19 7:52 PM, DL Neil wrote: WebRef: https://docs.python.org/3/reference/lexical_analysis.html Yep, that explains it, but it still feels non-regular to me. From a pointy headed academic POV, I'd like to see behavior consistent across types. A

Re: [Q] __init__ in class

2019-12-26 Thread DL Neil via Python-list
On 27/12/19 12:11 AM, 황병희 wrote: in making class, why we should set "__init__"? so non-init class is useless? actually i did fail to understand __init__'s meaning. what is role of __init__ in class. sincerely, from python beginner. Please be aware that there is a Python Tutor Discussion List.

Re: [Q] __init__ in class

2019-12-26 Thread DL Neil via Python-list
On 27/12/19 10:58 AM, Irv Kalb wrote: On Dec 26, 2019, at 3:11 AM, 황병희 wrote: in making class, why we should set "__init__"? so non-init class is useless? actually i did fail to understand __init__'s meaning. what is role of __init__ in class. ... As an example, let's say that you create a p

Friday Finking: Source code organisation

2019-12-28 Thread DL Neil via Python-list
Is it helpful to, and thus, do you have a style/convention for ordering the methods within each class in your code? Python's "honking great idea" of namespaces enables us to gather functions/methods under a single name-umbrella, thereby avoiding name-clashes/name-space 'pollution'. [Oh yeah!]

Re: Friday Finking: Source code organisation

2019-12-28 Thread DL Neil via Python-list
"Define before use" is a broad principle that I try to follow, even when the code itself doesn't mandate this. IMO it makes the code easier to navigate even when it's not strictly necessary. As others have said, Python mandates that the functions be defined before they're CALLED, but I find that

Re: Friday Finking: Source code organisation

2019-12-28 Thread DL Neil via Python-list
On 29/12/19 2:19 PM, Tim Chase wrote: On 2019-12-29 12:52, Greg Ewing wrote: I tend to do this too, although it's probably just a habit carried over from languages such as Pascal and C where you have to go out of your way to get things in a different order. Apparently I'm not alone in my Pasca

Re: Grepping words for match in a file

2019-12-28 Thread DL Neil via Python-list
On 29/12/19 5:14 AM, Dan Sommers wrote: 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

Re: Friday Finking: Source code organisation

2020-01-01 Thread DL Neil via Python-list
On 29/12/19 5:49 PM, Cameron Simpson wrote: On 29Dec2019 09:49, Chris Angelico wrote: "Define before use" is a broad principle that I try to follow, even when the code itself doesn't mandate this. This generally means that "if name is main" is the very last thing in the file, and if there's a m

Re: Friday Finking: Source code organisation

2020-01-02 Thread DL Neil via Python-list
On 3/01/20 7:36 AM, Terry Reedy wrote: On 1/2/2020 2:46 AM, Cameron Simpson wrote: Inline code under the if...__main__ stuff cannot be called as a function; Which makes it difficult to test app startup. I usually consider the main() function a reusable component. Which, if called (at leas

Re: heap enhancements

2020-01-03 Thread DL Neil via Python-list
On 4/01/20 2:13 PM, rontoto wrote: Hi guys, the code is working, but I want know, what I can improve on this code. It is like implementation of the simulation of shipment clearance in the depot according to priority and available deliveries. How can I do it better? Can u show me? Thnx for your

Re: Python, Be Bold!

2020-01-06 Thread DL Neil via Python-list
On 7/01/20 6:10 AM, Abdur-Rahmaan Janhangeer wrote: On Mon, 6 Jan 2020, 20:50 Rhodri James, wrote: No if you read the thread (please do it), that's the 4th time i'm saying it's a bad idea I have not (been following the thread) - with all due apologies. Podcast of possible interest: Episo

  1   2   3   >