Python Infrequently Asked Questions

2023-03-23 Thread Thomas Passin
I bookmarked this years ago and just came across it again. An oldie but goodie! http://norvig.com/python-iaq.html -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio questions

2023-01-27 Thread Frank Millman
On 2023-01-27 2:14 PM, Frank Millman wrote: I have changed it to async, which I call with 'asyncio.run'. It now looks like this -     server = await asyncio.start_server(handle_client, host, port)     await setup_companies()     session_check = asyncio.create_task(     check_sessions(

Re: asyncio questions

2023-01-27 Thread Frank Millman
On 2023-01-26 7:16 PM, Dieter Maurer wrote: Frank Millman wrote at 2023-1-26 12:12 +0200: I have written a simple HTTP server using asyncio. It works, but I don't always understand how it works, so I was pleased that Python 3.11 introduced some new high-level concepts that hide the gory details.

Re: asyncio questions

2023-01-26 Thread Dieter Maurer
Frank Millman wrote at 2023-1-26 12:12 +0200: >I have written a simple HTTP server using asyncio. It works, but I don't >always understand how it works, so I was pleased that Python 3.11 >introduced some new high-level concepts that hide the gory details. I >want to refactor my code to use these co

Re: asyncio questions

2023-01-26 Thread Grant Edwards
On 2023-01-26, Frank Millman wrote: > I have written a simple HTTP server using asyncio. It works, but I don't > always understand how it works, I thought that was the rule with asyncio. ;) -- https://mail.python.org/mailman/listinfo/python-list

asyncio questions

2023-01-26 Thread Frank Millman
nner I have not figured out how to adapt my code to use this new approach. Any suggestions appreciated. Frank Millman P.S. Might it be better to ask these questions on the Async_SIG Discussion Forum? -- https://mail.python.org/mailman/listinfo/python-list

Re: venv questions

2022-08-30 Thread Dennis Lee Bieber
On Mon, 29 Aug 2022 22:57:50 -0400, gene heskett declaimed the following: >Greetings all; > >The command to setup a venv, "python -m venv venv" has no man page that >I have >found. > https://docs.python.org/3/library/venv.html -- Wulfraed Dennis Lee Bieber AF

Re: Running two separate servers (was Re: venv questions)

2022-08-30 Thread gene heskett
On 8/30/22 06:52, Chris Angelico wrote: On Tue, 30 Aug 2022 at 19:51, gene heskett wrote: So I'm thinking of venv's named rock64prusa, and rock64ender5+, each with "port#" on my local net. So chromium could have two tabs open, one to localhost:5000 and one to localhost:5001, totally independent

Re: Running two separate servers (was Re: venv questions)

2022-08-30 Thread Chris Angelico
On Tue, 30 Aug 2022 at 19:51, gene heskett wrote: > So I'm thinking of venv's named rock64prusa, and rock64ender5+, each with > "port#" on my local net. So chromium could have two tabs open, one to > localhost:5000 and one to localhost:5001, totally independent of each other. > As I said, that ha

Re: Running two separate servers (was Re: venv questions)

2022-08-30 Thread gene heskett
On 8/29/22 23:22, Chris Angelico wrote: On Tue, 30 Aug 2022 at 12:59, gene heskett wrote: But that might create another problem. how to differentiate the servers, both of which will want to use localhost:5000 to serve up their web pages we run things with. Suggested solutions? This is nothing

Running two separate servers (was Re: venv questions)

2022-08-29 Thread Chris Angelico
On Tue, 30 Aug 2022 at 12:59, gene heskett wrote: > > But that might create another problem. how to differentiate the servers, > both of which > will want to use localhost:5000 to serve up their web pages we run > things with. > > Suggested solutions? This is nothing to do with venvs, so I'm fork

Re: venv questions

2022-08-29 Thread Chris Angelico
On Tue, 30 Aug 2022 at 12:59, gene heskett wrote: > > Greetings all; > > The command to setup a venv, "python -m venv venv" has no man page that > I have > found. > $ python3 -m venv --help usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear] [--upgrade] [--with

venv questions

2022-08-29 Thread gene heskett
Greetings all; The command to setup a venv, "python -m venv venv" has no man page that I have found. So I'm guessing that one of the venv's is the name of the one being created. Probably argv(3) in c parlance. What I am thinking about is setting up two venv's more or less named for the pri

Re: mapLast, mapFirst, and just general iterator questions

2022-06-20 Thread Chris Angelico
On Tue, 21 Jun 2022 at 06:16, Leo wrote: > > On Wed, 15 Jun 2022 04:47:31 +1000, Chris Angelico wrote: > > > Don't bother with a main() function unless you actually need to be > > able to use it as a function. Most of the time, it's simplest to > > just have the code you want, right there in the f

Re: mapLast, mapFirst, and just general iterator questions

2022-06-20 Thread Leo
On Wed, 15 Jun 2022 04:47:31 +1000, Chris Angelico wrote: > Don't bother with a main() function unless you actually need to be > able to use it as a function. Most of the time, it's simplest to > just have the code you want, right there in the file. :) Python > isn't C or Java, and code doesn't ha

Re: mapLast, mapFirst, and just general iterator questions

2022-06-14 Thread Cameron Simpson
On 15Jun2022 05:49, Chris Angelico wrote: >On Wed, 15 Jun 2022 at 05:45, Roel Schroeven wrote: >> Not (necessarily) a main function, but these days the general >> recommendation seems to be to use the "if __name__ == '__main__':" >> construct, so that the file can be used as a module as well as a

Re: mapLast, mapFirst, and just general iterator questions

2022-06-14 Thread Greg Ewing
On 15/06/22 7:49 am, Chris Angelico wrote: If it does need to be used as a module as well as a script, sure. But (a) not everything does, and (b) even then, you don't need a main() I think this is very much a matter of taste. Personally I find it tidier to put the top level code in a function,

Re: mapLast, mapFirst, and just general iterator questions

2022-06-14 Thread Chris Angelico
On Wed, 15 Jun 2022 at 05:45, Roel Schroeven wrote: > > Chris Angelico schreef op 14/06/2022 om 20:47: > > > def main(): > > > for each in (iterEmpty, iter1, iter2, iterMany): > > > baseIterator = each() > > > chopFirst = mapFirst(baseIterator, lambda x: x[1:-1]) > > >

Re: mapLast, mapFirst, and just general iterator questions

2022-06-14 Thread Roel Schroeven
Chris Angelico schreef op 14/06/2022 om 20:47: > def main(): > for each in (iterEmpty, iter1, iter2, iterMany): > baseIterator = each() > chopFirst = mapFirst(baseIterator, lambda x: x[1:-1]) > andCapLast = mapLast(chopFirst, lambda x: x.upper()) > print(repr("

Re: mapLast, mapFirst, and just general iterator questions

2022-06-14 Thread Chris Angelico
On Wed, 15 Jun 2022 at 04:07, Travis Griggs wrote: > def mapFirst(stream, transform): > try: > first = next(stream) > except StopIteration: > return > yield transform(first) > yield from stream Small suggestion: Begin with this: stream = iter(stream) That way, yo

mapLast, mapFirst, and just general iterator questions

2022-06-14 Thread Travis Griggs
I want to be able to apply different transformations to the first and last elements of an arbitrary sized finite iterator in python3. It's a custom iterator so does not have _reversed_. If the first and last elements are the same (e.g. size 1), it should apply both transforms to the same element

Re: matplotlib questions

2021-08-28 Thread MRAB
On 2021-08-28 04:39, Steve wrote: I would like to know how the data is placed on the Y-axis and at the tops of the bars. The data is not being shown properly. With some exceptions, it looks as if the data is getting sorted independently from the dates. OK, here is the code: ===

RE: matplotlib questions

2021-08-27 Thread Steve
90 3.75 Thu Aug 19, 2021 09128 5.33 Wed Aug 25, 2021 02137 5.71 -Original Message- From: Python-list On Behalf Of David Lowry-Duda Sent: Friday, August 27, 2021 3:25 PM To: python-list@python.org Subject: Re:

Re: matplotlib questions

2021-08-27 Thread David Lowry-Duda
> I am trying to modify the "Bar Graph Demo" at > https://matplotlib.org/stable/gallery/index.html, Lines, bars, and > markers > but the more I experiment and change the code, the more messed up it > becomes. It is much easier to give constructive suggestions if you give a minimum runnable code

RE: matplotlib questions

2021-08-27 Thread Schachner, Joseph
: matplotlib questions I am trying to modify the "Bar Graph Demo" at https://matplotlib.org/stable/gallery/index.html, Lines, bars, and markers but the more I experiment and change the code, the more messed up it becomes. I have the demo code working. This is my second attempt. I guess I ac

Re: matplotlib questions

2021-08-26 Thread Mats Wichmann
On 8/26/21 9:47 AM, Steve wrote: I am trying to modify the "Bar Graph Demo" at https://matplotlib.org/stable/gallery/index.html, Lines, bars, and markers but the more I experiment and change the code, the more messed up it becomes. I have the demo code working. This is my second attempt. I gue

matplotlib questions

2021-08-26 Thread Steve
I am trying to modify the "Bar Graph Demo" at https://matplotlib.org/stable/gallery/index.html, Lines, bars, and markers but the more I experiment and change the code, the more messed up it becomes. I have the demo code working. This is my second attempt. I guess I accidentally got my first char

Re: Code Formatter Questions

2021-03-30 Thread Terry Reedy
On 3/29/2021 4:18 PM, dn via Python-list wrote: Very good point: I'd much rather you spent time helping me with a design/coding problem, helping debug, and/or reviewing/improving my code (and I for you); than we had not time left-over after spending many hours and much mental energy arguing abou

Re: Code Formatter Questions

2021-03-29 Thread dn via Python-list
On 29/03/2021 23.15, Matt Wheeler wrote: >> On 29 Mar 2021, at 04:45, Cameron Simpson wrote: >> >> yapf has many tunings. Worth a look. It is my preferred formatter. By >> comparison, black is both opinionated and has basicly no tuning, >> something I greatly dislike. > > This is not a mark or

Re: Code Formatter Questions

2021-03-29 Thread Matt Wheeler
> On 29 Mar 2021, at 04:45, Cameron Simpson wrote: > > yapf has many tunings. Worth a look. It is my preferred formatter. By > comparison, black is both opinionated and has basicly no tuning, > something I greatly dislike. This is not a mark or a vote against yapf (I’ve never used it), but I

Re: Code Formatter Questions

2021-03-28 Thread Cameron Simpson
On 28Mar2021 15:42, Travis Griggs wrote: >I've been looking into using a code formatter as a code base size has grown as >well as contributing developers. I've found and played with autopep, black, >and yapf. As well as whatever pycharm has (which may just be gui preferences >around one of thos

Re: Code Formatter Questions

2021-03-28 Thread dn via Python-list
ferences around one of those 3). > > I have 2 questions: > 1) Are there any major other formatters that I can/should look at? I see some > "online" pretty printers, but I'm after something I can run on whole > recursive directories of code. > > 2) I use more a

Re: Code Formatter Questions

2021-03-28 Thread Skip Montanaro
> 1) Are there any major other formatters that I can/should look at? I see some > "online" pretty printers, but I'm after something I can run on whole > recursive directories of code. I use Emacs, so I'm kind of biased, but I find its python-mode does a good job, good enough that I wouldn't use

Re: Code Formatter Questions

2021-03-28 Thread Paul Bryan
ust be gui preferences around one of those 3). > > I have 2 questions: > 1) Are there any major other formatters that I can/should look at? I > see some "online" pretty printers, but I'm after something I can run > on whole recursive directories of code. I assume you

Code Formatter Questions

2021-03-28 Thread Travis Griggs
I've been looking into using a code formatter as a code base size has grown as well as contributing developers. I've found and played with autopep, black, and yapf. As well as whatever pycharm has (which may just be gui preferences around one of those 3). I have 2 questions: 1) Are

Re: Questions about XML processing?

2020-11-08 Thread Hernán De Angelis
On 2020-11-07 20:03, Dieter Maurer wrote: Hernán De Angelis wrote at 2020-11-6 21:54 +0100: ... However, the hard thing to do here is to get those only when tagC/note/title/string='value'. I was expecting to find a way of specifying a certain construction in square brackets, like [@string='valu

Re: Questions about XML processing?

2020-11-07 Thread Dieter Maurer
Hernán De Angelis wrote at 2020-11-6 21:54 +0100: > ... >However, the hard thing to do here is to get those only when >tagC/note/title/string='value'. I was expecting to find a way of >specifying a certain construction in square brackets, like >[@string='value'] or [@/tagC/note/title/string='value'

Re: Questions about XML processing?

2020-11-07 Thread Hernán De Angelis
ot;) >> if element2.text == 'value' >> element3 = element1.findall("./tagA/tagB/tagC/string) >> for element4 in element3: >> string.append(element4.text) >> >> >> Crude, but

Re: Questions about XML processing?

2020-11-07 Thread Shaozhong SHI
> > > Crude, but works. As I wrote above, I was wishing that a bracketed > clause of the type [@ ...] already in the first "findall" would do a > more efficient job but alas my knowledge of xml is too rudimentary. > Perhaps something to tinker on in the coming weeks. >

Re: Questions about XML processing?

2020-11-06 Thread Hernán De Angelis
. Have a nice weekend! On 2020-11-06 20:10, Terry Reedy wrote: On 11/6/2020 11:17 AM, Hernán De Angelis wrote: I am confronting some XML parsing challenges and would like to ask some questions to more knowledgeable Python users. Apparently there exists a group for such questions but that l

Re: Questions about XML processing?

2020-11-06 Thread Terry Reedy
On 11/6/2020 11:17 AM, Hernán De Angelis wrote: I am confronting some XML parsing challenges and would like to ask some questions to more knowledgeable Python users. Apparently there exists a group for such questions but that list (xml-sig) has apparently not received (or archived) posts since

Questions about XML processing?

2020-11-06 Thread Hernán De Angelis
Hi everyone I am confronting some XML parsing challenges and would like to ask some questions to more knowledgeable Python users. Apparently there exists a group for such questions but that list (xml-sig) has apparently not received (or archived) posts since May 2018(!). I wonder if there are

Re: Python running in the Command Prompt Window questions

2020-08-02 Thread dn via Python-list
On 03/08/2020 13:52, Steve wrote: When I double click on a .py file, it executes at the command prompt with black background and small white font. Is there python code to change the font size and background color? Ctrl-Shift-+ ? === FootNote: Would it be

Python running in the Command Prompt Window questions

2020-08-02 Thread Steve
When I double click on a .py file, it executes at the command prompt with black background and small white font. Is there python code to change the font size and background color? === FootNote: Would it be ironic if Popeye’s chicken was fried in Olive Oil?

Re: questions re: calendar module

2020-08-02 Thread Richard Damon
On 8/2/20 5:38 PM, o1bigtenor wrote: > On Sun, Aug 2, 2020 at 2:08 PM Dennis Lee Bieber > wrote: >> On Sat, 1 Aug 2020 19:24:41 -0500, o1bigtenor >> declaimed the following: >> >>> It is very disappointing - - - -suggests that thinking outside the space of >>> one year is somehow deprecated. Fru

Re: questions re: calendar module

2020-08-02 Thread o1bigtenor
On Sun, Aug 2, 2020 at 2:08 PM Dennis Lee Bieber wrote: > > On Sat, 1 Aug 2020 19:24:41 -0500, o1bigtenor > declaimed the following: > > > > >It is very disappointing - - - -suggests that thinking outside the space of > >one year is somehow deprecated. Frustrated when what you do demands > >that

Re: questions re: calendar module

2020-08-02 Thread o1bigtenor
On Sun, Aug 2, 2020 at 2:28 PM Richard Damon wrote: > > On 8/2/20 12:58 PM, Dennis Lee Bieber wrote: > > Yet follows what most /print/ calendars contain (though some companies > > put the last four months of the current year in a 4-up page, before doing > > one month per page for the new yea

Re: questions re: calendar module

2020-08-02 Thread Richard Damon
On 8/2/20 12:58 PM, Dennis Lee Bieber wrote: > Yet follows what most /print/ calendars contain (though some companies > put the last four months of the current year in a 4-up page, before doing > one month per page for the new year). "Daily planner" journals also tend to > cover just one year

Re: questions re: calendar module

2020-08-02 Thread Peter Otten
Richard Damon wrote: > I would likely just build the formatter to start by assuming 6 week > months, and then near the end, after stacking the side by side months, > see if it can be trimmed out (easier to remove at the end then add if > needed) If you like some itertools gymnastics: you can form

Re: questions re: calendar module

2020-08-02 Thread Richard Damon
On 8/2/20 7:26 AM, o1bigtenor wrote: > The differences become very relevant for formatting. A month that has > 4 weeks takes a different amount of vertical space than a month that > has 6 weeks. The only month that has only 4 weeks would be Febuary, on non-lead years, that starts on Sunday (or wha

Re: questions re: calendar module

2020-08-02 Thread 2QdxY4RzWzUUiLuE
On 2020-08-02 at 06:26:10 -0500, o1bigtenor wrote: > On Sat, Aug 1, 2020 at 11:33 PM dn via Python-list > wrote: > > The fact that some months have fewer, or more, weeks to include, is > > largely irrelevant. The solution is a standard "merge" algorithm. (us > > 'silver surfers' cut our teeth o

Re: questions re: calendar module

2020-08-02 Thread o1bigtenor
On Sat, Aug 1, 2020 at 11:33 PM dn via Python-list wrote: > > On 02/08/2020 12:24, o1bigtenor wrote: > > On Sat, Aug 1, 2020 at 6:29 PM dn via Python-list > > wrote: > >> On 01/08/2020 23:36, o1bigtenor wrote: > >>> On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list > >>> mailto:python-list@python

Re: questions re: calendar module

2020-08-01 Thread dn via Python-list
On 02/08/2020 12:42, o1bigtenor wrote: On Sat, Aug 1, 2020 at 7:24 PM o1bigtenor wrote: On Sat, Aug 1, 2020 at 6:29 PM dn via Python-list wrote: On 01/08/2020 23:36, o1bigtenor wrote: On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list mailto:python-list@python.org>> wrote: On 31/07/2020

Re: questions re: calendar module

2020-08-01 Thread dn via Python-list
On 02/08/2020 12:24, o1bigtenor wrote: On Sat, Aug 1, 2020 at 6:29 PM dn via Python-list wrote: On 01/08/2020 23:36, o1bigtenor wrote: On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list mailto:python-list@python.org>> wrote: On 31/07/2020 02:52, o1bigtenor wrote: > I regularly work i

Re: questions re: calendar module

2020-08-01 Thread o1bigtenor
On Sat, Aug 1, 2020 at 7:24 PM o1bigtenor wrote: > > On Sat, Aug 1, 2020 at 6:29 PM dn via Python-list > wrote: > > > > On 01/08/2020 23:36, o1bigtenor wrote: > > > On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list > > > mailto:python-list@python.org>> wrote: > > > > > > On 31/07/2020 02:52,

Re: questions re: calendar module

2020-08-01 Thread o1bigtenor
On Sat, Aug 1, 2020 at 6:29 PM dn via Python-list wrote: > > On 01/08/2020 23:36, o1bigtenor wrote: > > On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list > > mailto:python-list@python.org>> wrote: > > > > On 31/07/2020 02:52, o1bigtenor wrote: > > > I regularly work in planning through mu

Re: questions re: calendar module

2020-08-01 Thread dn via Python-list
On 01/08/2020 23:36, o1bigtenor wrote: On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list mailto:python-list@python.org>> wrote: On 31/07/2020 02:52, o1bigtenor wrote: > I regularly work in planning through multiple years at once. > This means that I like to have a lot of stuff ava

Re: questions re: calendar module

2020-08-01 Thread William Ray Wing via Python-list
> On Aug 1, 2020, at 10:35 AM, o1bigtenor wrote: > > On Sat, Aug 1, 2020 at 9:29 AM o1bigtenor wrote: >> >>> On Sat, Aug 1, 2020 at 6:58 AM Peter Otten <__pete...@web.de> wrote: >>> >>> o1bigtenor wrote: >>> >>> import calendar >>> print (calendar.calendar(2024,1,1,2,8)) >>> I

Re: questions re: calendar module

2020-08-01 Thread o1bigtenor
On Sat, Aug 1, 2020 at 9:29 AM o1bigtenor wrote: > > On Sat, Aug 1, 2020 at 6:58 AM Peter Otten <__pete...@web.de> wrote: > > > > o1bigtenor wrote: > > > > import calendar > > print (calendar.calendar(2024,1,1,2,8)) > > > > > I would like to show something like 2024 through the end of 20

Re: questions re: calendar module

2020-08-01 Thread o1bigtenor
On Sat, Aug 1, 2020 at 6:58 AM Peter Otten <__pete...@web.de> wrote: > > o1bigtenor wrote: > > import calendar > print (calendar.calendar(2024,1,1,2,8)) > > > I would like to show something like 2024 through the end of 2028. > > print("\n".join(cd.calendar(year) for year in range(2024, 20

Re: questions re: calendar module

2020-08-01 Thread Peter Otten
o1bigtenor wrote: import calendar print (calendar.calendar(2024,1,1,2,8)) > I would like to show something like 2024 through the end of 2028. print("\n".join(cd.calendar(year) for year in range(2024, 2029))) -- https://mail.python.org/mailman/listinfo/python-list

Re: questions re: calendar module

2020-08-01 Thread o1bigtenor
On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list wrote: > On 31/07/2020 02:52, o1bigtenor wrote: > > I regularly work in planning through multiple years at once. > > This means that I like to have a lot of stuff available in a calendar > > function. > > Python seems to be locked when I need to d

Re: questions re: calendar module

2020-07-31 Thread dn via Python-list
On 31/07/2020 02:52, o1bigtenor wrote: I regularly work in planning through multiple years at once. This means that I like to have a lot of stuff available in a calendar function. Python seems to be locked when I need to display more than 1 year at a time. I don't see a way to display something l

questions re: calendar module

2020-07-30 Thread o1bigtenor
Greetings I regularly work in planning through multiple years at once. This means that I like to have a lot of stuff available in a calendar function. Python seems to be locked when I need to display more than 1 year at a time. I don't see a way to display something like 3 years worth of calendar

Re: questions:

2020-04-01 Thread DL Neil via Python-list
he Python community! (To my knowledge/I am not ListAdmin) Someone may *belong* to both lists (and more). If not, you'll be able to light your cigar from me, as we both go-down-in-flames... *However,* posting the same question to both lists concurrently will not win you any friends! Fo

questions:

2020-04-01 Thread anson freer
Will Anaconda2, Python2, jupyter and many applications I have for python harm the 3.8.2? should I be in Python Tutor and in this one(current email)at the same time? Or is it one or the other not both I want to learn how to use PDF to read files that have racing form style forms(my hobbie is Horse h

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: 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: Hi there! We are here to answer any questions you have about Udacit...

2019-11-11 Thread joseph pareti
pareti < joeparet...@gmail.com>: > > > -- Forwarded message - > Von: joseph pareti > Date: Do., 7. Nov. 2019 um 09:26 Uhr > Subject: Re: Hi there! We are here to answer any questions you have about > Udacit... > To: Sherry from Udacity > > > ap

Questions on working with unittest.IsolatedAsyncioTestCase

2019-11-07 Thread Mond Wan
IsolatedAsyncioTestCase to throw any exceptions to crash the main program such that I can read the line number? I have also issue a post on stackoverflow, which include the codes I have written for explaining the question. Stackoverflow: https://stackoverflow.com/questions/58744043/how-to-handle-cancellederror-with

Re: Questions about the IO modules and C-api

2019-06-03 Thread eryk sun
On 6/2/19, Windson Yang wrote: > > f = open('myfile, 'a+b') This is missing the closing quote around 'myfile'. > I added a printf statement at the beginning of _io_open_impl Repeatedly rebuilding the interpreter sounds like a frustrating learning experience, IMO. Use a debugger such as gdb

Re: Questions about the IO modules and C-api

2019-06-02 Thread Thomas Jollans
On 03/06/2019 04:02, Windson Yang wrote: > I have some questions about the IO modules. > > 1. My script: > > f = open('myfile, 'a+b') > f.close() > > I added a printf statement at the beginning of _io_open_impl > <https://github.com/pytho

Questions about the IO modules and C-api

2019-06-02 Thread Windson Yang
I have some questions about the IO modules. 1. My script: f = open('myfile, 'a+b') f.close() I added a printf statement at the beginning of _io_open_impl <https://github.com/python/cpython/blob/master/Modules/_io/_iomodule.c#L233>, the output is: _io_open

Re: Questions on Instance methods

2019-04-22 Thread dieter
Arup Rakshit writes: > ... > As you saw from documentation link, those are just words kind of spec. > Which source you recommend to read which explains these concepts more with > example codes. I cannot help you much with this -- I am much turned towards spec[ification] like documentation and ha

Re: Questions on Instance methods

2019-04-21 Thread eryk sun
On 4/21/19, Arup Rakshit wrote: > > I am reading https://docs.python.org/3/reference/index.html now, and it > seems like saying what Python can do, but not going deep to explain it > to a new comers most of the time. The guide to Python descriptors may help. https://docs.python.org/3/howto/descr

Re: Questions on Instance methods

2019-04-21 Thread Arup Rakshit
concepts more with example codes. Otherwise, I think the list will be flooded by questions from me as there are so many things I feel like abstract. I found Python official tutorial more explanatory and not much questions came while I was reading it. But it didn’t cover everything, it explains as a

Re: Questions on Instance methods

2019-04-19 Thread dieter
Arup Rakshit writes: >>When an instance method object is created by retrieving a class method >> object from a class or instance, its __self__ attribute is the class itself, >> and its __func__ attribute is the function object underlying the class >> method. >

Questions on Instance methods

2019-04-19 Thread Arup Rakshit
>When an instance method object is created by retrieving a class method > object from a class or instance, its __self__ attribute is the class itself, > and its __func__ attribute is the function object underlying the class method. Here I have 2 questions: 1. How do you create an

Re: [Tutor] Questions

2019-04-08 Thread William Ray Wing via Python-list
Diana, I’m answering you via the Tutor list - please, the accepted protocol is to send all questions and answers to the list so answers can be seen by (and possibly help) others. Having said that, I should have paid more attention to your original question, which is really going to require

Re: Python Interview Questions

2019-01-10 Thread lingmaaki
Python Interview Questions and answers... http://net-informations.com/python/iq/default.htm -- https://mail.python.org/mailman/listinfo/python-list

Re: setup.py and licensing questions

2018-12-12 Thread songbird
Ben Finney wrote: > songbird writes: > >> can i put multiple License lines in setup.py >> classifiers like: ? >> >> "License :: OSI Approved :: ???", >> "License :: OSI Approved :: ???", > > Yes. > > The semantics of that are not formalised, to my knowledge. You would be > si

Re: setup.py and licensing questions

2018-12-12 Thread Ben Finney
songbird writes: > can i put multiple License lines in setup.py > classifiers like: ? > > "License :: OSI Approved :: ???", > "License :: OSI Approved :: ???", Yes. The semantics of that are not formalised, to my knowledge. You would be signaling that the specified licens

setup.py and licensing questions

2018-12-12 Thread songbird
hi, i'm currently working through all the packaging and licensing stuff for my project and want to put the license in the setup.py file, but there may actually be more than one license (GPL ones for the artwork i've borrowed from another project and whatever license i choose to put on my ow

Re: Peewee ORM questions

2018-11-13 Thread TUA
Brainfart has left the building print(model_to_dict(row, exclude = (row.created, row.updated))) should have been print(model_to_dict(row, exclude = (model.created, model.updated))) -- https://mail.python.org/mailman/listinfo/python-list

Peewee ORM questions

2018-11-13 Thread TUA
Hi all, couldn't find a group for Peewee, so here I am: Given a table structure of {'id': , 'username': , 'password': , 'created': , 'updated': } Using playhouse.shortcuts: def ListAll(model): for row in model.select(): print(model_to_dict(row, exclude = (row.created, row.

Re: Questions about weakref

2018-10-16 Thread Thomas Jollans
On 2018-10-16 11:10, Frank Millman wrote: > Hi all > > I have some questions about using weakrefs. > > My first question is whether weakrefs are the correct tool for my > situation. My use-case is not mentioned in the docs, so maybe it is not > intended to be used this way.

Questions about weakref

2018-10-16 Thread Frank Millman
Hi all I have some questions about using weakrefs. My first question is whether weakrefs are the correct tool for my situation. My use-case is not mentioned in the docs, so maybe it is not intended to be used this way. I have a lot of objects active in my app. Some of them (A) are fairly

Questions on PEP 440 - Version Identification and Dependency Specification

2018-08-18 Thread Ryan Holmes
Greetings all, I currently follow PEP 440 as it relates to my application. Right now we follow a x.y.z scheme, with y incrementing with our normal releases, z incrementing for any bug fixes for that release, and x not really incrementing unless something major happens (for example, our conversi

Re: Questions about `locals` builtin

2018-02-28 Thread Chris Angelico
On Wed, Feb 28, 2018 at 10:59 PM, Steven D'Aprano wrote: > On Wed, 28 Feb 2018 18:01:42 +1100, Chris Angelico wrote: > >> If you really want a list of ALL the local names in a function, you can >> look at its __code__ object, which has a tuple of variable names: >> >> print(func1.__code__.co_varna

Re: Questions about `locals` builtin

2018-02-28 Thread Chris Angelico
On Wed, Feb 28, 2018 at 10:58 PM, Steven D'Aprano wrote: > On Wed, 28 Feb 2018 18:04:11 +1100, Chris Angelico wrote: >> But if you know that >> there's only a handful of variables that you'd actually want to do that >> to, you can simply put those into an object of some form, and then >> mutate th

Re: Questions about `locals` builtin

2018-02-28 Thread Steven D'Aprano
On Wed, 28 Feb 2018 18:01:42 +1100, Chris Angelico wrote: > If you really want a list of ALL the local names in a function, you can > look at its __code__ object, which has a tuple of variable names: > > print(func1.__code__.co_varnames) > > That information is static to the function, as it is i

Re: Questions about `locals` builtin

2018-02-28 Thread Steven D'Aprano
On Wed, 28 Feb 2018 18:04:11 +1100, Chris Angelico wrote: > On Wed, Feb 28, 2018 at 5:54 PM, dieter wrote: [...] >> I am still working with Python 2 (Python 3 may behave differently). >> There, during debugging, I would sometimes like to change the value of >> variables (I know that the variable

Re: Questions about `locals` builtin

2018-02-27 Thread Chris Angelico
On Wed, Feb 28, 2018 at 5:54 PM, dieter wrote: > Ned Batchelder writes: >> On 2/27/18 3:52 AM, Kirill Balunov wrote: >>> a. Is this restriction for locals desirable in the implementation of >>> CPython in Python 3? >>> b. Or is it the result of temporary fixes for Python 2? >> >> My understandi

Re: Questions about `locals` builtin

2018-02-27 Thread Chris Angelico
On Tue, Feb 27, 2018 at 5:55 AM, Kirill Balunov wrote: > 2. The documentation has a note that "The contents of this dictionary > should not be modified". Which implies that it is a read only mapping. So > the question why it is `dict` instead of `types.MappingProxyType`? A dict is smaller and fas

Re: Questions about `locals` builtin

2018-02-27 Thread dieter
Ned Batchelder writes: > On 2/27/18 3:52 AM, Kirill Balunov wrote: >> a. Is this restriction for locals desirable in the implementation of >> CPython in Python 3? >> b. Or is it the result of temporary fixes for Python 2? > > My understanding is that the behavior of locals() is determined mostly

Re: Questions about `locals` builtin

2018-02-27 Thread dieter
Kirill Balunov writes: > 2018-02-27 2:57 GMT+03:00 Terry Reedy : > >> The point of point 3 is that terminology and details would likely be >> different if Python were freshly designed more or less as it is today, and >> some things only make more or less sense in historical context. Learn what >>

Re: Questions about `locals` builtin

2018-02-27 Thread Kirill Balunov
2018-02-27 14:59 GMT+03:00 Ned Batchelder : > On 2/27/18 3:52 AM, Kirill Balunov wrote: > >> a. Is this restriction for locals desirable in the implementation of >> CPython in Python 3? >> b. Or is it the result of temporary fixes for Python 2? >> > > My understanding is that the behavior of lo

Re: Questions about `locals` builtin

2018-02-27 Thread Ned Batchelder
On 2/27/18 3:52 AM, Kirill Balunov wrote: a. Is this restriction for locals desirable in the implementation of CPython in Python 3? b. Or is it the result of temporary fixes for Python 2? My understanding is that the behavior of locals() is determined mostly by what is convenient for the imp

Re: Questions about `locals` builtin

2018-02-27 Thread Kirill Balunov
2018-02-27 2:57 GMT+03:00 Terry Reedy : > The point of point 3 is that terminology and details would likely be > different if Python were freshly designed more or less as it is today, and > some things only make more or less sense in historical context. Learn what > you need to know to write code

Re: Questions about `locals` builtin

2018-02-27 Thread Steven D'Aprano
On Mon, 26 Feb 2018 17:05:46 -0800, Dan Stromberg wrote: [...] > I don't have IronPython handy, but according my (quite possibly flawed) > test program, locals() is a copy on CPython 3, CPython 2, Pypy3, Pypy, > Jython and MicroPython. > > I didn't see any interpreters that returned the namespace

  1   2   3   4   5   6   7   8   9   10   >