Re: TkInter Scrolled Listbox class?

2024-11-05 Thread Vishal Chandratreya via Python-list
could populate your list box and then put it inside that frame. I’ve not tested this scenario, so I’d appreciate feedback! Thanks.  On 4 Nov 2024, at 21:28, Ulrich Goebel via Python-list wrote: Hi, I would like to build a class ScrolledListbox, which can be packed

Re: TkInter Scrolled Listbox class?

2024-11-04 Thread Alan Gauld via Python-list
On 04/11/2024 15:32, Ulrich Goebel via Python-list wrote: > I would like to build a class ScrolledListbox, I assume like the one that used to be available via the Tix module? It's a great shame that Tix is gone, it had a lot of these useful widgets, but they were all wrappers around

Re: TkInter Scrolled Listbox class?

2024-11-04 Thread Cameron Simpson via Python-list
On 04Nov2024 16:32, Ulrich Goebel wrote: I would like to build a class ScrolledListbox, which can be packed somewhere in ttk.Frames. What I did is to build not really a scrolled Listbox but a Frame containing a Listbox and a Scrollbar: That's what I would build too.

TkInter Scrolled Listbox class?

2024-11-04 Thread Ulrich Goebel via Python-list
Hi, I would like to build a class ScrolledListbox, which can be packed somewhere in ttk.Frames. What I did is to build not really a scrolled Listbox but a Frame containing a Listbox and a Scrollbar: class FrameScrolledListbox(ttk.Frame): def __init__(self, *args, **kwargs): super

Re: return type same as class gives NameError.

2023-10-22 Thread Cameron Simpson via Python-list
On 22Oct2023 17:50, Antoon Pardon wrote: I have the following small module: =-=-=-=-=-=-=-=-=-=-=-= 8< =-=-=-=-=-=-=-=-=-=-=-=-= class Pnt (NamedTuple): x: float y: float def __add__(self, other: PNT) -> Pnt: return Pnt(self[0] + other[0], self[1] + other[1]) Whe

Re: return type same as class gives NameError.

2023-10-22 Thread dn via Python-list
On 23/10/2023 04.50, Antoon Pardon via Python-list wrote: I have the following small module: =-=-=-=-=-=-=-=-=-=-=-= 8< =-=-=-=-=-=-=-=-=-=-=-=-= from typing import NamedTuple, TypeAlias, Union from collections.abc import Sequence PNT: TypeAlias = tuple[float, float] class Pnt (NamedTu

return type same as class gives NameError.

2023-10-22 Thread Antoon Pardon via Python-list
I have the following small module: =-=-=-=-=-=-=-=-=-=-=-= 8< =-=-=-=-=-=-=-=-=-=-=-=-= from typing import NamedTuple, TypeAlias, Union from collections.abc import Sequence PNT: TypeAlias = tuple[float, float] class Pnt (NamedTuple): x: float y: float def __add__(self, other:

Re: What sort of exception when a class can't find something?

2023-08-31 Thread Chris Green via Python-list
Several helpful replies, thank you all. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: What sort of exception when a class can't find something?

2023-08-31 Thread Chris Angelico via Python-list
On Fri, 1 Sept 2023 at 06:39, Chris Green via Python-list wrote: > > What sort of exception should a class raise in __init__() when it > can't find an appropriate set of data for the parameter passed in to > the class instantiation? > > E.g. I have a database with some n

Re: What sort of exception when a class can't find something?

2023-08-31 Thread Peter J. Holzer via Python-list
On 2023-08-31 21:32:04 +0100, Chris Green via Python-list wrote: > What sort of exception should a class raise in __init__() when it > can't find an appropriate set of data for the parameter passed in to > the class instantiation? > > E.g. I have a database with some names and

What sort of exception when a class can't find something?

2023-08-31 Thread Chris Green via Python-list
What sort of exception should a class raise in __init__() when it can't find an appropriate set of data for the parameter passed in to the class instantiation? E.g. I have a database with some names and address in and have a class Person that gets all the details for a person given their

Re: Getty fully qualified class name from class object

2023-08-23 Thread Ian Pilcher via Python-list
On 8/22/23 11:13, Greg Ewing via Python-list wrote: Classes have a __module__ attribute: >>> logging.Handler.__module__ 'logging' Not sure why I didn't think to look for such a thing. Looks like it's as simple as f'{cls.__module__}.{cls.__qualname__}'. Thanks! -- ==

Re: Getty fully qualified class name from class object

2023-08-22 Thread Greg Ewing via Python-list
On 23/08/23 2:45 am, Ian Pilcher wrote: How can I programmatically get 'logging.Handler' from the class object? Classes have a __module__ attribute: >>> logging.Handler.__module__ 'logging' -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Getty fully qualified class name from class object

2023-08-22 Thread Ian Pilcher via Python-list
How can I programmatically get the fully qualified name of a class from its class object? (I'm referring to the name that is shown when str() or repr() is called on the class object.) Neither the __name__ or __qualname__ class attributes include the module. For example: >>>

Re: How to find the full class name for a frame

2023-08-04 Thread Jason Friedman via Python-list
> > Jason Friedman wrote at 2023-8-3 21:34 -0600: > > ... > >my_frame = inspect.currentframe() > > ... > >My question is: let's say I wanted to add a type hint for my_frame. > > `my_frame` will be an instance of `Types.FrameType`. > Confirmed. Thank you! -- https://mail.python.org/mailman/listinf

Re: How to find the full class name for a frame

2023-08-04 Thread Dieter Maurer via Python-list
Jason Friedman wrote at 2023-8-3 21:34 -0600: > ... >my_frame = inspect.currentframe() > ... >My question is: let's say I wanted to add a type hint for my_frame. `my_frame` will be an instance of `Types.FrameType`. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to find the full class name for a frame

2023-08-04 Thread Jason Friedman via Python-list
> My question is: let's say I wanted to add a type hint for my_frame. > > > > my_frame: some_class_name = inspect.currentframe() > > > > What would I put for some_class_name? > > "frame" (without quotations) is not recognized, > > Nor is inspect.frame. > > We know Python code is executed in an exec

Re: How to find the full class name for a frame

2023-08-03 Thread dn via Python-list
On 04/08/2023 15.34, Jason Friedman via Python-list wrote: import inspect def my_example(arg1, arg2): print(inspect.stack()[0][3]) my_frame = inspect.currentframe() args,_,_,values = inspect.getargvalues(my_frame) args_rendered = [f"{x}: {values[x]}" for x in args] print(args_rendered) my_examp

How to find the full class name for a frame

2023-08-03 Thread Jason Friedman via Python-list
import inspect def my_example(arg1, arg2): print(inspect.stack()[0][3]) my_frame = inspect.currentframe() args,_,_,values = inspect.getargvalues(my_frame) args_rendered = [f"{x}: {values[x]}" for x in args] print(args_rendered) my_example("a", 1) The above "works" in the sense it prints what I

Re: Meta Class Maybe?

2023-07-24 Thread Dom Grigonis via Python-list
> On 23 Jul 2023, at 02:12, Chris Nyland via Python-list > wrote: > > So I am stuck on a problem. I have a class which I want to use to create > another class without having to go through the boiler plate of subclassing. > Specifically because the subclass needs to

Re: Meta Class Maybe?

2023-07-23 Thread Dieter Maurer via Python-list
Chris Nyland wrote at 2023-7-22 19:12 -0400: >So I am stuck on a problem. I have a class which I want to use to create >another class without having to go through the boiler plate of subclassing. Do you know about `__init_subclass__`? It is called whenever a class is subclassed and can be u

Meta Class Maybe?

2023-07-22 Thread Chris Nyland via Python-list
So I am stuck on a problem. I have a class which I want to use to create another class without having to go through the boiler plate of subclassing. Specifically because the subclass needs to have certain class attributes and I would like to control how those are passed to provide defaults and

Re: Initialising a Config class

2023-04-11 Thread dn via Python-list
On 12/04/2023 02.29, Loris Bennett wrote: Hi, Having solved my problem regarding setting up 'logger' such that it is ... My reading suggests that setting up a module with a Config class which can be imported by any part of the program might be a reasonable approach: ... Howe

RE: Initialising a Config class

2023-04-11 Thread David Raymond
Not sure if I'm fully understanding the question. But one option instead of making everything class attributes is to just define __getattr__ for when it doesn't find an attribute. Won't work for every single valid section and option name (because of spaces, name overlaps, etc) b

Initialising a Config class

2023-04-11 Thread Loris Bennett
Hi, Having solved my problem regarding setting up 'logger' such that it is accessible throughout my program (thanks to the help on this list), I now have problem related to a slightly similar issue. My reading suggests that setting up a module with a Config class which can be impor

Re: Standard class for time *period*?

2023-03-29 Thread Cameron Simpson
On 29Mar2023 08:17, Loris Bennett wrote: I am glad to hear that I am not alone :-) However, my use-case is fairly trivial, indeed less complicated than yours. So, in truth I don't really need a Period class. I just thought it might be a sufficiently generic itch that someone else with a

Re: Standard class for time *period*?

2023-03-29 Thread Cameron Simpson
impson/css/blob/0ade6d191833b87cab8826d7ecaee4d114992c45/lib/python/cs/timeseries.py#L2163 On review it isn't a great match for a simple time range; it's aimed at expressing the time ranges into which my time series data files are broken up. I think most of the code using this particular

Re: Standard class for time *period*?

2023-03-29 Thread Thomas Passin
On 3/29/2023 2:17 AM, Loris Bennett wrote: I am glad to hear that I am not alone :-) However, my use-case is fairly trivial, indeed less complicated than yours. So, in truth I don't really need a Period class. I just thought it might be a sufficiently generic itch that someone else w

Re: Standard class for time *period*?

2023-03-29 Thread Loris Bennett
hear that I am not alone :-) However, my use-case is fairly trivial, indeed less complicated than yours. So, in truth I don't really need a Period class. I just thought it might be a sufficiently generic itch that someone else with a more complicated use-case could have already scratched. Af

Re: Standard class for time *period*?

2023-03-28 Thread Cameron Simpson
On 28Mar2023 08:05, Dennis Lee Bieber wrote: So far, you seem to be the only person who has ever asked for a single entity incorporating an EPOCH (datetime.datetime) + a DURATION (datetime.timedelta). But not the only person to want one. I've got a timeseries data format where (within a fi

Re: Standard class for time *period*?

2023-03-28 Thread dn via Python-list
1. Is there a standard class for a 'period', i.e. length of time specified by a start point and an end point? The start and end points could obviously be datetimes and the difference a timedelta, but the period '2022-03-01 00:00 to 2022-03-02 00:00' would be diff

Re: Standard class for time *period*?

2023-03-28 Thread Grant Edwards
>>> DURATION (datetime.timedelta). >> >> It seems to me that tuple of two timdate objects (start,end) is the >> more obvious representation, but it's six of one and a horse of the >> same color. >> >> If one really needs it to be a class, then it wo

Re: Standard class for time *period*?

2023-03-28 Thread Thomas Passin
(start,end) is the more obvious representation, but it's six of one and a horse of the same color. If one really needs it to be a class, then it woulnd't be much more than a dozen or two lines of code... I think it would be more than that. The OP said "But even if I have a single

Re: Standard class for time *period*?

2023-03-28 Thread Grant Edwards
e obvious representation, but it's six of one and a horse of the same color. If one really needs it to be a class, then it woulnd't be much more than a dozen or two lines of code... -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Standard class for time *period*?

2023-03-28 Thread Karsten Hilbert
> No, it doesn't. I already know about timedelta. I must have explained > the issue badly, because everyone seems to be fixating on the > formatting, which is not a problem and is incidental to what I am really > interested in, namely: > > 1. Is there a standard class for

Re: Standard class for time *period*?

2023-03-28 Thread rbowman
On Tue, 28 Mar 2023 15:11:14 +0200, Loris Bennett wrote: > But even if I have a single epoch, January 2022 is obviously different > to January 2023, even thought the duration might be the same. I am just > surprised that there is no standard Period class, with which I could > create

Re: Standard class for time *period*?

2023-03-28 Thread Dennis Lee Bieber
idental to what I am really >interested in, namely: > >1. Is there a standard class for a 'period', i.e. length of time > specified by a start point and an end point? The start and end > points could obviously be datetimes and the difference a timedelta, > but the

Re: Standard class for time *period*?

2023-03-28 Thread Loris Bennett
edelta should give the OP exactly what he's talking > about. No, it doesn't. I already know about timedelta. I must have explained the issue badly, because everyone seems to be fixating on the formatting, which is not a problem and is incidental to what I am really interested in, namely:

Re: Standard class for time *period*?

2023-03-28 Thread Loris Bennett
gt;>formatting, which is not a problem and is incidental to what I am really >>interested in, namely: >> >>1. Is there a standard class for a 'period', i.e. length of time >> specified by a start point and an end point? The start and end >> points coul

Re: Standard class for time *period*?

2023-03-27 Thread Thomas Passin
On 3/27/2023 11:34 AM, rbowman wrote: On Mon, 27 Mar 2023 15:00:52 +0200, Loris Bennett wrote: I need to deal with what I call a 'period', which is a span of time limited by two dates, start and end. The period has a 'duration', which is the elapsed time between start and end. The d

Re: Standard class for time *period*?

2023-03-27 Thread Gary Herron
the durations are usually hours or days, I would generally want to display the duration in a format such as "dd-hh:mm:ss" My (possibly ill-founded) expectation: There is a standard class which encapsulates this sort of functionality. My (possibly insufficiently researched) conclus

Re: Standard class for time *period*?

2023-03-27 Thread rbowman
On Mon, 27 Mar 2023 15:00:52 +0200, Loris Bennett wrote: > I need to deal with what I call a 'period', which is a span of time > limited by two dates, start and end. The period has a 'duration', > which is the elapsed time between start and end. The duration is > essentially a number of

Re: Standard class for time *period*?

2023-03-27 Thread Loris Bennett
atetime_1 = datetime.strptime( '2023-03-27T14:27:23+01:00', format ) > > print( datetime_1 - datetime_0 ) > > sys.stdout > > 0:26:31 > > . Days will also be shown if greater than zero. Thanks for the examples, but I am not really interested in how to write a b

Re: How does a method of a subclass become a method of the base class?

2023-03-27 Thread aapost
On 3/26/23 13:43, Jen Kris wrote: My question is:  what makes "choose_method" a method of the base class, called as self.choose_method instead of UrnaryConstraint.choose_method?  Is it super(UrnaryConstraint, self).__init__(strength) or just the fact that Constraint is its

Standard class for time *period*?

2023-03-27 Thread Loris Bennett
s, I would generally want to display the duration in a format such as "dd-hh:mm:ss" My (possibly ill-founded) expectation: There is a standard class which encapsulates this sort of functionality. My (possibly insufficiently researched) conclusion: Such a standard class does not exis

Re: How does a method of a subclass become a method of the base class?

2023-03-27 Thread Jen Kris via Python-list
Thanks to everyone who answered this question.  Your answers have helped a lot.  Jen Mar 27, 2023, 14:12 by m...@wichmann.us: > On 3/26/23 17:53, Jen Kris via Python-list wrote: > >> I’m asking all these question because I have worked in a procedural style >> for many

Re: How does a method of a subclass become a method of the base class?

2023-03-27 Thread Mats Wichmann
On 3/26/23 17:53, Jen Kris via Python-list wrote: I’m asking all these question because I have worked in a procedural style for many years, with class work limited to only simple classes, but now I’m studying classes in more depth. The three answers I have received today, including yours

Re: How does a method of a subclass become a method of the base class?

2023-03-27 Thread Peter J. Holzer
On 2023-03-27 01:53:49 +0200, Jen Kris via Python-list wrote: > But that brings up a new question.  I can create a class instance with > x = BinaryConstraint(), but what happens when I have a line like > "EqualityConstraint(prev, v, Strength.REQUIRED)"? If that is the whol

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Cameron Simpson
On 27Mar2023 12:03, Cameron Simpson wrote: On 27Mar2023 01:53, Jen Kris wrote: But that brings up a new question.  I can create a class instance with x = BinaryConstraint(), That makes an instance of EqualityConstraint. Copy/paste mistake on my part. This makes an instance of

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Cameron Simpson
On 27Mar2023 01:53, Jen Kris wrote: Thanks for your reply.  You are correct about the class definition lines – e.g. class EqualityConstraint(BinaryConstraint).  I didn’t post all of the code because this program is over 600 lines long.  It's DeltaBlue in the Python benchmark

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Jen Kris via Python-list
Cameron, Thanks for your reply.  You are correct about the class definition lines – e.g. class EqualityConstraint(BinaryConstraint).  I didn’t post all of the code because this program is over 600 lines long.  It's DeltaBlue in the Python benchmark suite.  I’ve done some more work

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Cameron Simpson
On 26Mar2023 22:36, Jen Kris wrote: At the final line it calls "satisfy" in the Constraint class, and that line calls choose_method in the BinaryConstraint class.  Just as Peter Holzer said, it requires a call to "satisfy."  My only remaining question is, did it select

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Jen Kris via Python-list
Based on your explanations, I went through the call chain and now I understand better how it works, but I have a follow-up question at the end.    This code comes from the DeltaBlue benchmark in the Python benchmark suite.  1 The call chain starts in a non-class program with the following

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Jen Kris via Python-list
st wrote: > >> The base class: >> >> >> class Constraint(object): >> >> def __init__(self, strength): >>     super(Constraint, self).__init__() >>     self.strength = strength >> >> def satisfy(self, mark): >>     global

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Richard Damon
On 3/26/23 1:43 PM, Jen Kris via Python-list wrote: The base class: class Constraint(object): def __init__(self, strength):     super(Constraint, self).__init__()     self.strength = strength def satisfy(self, mark):     global planner     self.choose_method(mark) The

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Peter J. Holzer
On 2023-03-26 19:43:44 +0200, Jen Kris via Python-list wrote: > The base class: > > > class Constraint(object): [...] > def satisfy(self, mark): >     global planner >     self.choose_method(mark) > > The subclass: > > class UrnaryConstraint(Constrain

How does a method of a subclass become a method of the base class?

2023-03-26 Thread Jen Kris via Python-list
The base class: class Constraint(object): def __init__(self, strength):     super(Constraint, self).__init__()     self.strength = strength def satisfy(self, mark):     global planner     self.choose_method(mark) The subclass: class UrnaryConstraint(Constraint): def

Re: We can call methods of parenet class without initliaze it?

2023-03-15 Thread Roel Schroeven
Op 15/03/2023 om 10:57 schreef scruel tao: The following code won’t be allowed in Java, but in python, it works fine: ```python class A: A = 3 def __init__(self): print(self.A) def p(self): print(self.A) self.A += 1 class B(A): def __init__(self

Re: We can call methods of parenet class without initliaze it?

2023-03-15 Thread Greg Ewing via Python-list
On 15/03/23 10:57 pm, scruel tao wrote: How can I understand this? Will it be a problem? I can't remember any details offhand, but I know I've occasionally made use of the ability to do this. It's fine as long as the method you're calling doesn't rely on anything you haven't initialised yet. -

We can call methods of parenet class without initliaze it?

2023-03-15 Thread scruel tao
The following code won’t be allowed in Java, but in python, it works fine: ```python class A: A = 3 def __init__(self): print(self.A) def p(self): print(self.A) self.A += 1 class B(A): def __init__(self): print(2) self.p() super

Re: Tool that can document private inner class?

2023-02-08 Thread Ian Pilcher
On 2/8/23 08:25, Weatherby,Gerard wrote: No. I interpreted your query as “is there something that can read docstrings of dunder methods?” Have you tried the Sphinx specific support forums? https://www.sphinx-doc.org/en/master/support.html Yes. I've posted to both the -user and -dev group

Re: Tool that can document private inner class?

2023-02-08 Thread Weatherby,Gerard
-list@python.org Subject: Re: Tool that can document private inner class? *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** On 2/7/23 14:53, Weatherby,Gerard wrote: > Yes. > > Inspect module > > import inspect > >

Re: Tool that can document private inner class?

2023-02-07 Thread Ian Pilcher
On 2/7/23 14:53, Weatherby,Gerard wrote: Yes. Inspect module import inspect class Mine: def __init__(self): self.__value = 7 def __getvalue(self): /"""Gets seven""" /return self.__value mine = Mine() data = inspect.getdoc(mine) for m in inspect.getmembers

Re: Tool that can document private inner class?

2023-02-07 Thread Weatherby,Gerard
Yes. Inspect module import inspect class Mine: def __init__(self): self.__value = 7 def __getvalue(self): """Gets seven""" return self.__value mine = Mine() data = inspect.getdoc(mine) for m in inspect.getmembers(mine): if &

Tool that can document private inner class?

2023-02-07 Thread Ian Pilcher
I've been banging my head on Sphinx for a couple of days now, trying to get it to include the docstrings of a private (name starts with two underscores) inner class. All I've managed to do is convince myself that it really can't do it. See https://github.com/sphinx-doc/sphinx/is

Announcing Clabate 0.5.0: minimalistic class-based templates for Python

2022-12-09 Thread Axy via Python-list
Hi there, although it's quite old my side project, it has reached the point where I don't want to add anything more. It's a simple template system based on standard string formatting. You declare your template strings as class attributes and they are formatted in the r

Re: Optional arguments in a class behave like class attributes.

2022-10-17 Thread Antoon Pardon
t KeyError: if parameter.default is not Parameter.empty: newargs.append(copy.deepcopy(parameter.default)) else: break return func(*newargs, **kwds) return wrapper class GameOne: @copy_defaults def __in

Re: Optional arguments in a class behave like class attributes.

2022-10-17 Thread Chris Angelico
On Tue, 18 Oct 2022 at 01:39, Abderrahim Adrabi wrote: > So, these default values behave like class attributes, here is a demo: > > # Using a list ----- > class GameOne: > def __init__(self, games = []) -> None: > self.games = games > Thi

Optional arguments in a class behave like class attributes.

2022-10-17 Thread Abderrahim Adrabi
Hi all, I tried to create a class with some optional arguments as always, but this time I used the default values to be lists, dictionaries, and object references. So, these default values behave like class attributes, here is a demo: # Using a list - class GameOne

Clabate: minimalistic class-based templates for Python

2022-08-02 Thread Axy via Python-list
Hi all, this is a test message after tweaking my self-hosted mail server and the subject is just in case if you receive it https://declassed.art/en/blog/2022/06/29/clabate-class-based-templates Previously I tried to reply to someone here but the message was rejected. Did not post to mail

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-25 Thread נתי שטרן
> """ > The Cython language is a superset of the Python language that additionally > supports calling C functions and declaring C types on variables and class > attributes. This allows the compiler to generate very efficient C code from > Cython code. The C code is gene

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Dennis Lee Bieber
uot;"" """ The Cython language is a superset of the Python language that additionally supports calling C functions and declaring C types on variables and class attributes. This allows the compiler to generate very efficient C code from Cython code. The C code is generate

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Dennis Lee Bieber
On Fri, 24 Jun 2022 15:14:50 +0300, ??? declaimed the following: >My TARGET is to bind many code libraries to one Huge code file that works >optimally and do optimizations if needed. >In this file have code of huge part of falconpy, ALL code of re, argparse, >are and many other code librari

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
I copied most of the libraries from cython בתאריך יום ו׳, 24 ביוני 2022, 17:18, מאת Roel Schroeven ‏< r...@roelschroeven.net>: > Op 24/06/2022 om 14:14 schreef נתי שטרן: > > My TARGET is to bind many code libraries to one Huge code file that > > works optimally and do optimizations if needed. >

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Roel Schroeven
Op 24/06/2022 om 14:14 schreef נתי שטרן: My TARGET  is to bind many code libraries to one Huge code file that works optimally and do optimizations if needed. In this file have code of huge part of falconpy, ALL code of re, argparse, are and many other code libraries Don't do that. Sorry, it's ju

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
Where found the license of those libraries? P. S. The copied and modified code used only for internal use בתאריך יום ו׳, 24 ביוני 2022, 15:28, מאת Chris Angelico ‏: > ‪On Fri, 24 Jun 2022 at 22:16, ‫נתי שטרן‬‎ wrote:‬ > > > > My TARGET is to bind many code libraries to one Huge code file that

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Chris Angelico
‪On Fri, 24 Jun 2022 at 22:16, ‫נתי שטרן‬‎ wrote:‬ > > My TARGET is to bind many code libraries to one Huge code file that works > optimally and do optimizations if needed. > In this file have code of huge part of falconpy, ALL code of re, argparse, > are and many other code libraries > > This co

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
My TARGET is to bind many code libraries to one Huge code file that works optimally and do optimizations if needed. In this file have code of huge part of falconpy, ALL code of re, argparse, are and many other code libraries This code file is contained 10k lines of python code בתאריך יום ו׳, 2

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Roel Schroeven
Op 24/06/2022 om 11:10 schreef נתי שטרן: OK. I lifted the full library to a HUGE python file that was saved on LAN in MY WORK Do I need to lift many other libraries to the file? I glad to any answer Answer this: what is it that your _actually_ trying to do? What is the ultimate goal of all that

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
OK. I lifted the full library to a HUGE python file that was saved on LAN in MY WORK Do I need to lift many other libraries to the file? I glad to any answer -- https://mail.python.org/mailman/listinfo/python-list

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Roel Schroeven
Op 24/06/2022 om 10:43 schreef נתי שטרן: what's the problem with the code Have you seen the replies from Mats Wichmann and Chris Angelico, who helpfully pointed out some problems with your code and possible improvements? Please take those into account instead of asking the same thing over

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
I did the changes on local copy of this code ‫בתאריך יום ו׳, 24 ביוני 2022 ב-11:50 מאת ‪Chris Angelico‬‏ <‪ ros...@gmail.com‬‏>:‬ > ‪On Fri, 24 Jun 2022 at 18:43, ‫נתי שטרן‬‎ wrote:‬ > > > > class _NamedIntConstant(int): > > def __new__(cls, value, name

Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Chris Angelico
‪On Fri, 24 Jun 2022 at 18:43, ‫נתי שטרן‬‎ wrote:‬ > > class _NamedIntConstant(int): > def __new__(cls, value, name): > self = super(_NamedIntConstant, cls).__new__(cls, value) > self.name = name > return self > > def __repr__(self): &g

sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread נתי שטרן
class _NamedIntConstant(int): def __new__(cls, value, name): self = super(_NamedIntConstant, cls).__new__(cls, value) self.name = name return self def __repr__(self): return self.name __reduce__ = None MAXREPEAT = _NamedIntConstant(32,name=str(32

Re: Tkinter module test: widget class not inserted in application frame

2022-06-18 Thread Rich Shepard
On Sat, 18 Jun 2022, Peter J. Holzer wrote: There is a comma (U+002C) here ... And a dot (U+002E) here. That was a typo when I wrote the message. And I usually add a space after commas and surrounding equal signs, all for easier reading. Thank you, Rich -- https://mail.python.org/mailman/lis

Re: Tkinter module test: widget class not inserted in application frame

2022-06-18 Thread Peter J. Holzer
On 2022-06-17 19:47:38 -0700, Rich Shepard wrote: > On Fri, 17 Jun 2022, Dennis Lee Bieber wrote: > > > > ContactNameInput, 'lname', > > > ContactNameInput, 'fname', > > This works if a tk.labelframe is where the widget is placed. In my case, as > MRAB taught me, the prope

Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Rich Shepard
On Fri, 17 Jun 2022, Dennis Lee Bieber wrote: ContactNameInput, 'lname', ContactNameInput, 'fname', This works if a tk.labelframe is where the widget is placed. In my case, as MRAB taught me, the proper syntax is self,'lname'... self.'fname'... Thanks,

Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Dennis Lee Bieber
On Fri, 17 Jun 2022 09:19:59 -0700 (PDT), Rich Shepard declaimed the following: >I'm not seeing the error source in a small tkinter module I'm testing. > >The module code: >--- >import tkinter as tk >from tkinter import ttk > >import common_classes as cc

Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Rich Shepard
On Fri, 17 Jun 2022, MRAB wrote: This: self.inputs['Last name'] = cc.LabelInput( ContactNameInput, 'lname', input_class = ttk.Entry, input_var = tk.StringVar() ) should be this: self.inputs['Last name'] = cc.LabelInput(

Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread MRAB
hat it should be an _instance_ of that class, in this case, 'self'. Haven't I done this in the application class? class NameApplication(tk.Tk): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.title("Contact

Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Rich Shepard
On Fri, 17 Jun 2022, MRAB wrote: You haven't shown the code for common_classes.LabelInput, but I'm guessing that the first argument should be the parent. Here's the LabelInput class: class LabelInput(tk.Frame): """ A widget containing a label and input togeth

Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread MRAB
On 2022-06-17 17:19, Rich Shepard wrote: I'm not seeing the error source in a small tkinter module I'm testing. The module code: --- import tkinter as tk from tkinter import ttk import common_classes as cc class ConactNameInput(tk.Frame): def __init__(self, par

Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Rich Shepard
I'm not seeing the error source in a small tkinter module I'm testing. The module code: --- import tkinter as tk from tkinter import ttk import common_classes as cc class ConactNameInput(tk.Frame): def __init__(self, parent, *args, **kwargs): super().__init__(par

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-19 Thread Random832
On Sat, Apr 16, 2022, at 13:35, Peter J. Holzer wrote: > When adding a timedeltacal object to a datetime, the fields are added > from most to least significant: First a new date is computed by > advancing the number of months specified [TODO: Research how other > systems handle overflow (e.g. 2022-

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-18 Thread Barry
> On 18 Apr 2022, at 13:01, Peter J. Holzer wrote: > > On 2022-04-16 20:25:45 +0100, Barry wrote: >> Suggest that you start with the use cases that you want supported. >> Then you can turn them into a set of tests to check that the solution works. > > Writing test cases is always a good idea

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-18 Thread Peter J. Holzer
On 2022-04-16 20:25:45 +0100, Barry wrote: > Suggest that you start with the use cases that you want supported. > Then you can turn them into a set of tests to check that the solution works. Writing test cases is always a good idea :-) I have now written a first set of test cases: https://git.hjp

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-17 Thread Peter J. Holzer
On 2022-04-17 10:15:54 +0200, Peter J. Holzer wrote: > On 2022-04-17 06:08:54 +1000, Chris Angelico wrote: > > On Sun, 17 Apr 2022 at 03:37, Peter J. Holzer wrote: > > > Therefore a new class (provisionally called timedeltacal, because it is > > > calendaric, not a

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-17 Thread Karsten Hilbert
Am Sun, Apr 17, 2022 at 11:10:01AM +1200 schrieb Greg Ewing: > On 17/04/22 9:17 am, Karsten Hilbert wrote: > > Take this medication for 1 month ! > > > >is quite likely to mean "take it for 28 days". > > Except when your doctor prescribes 90 days worth of tablets, It *still* means "take for 2

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-17 Thread Chris Angelico
On Sun, 17 Apr 2022 at 18:17, Peter J. Holzer wrote: > > On 2022-04-17 06:08:54 +1000, Chris Angelico wrote: > > On Sun, 17 Apr 2022 at 03:37, Peter J. Holzer wrote: > > > Datetime arithmetic in the real world is typically not done in seconds, > > > but in calendaric units: Hours, days, weeks, mo

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-17 Thread Peter J. Holzer
I think Troll still only has days that consist of 23-25 hours; the > weird part is that they move their clocks forward for Oslo's summer, > which is their winter. According to Wikipedia they switch between UTC+2 and UTC+0, so the switchover days would be 22 and 26 hours, respectively.

  1   2   3   4   5   6   7   8   9   10   >