Re: Get the source of a class reliably?!?

2019-04-29 Thread Chris Angelico
On Tue, Apr 30, 2019 at 4:40 PM dieter wrote: > > "computermaster360 ." writes: > > > Does anyone have an idea why classes don't contain their definition > > line number as functions or methods do? > > > some_fun.__code__.co_firstlineno > > 123 > > Because classes do not have associated "cod

Re: Get the source of a class reliably?!?

2019-04-29 Thread dieter
"computermaster360 ." writes: > Does anyone have an idea why classes don't contain their definition > line number as functions or methods do? > some_fun.__code__.co_firstlineno > 123 Because classes do not have associated "code" objects. As you see above, it is not the function itself ("so

Re: Checking network input processing by Python for a multi-threaded server

2019-04-29 Thread dieter
Markus Elfring writes: > ... > I constructed another multi-threaded TCP server for my needs > (based on the available software documentation). > https://docs.python.org/3/library/socketserver.html#asynchronous-mixins > ... > elfring@Sonne:~/Projekte/Coccinelle/janitor> time /usr/bin/python3 > lis

Re: Python best practice instantiating classes in app

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

Re: Generating generations of files

2019-04-29 Thread Gene Heskett
On Monday 29 April 2019 20:20:50 DL Neil wrote: > On 30/04/19 11:57 AM, Chris Angelico wrote: > > On Tue, Apr 30, 2019 at 9:46 AM Eli the Bearded <*@eli.users.panix.com> wrote: > >> In comp.lang.python, DL Neil wrote: > >>> On 30/04/19 10:59 AM, Chris Angelico wrote: > > bet a FAT filesyst

Re: Generating generations of files

2019-04-29 Thread Cameron Simpson
On 30Apr2019 11:24, DL Neil wrote: On 30/04/19 8:17 AM, MRAB wrote: Why would generation numbers result in a 'ripple' of renaming? You're assuming that "output.rpt.1" comes after "output.rpt.2", but it could just as well come before (generation 1 precedes generation 2, etc.). You're just lef

Re: Generating generations of files

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

Re: Generating generations of files

2019-04-29 Thread Chris Angelico
On Tue, Apr 30, 2019 at 9:54 AM DL Neil wrote: > > On 30/04/19 8:04 AM, Chris Angelico wrote: > > On Tue, Apr 30, 2019 at 6:00 AM DL Neil > > wrote: > >> > >> Are you aware of a library/utility which will generate and maintain the > >> file names of multiple generations of a file? > >> > > > > C

Re: Generating generations of files

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

Re: Generating generations of files

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

Re: Generating generations of files

2019-04-29 Thread Eli the Bearded
In comp.lang.python, DL Neil wrote: > On 30/04/19 10:59 AM, Chris Angelico wrote: >>> bet a FAT filesystem would produce a different error >> Probably it'd raise BadFileSystemError or something. Which is a > Fortunately, it runs on a Linux 'compute server'. I mount FAT under Linux all the time.

Re: Generating generations of files

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

Re: Generating generations of files

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

Re: Generating generations of files

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

Re: Generating generations of files

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

Re: Generating generations of files

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

Re: Generating generations of files

2019-04-29 Thread Eli the Bearded
In comp.lang.python, Peter J. Holzer wrote: > On 2019-04-29 20:12:28 -, Grant Edwards wrote: >> Well, the FILES-11 filesystem on VAX/VMS did that automatically, but >> that's probably not too helpful. > Until this is finished you could use something like this: > > #!/usr/bin/python3 > > impo

Get the source of a class reliably?!?

2019-04-29 Thread computermaster360 .
Does anyone have an idea why classes don't contain their definition line number as functions or methods do? >>> some_fun.__code__.co_firstlineno 123 >>> SomeClass.??? This leads to some funny stuff when using `inspect`, such as this: -- weird.py - """ class C: HAHAH

Re: Generating generations of files

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

Re: Generating generations of files

2019-04-29 Thread MRAB
On 2019-04-29 20:59, DL Neil wrote: Are you aware of a library/utility which will generate and maintain the file names of multiple generations of a file? The system generates multiple output files. For example, one might be called "output.rpt". However, we do not want to 'lose' the output file(

Re: Generating generations of files

2019-04-29 Thread Grant Edwards
On 2019-04-29, DL Neil wrote: > Are you aware of a library/utility which will generate and maintain the > file names of multiple generations of a file? Well, the FILES-11 filesystem on VAX/VMS did that automatically, but that's probably not too helpful. Though I guess Python is actually availab

Re: Generating generations of files

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

Generating generations of files

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

Re: Python best practice instantiating classes in app

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

Re: Python best practice instantiating classes in app

2019-04-29 Thread Terry Reedy
On 4/29/2019 1:38 PM, Dave wrote: As apps get more complex we add modules, or Python files, to organize things.  One problem I have is a couple of data classes (list of dictionary objects) in a few modules that are used in a number of the other modules.  For example a list of meter reading dict

Checking network input processing by Python for a multi-threaded server

2019-04-29 Thread Markus Elfring
Hello, I constructed another multi-threaded TCP server for my needs (based on the available software documentation). https://docs.python.org/3/library/socketserver.html#asynchronous-mixins I constructed also a corresponding script which should send nine record sets (which get extracted from a sim

CheetahTemplate 3.2.2

2019-04-29 Thread Oleg Broytman
Hello! I'm pleased to announce version 3.2.2, the second bugfix release of branch 3.2 of CheetahTemplate3. What's new in CheetahTemplate3 == Contributors for this release are Pierre-Yves, Dan Vinakovsky, Nicolai Grodzitski. Minor features: - Replaced outdated and

Python best practice instantiating classes in app

2019-04-29 Thread Dave
As apps get more complex we add modules, or Python files, to organize things. One problem I have is a couple of data classes (list of dictionary objects) in a few modules that are used in a number of the other modules. For example a list of meter reading dictionaries in one module is used by

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

2019-04-29 Thread Thomas Jollans
On 29/04/2019 09.18, Peter Otten wrote: > Jonathan Leroy - Inikup via Python-list wrote: > >> Hi all, >> >> I'm writing a client library for a REST API. The API endpoints looks like >> this: /customers >> /customers/1 >> /customers/1/update >> /customers/1/delete >> >> Which of the following synta

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

2019-04-29 Thread Peter Otten
Jonathan Leroy - Inikup via Python-list wrote: > Hi all, > > I'm writing a client library for a REST API. The API endpoints looks like > this: /customers > /customers/1 > /customers/1/update > /customers/1/delete > > Which of the following syntax do you expect an API client library to > use, and