Re: Silly/crazy problem with sqlite

2023-11-25 Thread Rimu Atkinson via Python-list
I really can't think of a case where the missing comma would make any sense at all. That is pretty tricky, yes. The comma means it's a tuple. Without the comma, it's just a string with parenthesis around it, which is a string. PyDev console: starting. Python 3.9.15 (main, Oct 28 2022

Re: Printing dict value for possibly undefined key

2023-11-25 Thread duncan smith via Python-list
On 24/11/2023 16:35, duncan smith wrote: On 24/11/2023 14:31, Loris Bennett 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 d

Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
This is driving me crazy, I'm running this code:- #!/usr/bin/env python3 # # # Show the electric fence history, default to last 24 hours # import sqlite3 import datetime import sys today = datetime.datetime.now()

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
Chris Green wrote: > This is driving me crazy, I'm running this code:- OK, I've found what's wrong:- > cr.execute(sql, ('%' + "2023-11" + '%')) should be:- cr.execute(sql, ('%' + x + '%',) ) I have to say this seems very non-pythonesque to me, the 'obvious' default simply doesn'

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Sibylle Koczian via Python-list
Am 24.11.2023 um 22:49 schrieb Rimu Atkinson via Python-list: I really can't think of a case where the missing comma would make any sense at all. That is pretty tricky, yes. The comma means it's a tuple. Without the comma, it's just a string with parenthesis around

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Mats Wichmann via Python-list
On 11/24/23 14:10, Chris Green via Python-list wrote: Chris Green wrote: This is driving me crazy, I'm running this code:- OK, I've found what's wrong:- cr.execute(sql, ('%' + "2023-11" + '%')) should be:- cr.execute(sql, ('

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']}") How

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Thomas Passin via Python-list
On 11/24/2023 4:49 PM, Rimu Atkinson via Python-list wrote: I really can't think of a case where the missing comma would make any sense at all. That is pretty tricky, yes. The comma means it's a tuple. Without the comma, it's just a string with parenthesis around it, wh

Re: Silly/crazy problem with sqlite

2023-11-26 Thread Chris Green via Python-list
Stefan Ram wrote: > Chris Green writes: > >I have to say this seems very non-pythonesque to me, the 'obvious' > >default simply doesn't work right, and I really can't think of a case > >where the missing comma would make any sense at all. > > |6.15 Expression lists > ... > |an expression list co

Context without manager

2023-11-26 Thread Piergiorgio Sartor via Python-list
Hi all, I apologize in advance for the "foggy" question, but I've myself unclear ideas. Anyway... Python has "context manager". For example, the "open()" class can be simply used as follow: with open(...) as fp: fp.do_something() On the other hand, it is also possible to do: fp = open() fp

Re: RE: Newline (NuBe Question)

2023-11-26 Thread Chris Angelico via Python-list
On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list wrote: > > On 24/11/2023 21.45, [email protected] wrote: > > Grizz[l]y, > > > > I think the point is not about a sorted list or sorting in general It is > > about reasons why maintaining a data

Re: Newline (NuBe Question)

2023-11-26 Thread Roel Schroeven via Python-list
Michael F. Stemper via Python-list schreef op 25/11/2023 om 15:32: On 24/11/2023 21.45,[email protected] wrote: > Grizz[l]y, > > I think the point is not about a sorted list or sorting in general It is > about reasons why maintaining a data structure such as a list in a prog

Re: Context without manager

2023-11-26 Thread Dieter Maurer via Python-list
Piergiorgio Sartor wrote at 2023-11-25 22:15 +0100: > ... >Apparently, the "with" context manager is not usable >in classes, at least not with __init__() & co. You can use `with` in classes -- with any context manager. However, you would usually not use `with` with a file you have opened in `__ini

RE: RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
, it makes sense to use the expanded language if it results in faster writing perhaps of faster code with fewer mistakes. -Original Message- From: Python-list On Behalf Of Michael F. Stemper via Python-list Sent: Saturday, November 25, 2023 9:32 AM To: [email protected] Subject: Re: R

RE: RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
al Message- From: Python-list On Behalf Of Chris Angelico via Python-list Sent: Sunday, November 26, 2023 6:49 AM To: [email protected] Subject: Re: RE: Newline (NuBe Question) On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list wrote: > > On 24/11/2023 21.45, avi.e.gr...

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, [email protected] wrote: Grizz[l]y, I think the point is not about a sorted list or sorting in general It is about reasons why

Re: RE: Newline (NuBe Question)

2023-11-26 Thread Chris Angelico via Python-list
On Mon, 27 Nov 2023 at 06:15, wrote: > But I learn from criticism. If I ever write a program like that and do not > feel like typing, will this do? > > dents = [ ...] > > Or will that not include students who happen to be edentulous? > If they're learning to drive, this variable name would make c

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: 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, [email protected] wrote: Of course, for serious work, some might suggest avoiding constructs like a list of lists and switch to using

RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
came from the Latin word for news. Be that as it may, and I have no interest in this topic, in the future I may use the ever popular names of Primus, Secundus and Tertius and get blamed for using Latin. -Original Message- From: Python-list On Behalf Of DL Neil via Python-list Sent: Sunda

Re: Newline (NuBe Question)

2023-11-26 Thread Chris Angelico via Python-list
On Mon, 27 Nov 2023 at 13:52, AVI GROSS via Python-list wrote: > Be that as it > may, and I have no interest in this topic, in the future I may use the ever > popular names of Primus, Secundus and Tertius and get blamed for using > Latin. > Imperious Prima flashes forth her edi

RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
L Neil via Python-list Sent: Sunday, November 26, 2023 5:19 PM To: [email protected] Subject: Re: Newline (NuBe Question) 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, av

Re: Context without manager

2023-11-26 Thread Grant Edwards via Python-list
On 2023-11-26, Dieter Maurer via Python-list wrote: > If you do not have this case (e.g. usually if you open the file > in a class's `__init__`), you do not use a context manager. He knows that. The OP wrote that he wants to use that can _only_ be used by a context manager, but he

Re: Context without manager

2023-11-26 Thread Grant Edwards via Python-list
On 2023-11-27, Grant Edwards via Python-list wrote: > On 2023-11-26, Dieter Maurer via Python-list wrote: > >> If you do not have this case (e.g. usually if you open the file >> in a class's `__init__`), you do not use a context manager. > > He knows that. The OP wro

Re: Context without manager

2023-11-26 Thread Greg Ewing via Python-list
On 27/11/23 9:03 am, Stefan Ram wrote: Above, "have" is followed by another verb in "have been", so it should be eligible for a contraction there! Yes, "been" is the past participle of 'to be", so "I've been" is fine. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Context without manager

2023-11-26 Thread Greg Ewing via Python-list
On 27/11/23 5:03 pm, Grant Edwards wrote: I should probably have written "how to fool that into working when he's not using a 'with' statement" It should be possible to run the context protocol yourself. Something like (warning, untested): class MyDeviceWrapper: def __init__(self

Re: Newline (NuBe Question)

2023-11-26 Thread 'DL Neil' via Python-list
Avi, On 11/27/2023 4:15 PM, [email protected] 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,

argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
Hi all, I have a situation, maybe someone can give some insight. Say I want to have input which is comma separated array (e.g. paths='path1,path2,path3') and convert it to the desired output - list: import argparse parser = argparse.ArgumentParser() parser.add_argument('paths', type=lambda x: li

Re: argparse argument post-processing

2023-11-27 Thread Chris Angelico via Python-list
On Mon, 27 Nov 2023 at 22:31, Dom Grigonis via Python-list wrote: > > Hi all, > > I have a situation, maybe someone can give some insight. > > Say I want to have input which is comma separated array (e.g. > paths='path1,path2,path3') and convert it to the desired o

RE: Newline (NuBe Question)

2023-11-27 Thread AVI GROSS via Python-list
Dave, I gave an example, again, and make no deep claims so your comments may be valid, without any argument. I mentioned CSV and a related family such as TSV as they were a common and simple data format that has long been used. There are oodles of others and yes, these days many people can read

Re: Context without manager

2023-11-27 Thread Piergiorgio Sartor via Python-list
On 26/11/2023 18.50, Dieter Maurer wrote: Piergiorgio Sartor wrote at 2023-11-25 22:15 +0100: ... Apparently, the "with" context manager is not usable in classes, at least not with __init__() & co. You can use `with` in classes -- with any context manager. However, you would usually not use `w

how to connect linux aws ec2 instance to windows local machine at my home using paramiko

2023-11-27 Thread Kashish Naqvi via Python-list
I have a north viriginia ec2 linux instance and a windows machine at my home, how do I connec tthem? import paramiko import time def run_scripts(): # Set your local machine's SSH details local_machine_ip = ' ' username = 'justk' private_key_path = 'C:/Users/justk/.ssh/kashish'

Re: Context without manager

2023-11-27 Thread Richard Damon via Python-list
). Note, YOUR program must now make sure that the __exit__ function is called, and handle any exceptions that got thrown, and that ob and var are put somewhere you can access them at that later time. > On Nov 27, 2023, at 12:24 PM, Piergiorgio Sartor via Python-list > wrote: > > O

Context without manager

2023-11-27 Thread Richard Damon via Python-list
). Note, YOUR program must now make sure that the __exit__ function is called, and handle any exceptions that got thrown, and that ob and var are put somewhere you can access them at that later time. > On Nov 27, 2023, at 12:24 PM, Piergiorgio Sartor via Python-list > wrote: > > O

RE: Context without manager

2023-11-27 Thread David Raymond via Python-list
> I *must* do: > > with device_open() as device: >device.do_something() > > Nevertheless, I _need_ to have a class > where the device is opened in the __init__() > and used in some methods. > > Any ideas? Perhaps take a look at contextlib.ExitStack and see if you can do something with it.

Re: argparse argument post-processing

2023-11-27 Thread Mats Wichmann via Python-list
On 11/27/23 04:29, Dom Grigonis via Python-list wrote: Hi all, I have a situation, maybe someone can give some insight. Say I want to have input which is comma separated array (e.g. paths='path1,path2,path3') and convert it to the desired output - list: import argpa

Re: argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
ats Wichmann via Python-list > wrote: > > On 11/27/23 04:29, Dom Grigonis via Python-list wrote: >> Hi all, >> I have a situation, maybe someone can give some insight. >> Say I want to have input which is comma separated array (e.g. >> paths='path1,path2,pat

Re: argparse argument post-processing

2023-11-27 Thread Mats Wichmann via Python-list
On 11/27/23 13:21, Dom Grigonis wrote: Thank you, exactly what I was looking for! One more question following this. Is there a way to have a customisable action? I.e. What if I want to join with space in one case and with coma in another. Is there a way to reuse the same action class? I've w

Re: argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
Yeah, I have been hearing that people are having troubles converting, but I have only used argparse - got lucky there I guess. I am thinking just making the function which spits the class out. Maybe not very optimised solution, but simple. Argument parsing in my case is very far from being a bo

Re: Printing dict value for possibly undefined key

2023-11-28 Thread Loris Bennett via Python-list
duncan smith writes: > On 24/11/2023 16:35, duncan smith wrote: >> On 24/11/2023 14:31, Loris Bennett 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 >>> >>>    p

Re: Printing dict value for possibly undefined key

2023-11-28 Thread Loris Bennett via Python-list
DL Neil writes: > 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 >>

Accessing configuration across multiple modules

2023-11-28 Thread Loris Bennett via Python-list
Hi, I am using Typer to create a command-line program with multiple levels of subcommands, so a typical call might look like mytool --config-file=~/test/mytool.conf serviceXYZ list people In the top-level mytool.main, I evaluate the option '--config-file' and read the config file to initialize

on writing a number as 2^s * q, where q is odd

2023-11-29 Thread Julieta Shem via Python-list
How would you write this procedure? --8<---cut here---start->8--- def powers_of_2_in(n): s = 0 while "I still find factors of 2 in n...": q, r = divmod(n, 2) if r == 0: s = s + 1 n = n // 2 else: return s, n --8<---c

Re: on writing a number as 2^s * q, where q is odd

2023-11-29 Thread Dom Grigonis via Python-list
def powers_of_2_in(n): s = 0 while n % 2 == 0: s += 1 n = n // 2 return s, n > On 30 Nov 2023, at 02:44, Julieta Shem via Python-list > wrote: > > How would you write this procedure? > > --8<---cut here---start---

Re: on writing a number as 2^s * q, where q is odd

2023-11-29 Thread Dan Sommers via Python-list
On 2023-11-29 at 21:44:01 -0300, Julieta Shem via Python-list wrote: > How would you write this procedure? > > --8<---cut here---start->8--- > def powers_of_2_in(n): > s = 0 > while "I still find factors of 2 in n...": &g

Re: on writing a number as 2^s * q, where q is odd

2023-11-29 Thread Alan Bawden via Python-list
Julieta Shem writes: How would you write this procedure? def powers_of_2_in(n): ... def powers_of_2_in(n): return (n ^ (n - 1)).bit_count() - 1 -- https://mail.python.org/mailman/listinfo/python-list

Exploring terminfo

2021-01-14 Thread Alan Gauld via Python-list
During lockdown I've been digging deeper into the curses module and lately into the ti family of functions that reside there. I've written a short program that is supposed to - *clear the screen*, - read some input - display the result in a message *highlighted in bold*. - get input to end the

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: count consecutive elements

2021-01-14 Thread Wolfram Hinderer via Python-list
Am 13.01.2021 um 22:20 schrieb Bischoop: I want to to display a number or an alphabet which appears mostly consecutive in a given string or numbers or both Examples s= ' aabskaaabad' output: c # c appears 4 consecutive times 8bbakebaoa output: b #b appears 2 consecutive times You can

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

2021-01-14 Thread Avi Gross via Python-list
Ethan, if it is not obvious, then should we add the following functions just in case? cube_root() fourth_root() nth(root) two_thirds_root() e_th_root() pi_th_root() x_ove

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

2021-01-15 Thread Rob Cliffe 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! I agree that, especially if you have experience in other languages, this feels odd, and I have some sympath

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 +, 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: Python not Running

2021-01-18 Thread Mladen Gogala via Python-list
On Sat, 16 Jan 2021 14:55:26 -0600, Logan Cranford wrote: > I downloaded Python but when I try to run Idle it says it is not found > and I should try to redownload it. When I try to do that all that comes > up is a page that says modify, repair or uninstall. I have repaired > several times but it

Re: open sentinel-2image python

2021-01-19 Thread Mladen Gogala via Python-list
On Sun, 17 Jan 2021 18:01:26 +, MRAB wrote: > On 2021-01-17 13:57, Karsten Hilbert wrote: >> Am Sun, Jan 17, 2021 at 02:20:24AM -0800 schrieb omid mohammadi: >> >>> When I open the sentinel-2 image in Python, I get the following error: >>> >>> MemoryError: Unable to allocate 115. MiB for an a

Re: Issues with running python in Command prompt

2021-01-19 Thread Mladen Gogala via Python-list
On Sat, 16 Jan 2021 19:00:06 +0330, mohsen shooshtari wrote: > hello, > Thanks in advance for your consideration. I install python3.8 and then > install Pycharm but when I call python in Command prompt, followed by ( > 'python' > is not recognized as an internal or external command, operable progr

Re: Issues with running python in Command prompt

2021-01-20 Thread Mladen Gogala via Python-list
On Wed, 20 Jan 2021 08:33:40 -0700, Michael Torrie wrote: > You can use escape characters in regular expression on any platform > Python runs on. Python has a whole host of features to deal with the > directory separator differences on Windows vs everybody else. I am probably slightly biased. I

RE: list() strange behaviour

2021-01-23 Thread Avi Gross via Python-list
I am wondering how hard it would be to let some generators be resettable? I mean if you have a generator with initial conditions that change as it progresses, could it cache away those initial conditions and upon some signal, simply reset them? Objects of many kinds can be set up with say a reinit

Re: IDE tools to debug in Python?

2021-01-27 Thread Paul Bryan via Python-list
My experience with IntelliJ (related to PyCharm): it scans all source files in the project, compiles them, graphs all dependencies, compiles those (if necessary) or inspects their class bytecode, and so on to build a full graph in memory to support showing errors in real time (highlighting in sourc

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, [email protected] 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"

Python lunch and file accessing challenges

2021-01-30 Thread jackson kwame via Python-list
 Hi I'm new to Python and currently taking part in a Data Science course. Python is the main coding/programming language for the course. We were guided to download the Python application through Anaconda which worked. I have been using Jupyther through a browser to practice Python exercises. Ho

Pyautogui troubles

2021-01-31 Thread Philipp Daher via Python-list
Dear Python-Team, I have just repaired python after running my program which imports pyautogui, closing and reopening it and then getting this: ModuleNotFoundError: No module named „pyautogui“. Repairing didn’t work and I still get that message. All I did was closing the perfectly working progr

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

Selenium finds object that is interactible but says otherwise

2021-02-06 Thread Philipp Daher via Python-list
Hello, I recently programmed some code for a webdriver with selenium. I asked the program to find an input tag, which is interactible, with this:     searchbar=driver.find_element_by_class_name("ut-player-search-control--input-container") then i ask it to send keys, which has worked before too.

Python cannot count apparently

2021-02-07 Thread Philipp Daher via Python-list
Hello, I recently coded this snippet of code: myString=„hello“ for i in range(len(myString): print(string[i]) And now for the weird part: SOMETIMES, the output is this: hello And SOMETIMES, the output changes to: ohell WHY??? Why do I get different outputs with the EXACT SAME CODE? Can

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

Troubles with Python imports

2021-02-09 Thread Philipp Daher via Python-list
Hello, I’ve just typed „pip install selenium“ into my command prompt on windows 10. Although my computer told me that the requirement was already satisfied, import selenium did not work. So I tried different methods to install it and typed „Python“ in my command prompt and imported selenium. It

Re: UTF-16 or something else?

2021-02-09 Thread Jon Ribbens via Python-list
On 2021-02-09, Skip Montanaro wrote: > I downloaded US hospital ICU capacity data this morning from this page: > > https://healthdata.gov/dataset/covid-19-reported-patient-impact-and-hospital-capacity-facility > > (The download link is about halfway down the page.) > > Trying to read it using my p

Re: Python 3.9. 1 not working

2021-02-10 Thread Roland Mueller via Python-list
Hello, Please note that this is not a kind of support service rather than a community where people help each other on voluntary base. In order to get help from here, you should provide enough information about your issue with Python 3.9 that others can figure out what happened. BR, Roland ke 10

Re: Troubles with Python imports

2021-02-10 Thread Roland Mueller via Python-list
ke 10. helmik. 2021 klo 5.07 Terry Reedy ([email protected]) kirjoitti: > On 2/9/2021 9:55 AM, Philipp Daher via Python-list wrote: > > Hello, > > > > I’ve just typed „pip install selenium“ into my command prompt on windows > 10. Although my computer told me that the

RE: New Python implementation

2021-02-11 Thread Avi Gross via Python-list
I may be the only one who does not deal well with a condescending attitude. I have to wonder what international standards body ever completes a task in finite time, only to find the real world has moved on. Having standards can be a great idea. When the standard does not properly describe any im

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: PSYCOPG2

2021-02-12 Thread Mladen Gogala via Python-list
On Fri, 12 Feb 2021 18:29:48 +, Tony Ogilvie wrote: > I am trying to write a program to open a PostgesSQL 13 database using > psycopg2. All seems to work if I write direct to Python but if I write > the script into IDLE it does not work with the IDLE Shell 3.9.1 > reporting an error of no attr

RE: mutating a deque whilst iterating over it

2021-02-13 Thread Avi Gross via Python-list
I agree both with the idea that it is not good to mutate things during iteration and that some things we want to do may seemingly require effectively something like a mutation. I want to consider what data structure might capture a normal activity like having a to-do-list for TODAY and another for

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 > and then optionally to machine c

RE: New Python implementation

2021-02-13 Thread Avi Gross via Python-list
It is likely that people would understand better if spoken to properly so I have been listening and hopefully gaining a picture that I can share, and be corrected helpfully when wrong. My personal guess is that the project at hand is to do something very vaguely like what was done to the CURSES

Re: PSYCOPG2

2021-02-13 Thread Mladen Gogala via Python-list
I don't have PSYCOPG2 on my system, but try doing the following from python: [mgogala@umajor ~]$ python3 Python 3.9.1 (default, Jan 20 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cx_Oracle >>>

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 compile any programming l

Efficiency debates

2021-02-14 Thread Avi Gross via Python-list
I think we have discussed this a few times. There are tradeoffs in computer science and obviously a compiled language with some optimization using low-level data structures does much better at solving simple problems. Interpreted languages often have serious overhead to start with and allow all

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 re

RE: New Python implementation

2021-02-15 Thread Avi Gross via Python-list
Grant, Haven't thought about Prolog in a LOOONG time but it had some wild twists on how to specify a problem that might not be trivial to integrate with other languages as our now seemingly censored person with much delusion of grandeur suggests. It is a language that does not specify what to do b

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 Tarjei Bærland via Python-list
Christian Gollwitzer writes: > 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 (in contrast to PL/I's many >> 'b

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-16 Thread Avi Gross via Python-list
Christian, Thanks for sharing. I took a look and he does have a few schemas for Ada and C from TWO YEARS ago. Nothing about the infinite number of other languages he plans on supporting, let alone Python. And what he has is likely not enough to do what he claims he can do easily and rapidly. What

Re: New Python implementation

2021-02-16 Thread Tarjei Bærland via Python-list
David Lowry-Duda writes: >> In Norway, where I try to teach mathematics to highschoolers, >> programming has recently entered the teaching of stem subjects. >> >> Even if Python is my choice language for personal projects, I am not >> certain it is the right language to use in a classroom cont

Re: New Python implementation

2021-02-16 Thread Tarjei Bærland via Python-list
Christian Gollwitzer writes: > I agree to all the rest of your post, but this: > > Am 16.02.21 um 09:57 schrieb Tarjei Bærland: >> I am not sure I agree that a language like Scheme or Logo or Brainfuck, with >> their small number of building blocks, would be harder to learn. > > > is strange. I'm

School Python

2021-02-16 Thread Avi Gross via Python-list
I wonder if someone has come up with a sort of Python environment that lets kids play with more fundamental parts of the language that lets them get educated without the confusion. I mean a limited subset and with some additions/modifications. Someone mentioned how something like range(1,10) is

Re: What's the meaning the "backlog" in the socket.listen(backlog) is?

2021-02-17 Thread Karen Shaeffer via Python-list
> On Feb 16, 2021, at 8:10 PM, Jason Friedman wrote: > >> >> I set listen(2) and expect to see "error" when more clients than "the >> maximum number of queued connections" trying to connect the server. But, no >> error!! Even 4 clients can run normally without problem. >> >> Am I misunderstan

<    21   22   23   24   25   26   27   28   29   30   >