Re: conceptual problem

2021-01-14 Thread Alan Gauld via Python-list
On 13/01/2021 15:37, songbird wrote: > my momentary conceptual problem is that to me OOP means > being able to encapsulate data structures and code from > other parts of the program, That's true, but encapsulation simply means that the data and functions are contained within a single entity -

Re: why sqrt is not a built-in function?

2021-01-14 Thread Alan Gauld via Python-list
On 14/01/2021 17:44, Denys Contant wrote: > I don't understand why sqrt is not a built-in function. > Why do we have to first import the function from the math module? > I use it ALL THE TIME! because pow() is a builtin function and root = pow(x,0.5) is the same as root = math.sqrt(x) As is

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 21:30, Barry Scott wrote: >> During lockdown I've been digging deeper into the curses module >> and lately into the ti family of functions that reside there. > It seems that curses does not allow you to mix raw stdin/stdout with its > calls. That's true of curses after you cal

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 23:08, Grant Edwards wrote: > Alternatively, I think you can use the ncurses library to retrieve the control > strings (just don't use any ncurses input/output calls), like this example > from > https://stackoverflow.com/questions/6199285/tput-cup-in-python-on-the-commandline: > >

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 22:11, Grant Edwards wrote: > Or use a terminfo library: > > https://github.com/DirectXMan12/py-terminfo > > It _may_ be possible to use ncurses to get the terminfo strings > required for various functions without actually having ncurses to any > I/O, but I've never tried that...

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 14/01/2021 16:12, Alan Gauld via Python-list wrote: > # > import curses as cur > cur.setupterm() > > bold = cur.tigetstr('bold') > cls = cur.tigetstr('clear') > > cur.putp(cls) > name = input("Hello, what's your name?

Re: Exploring terminfo

2021-01-15 Thread Alan Gauld via Python-list
On 15/01/2021 17:31, Grant Edwards wrote: >>> cur.putp(cls) >>> name = input("Hello, what's your name? ") >>> >>> cur.putp(bold) >>> print("Nice to meet you ", name) >> putp(clr); >> putp(bold); >> printf("Enter a name: "); >> fgets(line, sizeof(line),stdin); >> >> printf("He

Re: Exploring terminfo

2021-01-16 Thread Alan Gauld via Python-list
On 15/01/2021 21:41, Dennis Lee Bieber wrote: > On Fri, 15 Jan 2021 13:19:26 +0000, Alan Gauld via Python-list > declaimed the following: > >> So the native C functions work as expected. >> Why does the Python wrapper not? > > Are you running Python from a p

Re: Exploring terminfo

2021-01-17 Thread Alan Gauld via Python-list
On 17/01/2021 00:02, Greg Ewing wrote: > On 17/01/21 12:40 pm, Chris Angelico wrote: >> This is true. However, at some point, the boundary is crossed from >> Python into the C library. Something, at that point, knows. It's very >> common to have a flush option available, so it should be used. > >

Re: Exploring terminfo

2021-01-18 Thread Alan Gauld via Python-list
On 18/01/2021 22:14, Random832 wrote: > On Fri, Jan 15, 2021, at 13:36, Alan Gauld via Python-list wrote: >> That could make a big difference, the putp() function specifically >> states that it writes to stdout. > > I think there is a reasonable argument that this is a defici

Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-27 Thread Alan Gauld via Python-list
On 27/01/2021 18:42, C W wrote: > I'd like to know how the experts on here are approaching and debugging > this. > > Bonus if no debugger or breakpoint. Just the good ol' run the function and > evaluate/print output for problems. One option you may like and nobody seems to have mentioned yet is

Re: IDE tools to debug in Python?

2021-01-27 Thread Alan Gauld via Python-list
On 27/01/2021 19:27, Dietmar Schwertberger wrote: > Python is an interactive language. You can develop a lot while working > on a Python console. Then copy and paste into a program. Absolutely, the humble interactive prompt is often overlooked as a development tool. It's not as good as the "eval

Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-27 Thread Alan Gauld via Python-list
On 27/01/2021 23:04, 2qdxy4rzwzuui...@potatochowder.com wrote: > systems are more painful than others, but yes, some debugging > environments are more painful than others, too. Very true! but a good debugger is a godsend. Howevder... > A well placed call to print (they're not "print statements"

Re: IDE tools to debug in Python?

2021-02-05 Thread Alan Gauld via Python-list
On 27/01/2021 18:32, flaskee via Python-list wrote: > > While print() is groovy and all, > if anyone runs across a non-pdb python debugger (standalone or IDE-based) > please let me know. > There are many. But why must it be non-pdb? That seems rather arbitrary. Or do you really mean you want a n

Re: Files can only be modified in IDLE, but not via Powershell

2021-02-09 Thread Alan Gauld via Python-list
On 08/02/2021 21:33, Stefan Ritter wrote: > I have a Windows 10 ADM64 desktop and a Windows 10 AMD64 Laptop. So notionally identical. > I wrote some code to insert text in a .txt-file. It works perfectly on > my laptop. > > On my desktop it works only if i run it in IDLE, the text appears > aft

Re: New Python implementation

2021-02-12 Thread Alan Gauld via Python-list
On 11/02/2021 12:30, Mr Flibble wrote: > I am starting work on creating a new Python implementation > from scratch using "neos" my universal compiler that can > compile any programming language. Can i clarify that? Are you saying that you are going to recompile the existing C code for pyhton

Re: super() in injected methods

2021-02-12 Thread Alan Gauld via Python-list
On 12/02/2021 02:39, Andras Tantos wrote: > 1. Ports, which are the connection points on the various netlist > entities. These would be the inputs and outputs of an AND gate for example > > 2. NetTypes, which describe the type of data that can travel through a > net (and thus through a Port). O

Re: New Python implementation

2021-02-12 Thread Alan Gauld via Python-list
On 12/02/2021 21:46, Mr Flibble wrote: > The neos Python implementation will consist of a schema file > which describes the language plus any Python-specific semantic concepts So the schema file is some kind of formal grammar definition of the language? And you "compile" this directly into mach

Re: New Python implementation

2021-02-13 Thread Alan Gauld via Python-list
On 13/02/2021 16:09, Mr Flibble wrote: > On 13/02/2021 00:01, Alan Gauld wrote: >> I'm assuming it's a new executable interpreter that can run any >> valid python code. Is that correct? > > It is a universal *compiler* so it compiles the python code to byte code &

Re: New Python implementation

2021-02-13 Thread Alan Gauld via Python-list
On 14/02/2021 00:07, Mr Flibble wrote: > On 13/02/2021 18:11, Alan Gauld wrote: >> You are going to create a Python compiler that will take existing >> Python code and output a byte code file. > > No neos is not a Python compiler: it is a *universal* compiler that > can

Re: Efficiency debates

2021-02-15 Thread Alan Gauld via Python-list
On 15/02/2021 02:26, Avi Gross via Python-list wrote: > I think we have discussed this a few times. Indeed, many times! And there is a natural tendency for a group focused on a programming language to fixate on language improvements. But it's worth while to back up and look at real world scenario

Re: New Python implementation

2021-02-15 Thread Alan Gauld via Python-list
On 15/02/2021 22:24, Roel Schroeven wrote: > Grant Edwards schreef op 15/02/2021 om 21:59: >> On 2021-02-15, Roel Schroeven wrote: >> >>> Is it your intention to not only compile procedural and object-oriented >>> languages, or also functional languages such as Haskell, Ocaml, Scheme? >> >> And Pr

Re: New Python implementation

2021-02-16 Thread Alan Gauld via Python-list
On 16/02/2021 07:35, Christian Gollwitzer wrote: > Am 16.02.21 um 06:36 schrieb dn: >> Pascal's value as a teaching language was that it embodied many aspects >> of structured programming, and like Python, consisted of a limited range >> of items which could be learned very quickly > > ROFL. Maybe

Re: New Python implementation

2021-02-17 Thread Alan Gauld via Python-list
On 16/02/2021 22:23, boB Stepp wrote: >> And that's just one example, the language is now full of meta goodness >> that makes it incomprehensible to beginners. > > Hmm. I'm not sure I can agree, Alan. My son took to Python 3 like a duck to > water. That's interesting. I knew you were teachi

Re: New Python implementation

2021-02-17 Thread Alan Gauld via Python-list
On 16/02/2021 21:22, Tarjei Bærland via Python-list wrote: > To me, it depends on what you want out of including programming in > mathematics education. That's a really important subclass distinction. If programming is seen as an adjunct to math then the aims can be simplified considerably since

Re: New Python implementation

2021-02-19 Thread Alan Gauld via Python-list
On 19/02/2021 03:51, Dennis Lee Bieber wrote: > They chose Pascal as being more modern, and something taught in schools > (yeah, like TurboPascal is going to be a good introduction to writing > software for real-time ground control of satellites). Funnily enough it was. Or at least for rea

Re: Startup failure

2021-02-19 Thread Alan Gauld via Python-list
On 19/02/2021 06:27, Smit Patel wrote: > I recently downloaded python from your website and when I started using it, > it worked correctly but when I installed the random2 module it showed > startup failure and won't work again. > So, I uninstalled it and downloaded it again but it is showing the s

Re: New Python implementation

2021-02-19 Thread Alan Gauld via Python-list
On 19/02/2021 18:14, Michael F. Stemper wrote: >> and cons. LISP only had cons. :-) LOL -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos -- http

Re: name for a mutually inclusive relationship

2021-02-24 Thread Alan Gauld via Python-list
On 24/02/2021 16:12, Ethan Furman wrote: > I'm looking for a name for a group of options that, when one is specified, > all of them must be specified. > > For contrast, > > - radio buttons: a group of options where only one can be specified (mutually > exclusive) > - check boxes: a group of o

Re: error of opening Python

2021-02-25 Thread Alan Gauld via Python-list
On 25/02/2021 17:22, Botao Liu wrote: > Type "help", "copyright", "credits" or "license" for more information." Follow the instructions and type "help" at the >>> prompt. Then follow the instructions which it displays. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: name for a mutually inclusive relationship

2021-02-26 Thread Alan Gauld via Python-list
On 26/02/2021 04:30, Ethan Furman wrote: >> Do you have a specific problem you're trying to solve? > > No, I just came across the concept in my browsing and > was wondering if there was a name for it. If we stick with boolean values (like radio buttons and checkboxes) then I think the name is

Re: Tkinter needed as a legacy version 2.7 imports the module...

2021-02-27 Thread Alan Gauld via Python-list
On 26/02/2021 22:23, Kevin M. Wilson via Python-list wrote: > Hey Community,    Is there a site where I might/can download a version of > Tkinter for Python 2.7? Which OS? If it's Linux you may need to fetch the tkinter package for your distro. In Windoze it should come as standard In MacO

yield from () Was: Re: weirdness with list()

2021-03-01 Thread Alan Gauld via Python-list
On 28/02/2021 00:17, Cameron Simpson wrote: > BUT... It also has a __iter__ value, which like any Box iterates over > the subboxes. For MDAT that is implemented like this: > > def __iter__(self): > yield from () Sorry, a bit OT but I'm curious. I haven't seen this before: yield fro

Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Alan Gauld via Python-list
On 28/02/2021 23:47, Alan Gauld via Python-list wrote: > On 28/02/2021 00:17, Cameron Simpson wrote: > >> BUT... It also has a __iter__ value, which like any Box iterates over >> the subboxes. For MDAT that is implemented like this: >> >> def __iter_

Re: python curses constant names for mouse wheel movements?

2021-03-07 Thread Alan Gauld via Python-list
On 07/03/2021 07:16, pjfarl...@earthlink.net wrote: > Where can I find any documentation of the correct curses constant name(s) to > use for detecting a "wheel down" action? Or do I just have to manually > define my own BUTTON5 constant name for the wheel-down event? I suspect you need to look i

Re: python curses constant names for mouse wheel movements?

2021-03-09 Thread Alan Gauld via Python-list
On 09/03/2021 01:05, pjfarl...@earthlink.net wrote: > I am replying to my own message due to the digest not appearing in my inbox > yet today. I will add Alan Gould's responses and my reply to him manually. > Yes, when I talk about wheel up/down I do mean wheel rotation events, not > wheel-button

Re: REPL peculiarity

2021-03-11 Thread Alan Gauld via Python-list
On 11/03/2021 11:01, Rob Cliffe via Python-list wrote: > This is a valid Python program: > > def f(): pass > print(f) > > But at the REPL: > > >>> def f(): pass > ... print(f) >   File "", line 2 >     print(f) >     ^ > SyntaxError: invalid syntax > > It doesn't seem to matter what the sec

Re: How do I read .csv files

2021-03-16 Thread Alan Gauld via Python-list
On 16/03/2021 16:15, The Cool Life wrote: > Try importing the CSV module. That might help! And for the removal of doubt it is spelled csv 9lower case) And it looks like you want to read about the DictReader class within it. The csv module docs include several examples. -- Alan G Author of the L

Re: .title() - annoying mistake

2021-03-19 Thread Alan Gauld via Python-list
On 19/03/2021 19:58, Dan Stromberg wrote: > In high school, I was taught that English has multiple capitalization > rulesets to choose among for titles. > And, of course, there are multiple forms of English. English English is very different from US English. And even in the UK there are (a few,

Re: convert script awk in python

2021-03-24 Thread Alan Gauld via Python-list
On 23/03/2021 14:40, Avi Gross via Python-list wrote: > $1 == 113 { > if (x || y || z) > print "More than one type $8 atom."; > else { > x = $2; y = $3; z = $4; > istep++; > } > } > > I am a tod concerned as to where any of the variables x, y or z have been > d

Re: convert script awk in python

2021-03-24 Thread Alan Gauld via Python-list
On 24/03/2021 16:00, Avi Gross via Python-list wrote: > But I wonder how much languages like AWK are still used to make new programs > as compared to a time they were really useful. True. I first discovered awk from a Byte article around 1988/9 and it became my goto tool for text munching right u

Re: memory consumption

2021-03-30 Thread Alan Gauld via Python-list
On 29/03/2021 11:12, Alexey wrote: > Hello everyone! > I'm experiencing problems with memory consumption. > The first thing you really need to tell us is which OS you are using? Memory management varies wildly depending on OS. Even different flavours of *nix do it differently. However, most do i

Ann: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
I've just published, in Kindle and paperback formats, my book on "Programming curses with Python". https://www.amazon.co.uk/dp/B091B85B77/ (It should be available in most other Amazon stores too) It is a complete rewrite of the Linux Documentation Project's HowTo for the C ncurses library. It ha

Re: Ann: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 17:14, Grant Edwards wrote: > Is the kindle format readable via a web browser pointed at > read.amazon.com (AKA "Kindle Cloud Reader)? It seems to be, I downloaded the free sample and could read the first 2 chapters on the web reader. -- Alan G Author of the Learn to Program web s

Re: memory consumption

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 16:50, Chris Angelico wrote: >> A 1GB process on modern computers is hardly a big problem? >> Most machines have 4G and many have 16G or even 32G >> nowadays. >> > > Desktop systems maybe, but if you rent yourself a worker box, it might > not have anything like that much. Especially

Re: Ann: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 19:52, Grant Edwards wrote: > It is. I just bought the kindle version on the US site, and it renders > fine in the cloud reader. It would be cool if you could cut/paste code > examples from the book into IDLE or a text editor, but I've never been > able to get the cloud reader to all

Re: New Python curses book

2021-03-30 Thread Alan Gauld via Python-list
On 30/03/2021 20:05, Brian Oney via Python-list wrote: > Congratulations! > > Indeed, I was wondering for a moment if this was a guide to al dente > spaghetti code. With each curse being a funny way to mess with the colleagues > performing the code review ;) You may jest but I originally titled

Source code link was: Re: Ann: New Python curses book

2021-03-31 Thread Alan Gauld via Python-list
On 31/03/2021 00:09, Alan Gauld via Python-list wrote: > Watch this space. Hopefully tomorrow. The source code is now available in a zip file at: http://www.alan-g.me.uk/hills/PythonCursesCode.zip Or via a link on the programming section of my home page http://www.alan-g.me.uk/ It

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-01 Thread Alan Gauld via Python-list
On 01/04/2021 00:14, Chris Angelico wrote: > On a scale of 1 to "submit this to The Daily WTF immediately", how bad > is this code? :) The only worthwhile test of code quality is whether a new member of the team, competent in the language but not an expert can understand the code in two readings

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread Alan Gauld via Python-list
On 02/04/2021 00:42, dn via Python-list wrote: > Contrarily "tuck" in (old) English slang represented "sweets" (or Not that old. We still use it occasionally today. And we certainly had a "tuck shop" at school. It was where you bought lunch if not eating in the refectory. ie. sandwiches, crisps,

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread Alan Gauld via Python-list
On 02/04/2021 21:33, dn via Python-list wrote: > Bournville was the only Cadbury chocolate I would > consider. Today, even that seems to lack Cadbury has always been a budget chocolate brand(*) here; its a mass market option loaded with sugar and little else. Certainly doesn't compare to Suchards

Re: Friday Finking: initialising values and implied tuples

2021-04-02 Thread Alan Gauld via Python-list
On 02/04/2021 23:10, dn via Python-list wrote: > When there are several items to be defined and initialised, how do you > prefer to format the code, and why? > (a) basic linear presentation: > > resource = "Oil" > time = 1 > crude = 2 > residue = 3 > my_list = "long" In production code I'd almos

Re: How to access a variable from one tab in another tab of a notebook?

2021-04-07 Thread Alan Gauld via Python-list
On 07/04/2021 09:35, Mohsen Owzar wrote: > The problem is that I can't use the variable "val" from Tab2 in Tab 1, > # Filename: Tab1.py > from tkinter import * > > def gen_t1(frame): > f = LabelFrame(frame, text='f', bg='lightgreen') > f.pack(expand=True, fill='both') > > b1 = Button(f,

Re: How to access a variable from one tab in another tab of a notebook?

2021-04-08 Thread Alan Gauld via Python-list
On 08/04/2021 06:01, Mohsen Owzar wrote: >> But this is why GUIs are often(usually?) built as a class >> because you can store all the state variables within >> the instance and access them from all the methods. >> >> You can do it with functions but you usually wind up >> with way too many gl

Re: Ann: New Python curses book

2021-04-12 Thread Alan Gauld via Python-list
On 12/04/2021 00:53, Daniel Nelson wrote: >> (It should be available in most other Amazon stores too) > > This looks handy, I'd love to buy a copy but I don't do business with > Amazon if I can avoid it. Any chance this will be available from other > locations? I tried to publish it on several

Re: UI design: combobox or radiobuttons?

2021-04-13 Thread Alan Gauld via Python-list
On 13/04/2021 22:53, Rich Shepard wrote: > While a set of radiobuttons occupies more room on the parent widget than > does a combobox are there any technical or user issues that would suggest > using one over the other? readability? If the combo box puts the units immediately beside the value the

Re: Ann: New Python curses book

2021-04-14 Thread Alan Gauld via Python-list
On 30/03/2021 12:12, Alan Gauld via Python-list wrote: > I've just published, in Kindle and paperback formats, I've just noticed that the kindle version has several indentation problems in the code listings. I can't do anything to fix it because it is all perfectly aligned

Re: port to PDOS (especially mainframe)

2021-04-14 Thread Alan Gauld via Python-list
On 14/04/2021 11:35, Paul Edwards wrote: > I have succeeded in producing a Python 3.3 executable ... > However, the executable doesn't work yet. Late to this party but how big is the assembler? It might be easier to translate the Python to C! I've done that in the past and with the aid of a few fun

Re: Ann: New Python curses book

2021-04-15 Thread Alan Gauld via Python-list
On 14/04/2021 19:55, Rich Shepard wrote: > On Wed, 14 Apr 2021, Alan Gauld via Python-list wrote: > >> The paper version should be fine (apart from one error on p44 which has >> now been fixed!). > > Alan, > > What's the error and correction so I can change it

Re: do ya still use python?

2021-04-20 Thread Alan Gauld via Python-list
On 20/04/2021 04:47, Dan Stromberg wrote: > Actually, this list is less busy than it was a decade or two ago, but > that's probably because of things like stackoverflow, python-dev, pypy-dev, > cython-devel, python-ideas, distutils-sig, issue trackers, code-quality, > and probably others. > > The

Re: Ad-hoc SQL query builder for Python3?

2021-04-25 Thread Alan Gauld via Python-list
On 24/04/2021 15:24, Rich Shepard wrote: > My web searches are not finding what I need to include in an application I'm > building: an ad-hoc sql query builder. > > End users will want to query their data for reports not included in the > built-in queries. I assume you understand the huge risks i

Re: "py.ini" question

2021-04-25 Thread Alan Gauld via Python-list
On 24/04/2021 15:23, Gisle Vanem wrote: > I have a question about the Python launcher; >c:\Windows\py.exe and the py.ini file. > > I have both Python 3.6 (32-bit) and Python 3.8 (64-bit) > installed. And I have a 'c:\Users\Gisle\AppData\Local\py.ini' > with this only: >[defaults] >pyth

Re: Start Python programming

2021-04-28 Thread Alan Gauld via Python-list
On 27/04/2021 18:32, Gazoo wrote: > I'd like to start learning Python programming. What sites/tutorials > could you recommend for beginner, please. There is a getting started page on the python web site with links to guide you to many listed suggestions - books, web tutorials, video courses etc.

Re: STARTUP FAILURE

2021-05-13 Thread Alan Gauld via Python-list
On 13/05/2021 14:49, Sumukh chakkirala wrote: > Hello, I have been facing this " startup failure" for a while now, I can > open the IDLE from the programs that I have saved but I'm not able to open > the IDLE directly. Hope you can help me with this issue as soon as possible. > Usual questions:

Re: learning python ...

2021-05-24 Thread Alan Gauld via Python-list
On 24/05/2021 07:21, hw wrote: >> Inside the function f() the name 'x" shadows the global "x"; references >> to "x" are to the function's local vairable. Which is very desireable. > > If it works that way, I would consider it an entirely different > variable. Remember that in Python variables

Re: learning python ...

2021-05-24 Thread Alan Gauld via Python-list
On 24/05/2021 16:54, Michael F. Stemper wrote: > In my early days of writing python, I created lists named "list", > dictionaries named "dict", and strings named "str". I mostly know better > now, but sometimes still need to restrain my fingers. I think most newbie programmers make that mistake.

Re: learning python ...

2021-05-24 Thread Alan Gauld via Python-list
On 24/05/2021 19:48, Grant Edwards wrote: >> Traceback ( File "", line 1 >> if = 1.234 >>^ >> SyntaxError: invalid syntax > > I must admit it might be nice if the compiler told you _why_ the > syntax is invalid (e.g. "expected conditional expression while parsing > 'if' statement").

Re: learning python ...

2021-05-25 Thread Alan Gauld via Python-list
On 25/05/2021 00:41, Jon Ribbens via Python-list wrote: > What would you call the argument to a function that > returns, say, an upper-cased version of its input? Probably 'candidate' or 'original' or 'initial' or somesuch. Or even just 's'. Single character names are OK when there is no signifi

string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-26 Thread Alan Gauld via Python-list
On 25/05/2021 23:23, Terry Reedy wrote: > In CPython's Flexible String Representation all characters in a string > are stored with the same number of bytes, depending on the largest > codepoint. I'm learning lots of new things in this thread! Does that mean that if I give Python a UTF8 string

Re: string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-26 Thread Alan Gauld via Python-list
On 26/05/2021 14:09, Tim Chase wrote: >> If so, doesn't that introduce a pretty big storage overhead for >> large strings? > > Yes. Though such large strings tend to be more rare, largely because > they become unweildy for other reasons. I do have some scripts that work on large strings - mainl

Re: string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-26 Thread Alan Gauld via Python-list
On 26/05/2021 22:15, Tim Chase wrote: > If you don't decode it upon reading it in, it should still be 100MB > because it's a stream of encoded bytes. I usually convert them to utf8. > You don't specify what you then do with this humongous string, Mainly I search for regex patterns which can

Re: Applying winpdb_reborn

2021-05-29 Thread Alan Gauld via Python-list
On 29/05/2021 19:10, Dennis Lee Bieber wrote: > On Sat, 29 May 2021 09:51:04 -0700 (PDT), Rich Shepard > declaimed the following: >> What I find interesting is that every web page I find on 'using pdb' does no >> more than explain the available commands; they don't explain the debugging >> proces

Re: Applying winpdb_reborn

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 00:03, Cameron Simpson wrote: > I'd imagine debugging is much like it is in C. Wait for the breakpoint > to trip, then inspect the programme variables. That's a pretty crude form of debugging (although much better than just single stepping from the beginning!). Adding conditional

Re: Definition of "property"

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 17:57, Irv Kalb wrote: > I am doing some writing (for an upcoming book on OOP), and I'm a little > stuck. Oh dear, that's one of myt hot buttons I'm afraid! I hope it really is about OOP and not about classes. Classes are such a minor part of OOP that it is depressing how many boo

Re: Python doesn't work

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 12:23, Mr.Incognito wrote: >Hello > >I downloaded the latest versioon of Python and tried to open several .py >files, but it doesn't open. It opens for a sec, then closes itself. I >tried uninstalling and reinstalling, but it doesn't work. Most likely it is working b

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-05-30 Thread Alan Gauld via Python-list
On 30/05/2021 18:26, pjfarl...@earthlink.net wrote: > I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3 > at that time), but could not figure out how to use it to debug a python > script that uses the curses module. You are not alone. debugging curses is one of the biggest

Re: Definition of "property"

2021-05-31 Thread Alan Gauld via Python-list
On 30/05/2021 23:57, Mike Dewhirst wrote: > > A property is an object method masquerading as a cachable object attribute Or a group of methods perhaps? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Fli

Re: Definition of "property"

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 01:24, Greg Ewing wrote: > On 31/05/21 8:20 am, Alan Gauld wrote: >> >> That's a very Pythonic description. > > If it's a book about Python, it needs to be. The word "property" > has a very specialised meaning in Python. > >

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 16:16, Grant Edwards wrote: > On 2021-05-30, Alan Gauld via Python-list wrote: >> You are not alone. debugging curses is one of the biggest obstacles to >> its use. > > Can't you just run the debugger in a different window and attach to > the process

Re: Definition of "property"

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 15:59, Dennis Lee Bieber wrote: > On Sun, 30 May 2021 21:20:24 +0100, Alan Gauld via Python-list > declaimed the following: > >> On 30/05/2021 17:57, Irv Kalb wrote: >>> I am doing some writing (for an upcoming book on OOP), and I'm a little >>&

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Alan Gauld via Python-list
On 01/06/2021 21:18, Rich Shepard wrote: > On Sun, 30 May 2021, Cameron Simpson wrote: > >> I've only just started with pdb. As of Python 3.7 there's a builtin >> function named breakpoint() which drops you into the debugger. > I'm stuck with neither approach (pdb, print()) working. > The act

Re: fabric: fab command

2021-06-02 Thread Alan Gauld via Python-list
On 02/06/2021 14:35, jayshankar nair via Python-list wrote: > import tools.fab.dev_utils as dev_utilsImportError: No module named > tools.fab.dev_utils > Please let me know which package i have to install. Work backwards. Can you import tools.fab? Can you import tools? Once you know what you do

Re: Tkinter8.6: date picker

2021-06-14 Thread Alan Gauld via Python-list
On 11/06/2021 22:20, Rich Shepard wrote: > I need a date picker +1 -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos -- https://mail.python.org/ma

Re: Terminology: EU language skills, and Master to Main (or ...)

2021-06-14 Thread Alan Gauld via Python-list
On 13/06/2021 04:21, dn via Python-list wrote: > What do you think a professionally-recognisable series of skill-levels > for programmers? This has been done or attempted many times, with perhaps the most complete scheme being the British Computer Society's "Industry Standard Model" which breaks

Re: tkinter: tksheet

2021-06-16 Thread Alan Gauld via Python-list
On 16/06/2021 21:45, Rich Shepard wrote: > The two applications I'm building are both database applications. If > tksheet() is not the most appropriate widget to display database tables what > alternative would be better? I've not used tksheet but it sounds like it might be worth investigating.

Re: tkinter: tksheet

2021-06-17 Thread Alan Gauld via Python-list
On 17/06/2021 00:15, Rich Shepard wrote: > When I view my contacts table it needs to includes attributes from the > company, people, and contacts tables so I can view all prior contacts with > that person. Sounds like a job for a database view. Can you modify the database schema? Could you create

Re: Tkinter widgets for desktop database application

2021-07-14 Thread Alan Gauld via Python-list
On 13/07/2021 21:24, Rich Shepard wrote: > What have other developers used for the UI on a stand-alone database > application not using a web browser? Mostly I just use a scrolledlistbox and a set of functions for formatting the data into columns for display. The big snag is you can't do spreads

Re: tkinter

2021-08-21 Thread Alan Gauld via Python-list
On 21/08/2021 19:37, Tony Genter wrote: >Tkinter stopped working overnight from 8/20/2021 to 8/21/2021. Last night >I was working on tutorials to work on a GUI and this morning every file >that uses tkinter is broken stating that no module `tkinter' exists. Are you sure you were runni

Re: on writing a while loop for rolling two dice

2021-08-28 Thread Alan Gauld via Python-list
On 28/08/2021 21:50, Hope Rouselle wrote: >>> roll_count = 0 >>> while True: >>> outcome = roll_two_dice() >>> roll_count += 1 >>> if outcome[ 0 ]== outcome[ 1 ]: break >>> return roll_count, outcome[ 0 ] >> > > Wait, I'm surprised ``outcome'' is still a valid name at the > return-sta

Python UI (was Re: urgent)

2021-08-30 Thread Alan Gauld via Python-list
On 29/08/2021 11:28, Hari wrote: > i was download ur python software but it is like boring user interface I agree it is a boring user interface. Just 3 chevrons: >>> You can change it a little if you want but ultimately its just an invitation to type commands. What kind of interface did you have

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread Alan Gauld via Python-list
On 31/08/2021 13:45, Chris Angelico wrote: > (I find the Ireland situation particularly amusing. Time zones and daylight saving arrangements in particular are a nightmare at the micro level. I once worked on a large customer support application which required all dates/times to be viewable in UT

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 31/08/2021 22:13, Chris Angelico wrote: > But ultimately, it all just means that timezones are too hard for > humans to handle, and we MUST handle them using IANA's database. It is > the only way. Except for the places that don't follow the IANA scheme and/or dynamically change their time sett

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 31/08/2021 22:32, Chris Angelico wrote: > If we could abolish DST world-wide, life would be far easier. All the > rest of it would be easy enough to handle. We tried that in the UK for 2 years back in the '70s and very quickly reverted to DST when they realized that the number of fatalities amo

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 31/08/2021 23:31, Chris Angelico wrote: > Ah, good to know. I think that actually makes a lot of sense; in the > US, they try to let everyone pretend that the rest of the world > doesn't exist ("we always change at 2AM"), but in Europe, they try to > synchronize for the convenience of commerce

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 02/09/2021 19:28, Chris Angelico wrote: >> Except for the places that don't follow the IANA scheme and/or >> dynamically change their time settings on a whim. To be complete >> you need the ability to manually override too. >> > > What places are those? Mainly small non-tech oriented places

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 02/09/2021 20:11, MRAB wrote: >> In one of them (I can't recall which is which) they change on the 4th >> weekend of October/March in the other they change on the last weekend. >> >> > In the EU (and UK) it's the last Sunday in March/October. > > In the US it's second Sunday in March and the f

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-03 Thread Alan Gauld via Python-list
On 02/09/2021 19:30, Chris Angelico wrote: >> Without DST the schools opened in the dark so all the kids >> had to travel to school in the dark and the number of >> traffic accidents while crossing roads jumped. > > How do they manage in winter? That was the winter. Sunrise wasn't till 10:00 or

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-04 Thread Alan Gauld via Python-list
On 03/09/2021 18:37, Chris Angelico wrote: Without DST the schools opened in the dark so all the kids had to travel to school in the dark and the number of traffic accidents while crossing roads jumped. > > Are you saying that you had DST in winter, or that, when summer *and* > DST

Re: on writing a while loop for rolling two dice

2021-09-07 Thread Alan Gauld via Python-list
On 07/09/2021 15:53, Grant Edwards wrote: > I remember engineering manager I worked with about 35 years ago who > used a set of C macros to try to make his code look as much like BASIC > as possible: > > #define IF if ( > #define THEN ) { > #define ELSE } else { > #define ENDIF } > ...

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 09/09/2021 22:36, dn via Python-list wrote: > Even in fairly modest Python constructs, we quickly repeal the one-in, > one-out philosophy because try...except operates by providing another > exit-path. Exceptions are exceptional by their nature (or should be!) As such they can arguably be excu

<    1   2   3   >