Fwd: A typing question

2022-10-29 Thread Sam Ezeh
Do you want the following? ``` from typing import List, Optional class GLOBALS: foos: Optional[Foos] = None class Foo: def __init__(self): pass class Foos: Foos: List[Foo] = [] def __init__(self): pass GLOBALS.foos = Foos() ``` Kind regards, Sam Ezeh On

Re: Virtual PUG-meeting: An applied introduction to Finite State Machines

2022-09-13 Thread Sam Ezeh
That seems interesting. Is this hosted online? And are there any suggested reading materials for those who might not be able to attend? Kind regards, Sam Ezeh On Tue, 13 Sept 2022 at 22:53, dn wrote: > An applied introduction to Finite State Machines > 0730 UTC, Wed 21 Sep 2022 > >

Re: Building on Windows

2022-07-02 Thread Sam Ezeh
host desktop but in this scenario, the error was that single line and I can use paste sites where necessary. Kind regards, Sam Ezeh On Sat, 2 Jul 2022 at 15:27, Sam Ezeh wrote: > > I have a Windows virtual machine and I'm following the instructions on > the devguide [1] to bui

Building on Windows

2022-07-02 Thread Sam Ezeh
x27;m not well-acquainted with Windows and don't understand the solutions. Thanks in advance. Kind regards, Sam Ezeh [1]: https://devguide.python.org/compiler/ [2]: https://bugs.python.org/issue41213 [3]: https://bugs.python.org/issue33675 -- https://mail.python.org/mailman/listinfo/python-list

Re: Python installation

2022-06-21 Thread Sam Ezeh
Inside my Windows virtual machine only entering `py` as the command brings up the repl, if that helps. Kind Regards, Sam Ezeh On Tue, 21 Jun 2022 at 18:15, Igor Korot wrote: > > Hi, > > On Tue, Jun 21, 2022 at 11:43 AM Brian Karinga wrote: > > > > Hello, > > &

Re: Seeking deeper understanding of python equality (==)

2022-05-06 Thread Sam Ezeh
Kind regards, Sam Ezeh On Fri, 6 May 2022 at 18:12, Jonathan Kaczynski wrote: > > Hi, > > I was recently trying to explain how python equality works and ran into a > gap in my knowledge. I haven't found any good pages going beneath a surface > level explanation of pyt

Fwd: Do projects exist to audit PyPI-hosted packages?

2022-05-06 Thread Sam Ezeh
-- Forwarded message - From: Sam Ezeh Date: Fri, 6 May 2022, 15:29 Subject: Re: Do projects exist to audit PyPI-hosted packages? To: Skip Montanaro I've had similar thoughts in the past. I don't know of anything but I wonder if repositiories for other languages

Re: Why no list as dict key?

2022-04-20 Thread Sam Ezeh
Repeating the above points, here is an example of what would happen if you tried. Dictionaries require their keys to be immutable as under-the-hood they use hash tables and they'd fail when the underlying values are allowed to change. ``` [sam@samtop]: ~>$ python Python 3.10.2 (main, Jan 15 2022,

Re: Tuple unpacking inside lambda expressions

2022-04-20 Thread Sam Ezeh
I went back to the code recently and I remembered what the problem was. I was using multiprocessing.Pool.pmap which takes a callable (the lambda here) so I wasn't able to use comprehensions or starmap Is there anything for situations like these? Kind Regards, Sam Ezeh On Sat, 16 Apr 2022

Re: Tuple unpacking inside lambda expressions

2022-04-20 Thread Sam Ezeh
This also works great! Kind Regards, Sam Ezeh On Tue, 19 Apr 2022 at 12:03, Antoon Pardon wrote: > > Op 16/04/2022 om 23:36 schreef Sam Ezeh: > > Two questions here. > > > > Firstly, does anybody know of existing discussions (e.g. on here or on > > python-ideas

Enums and nested classes

2022-04-20 Thread Sam Ezeh
Outer(Enum): a = 1 b = 2 class Inner(Enum): foo = 10 bar = 11 ``` ``` class Outer(Enum): a = 1 b = 2 class Inner: c = None def __init__(self): ``` Kind Regards, Sam Ezeh -- https://mail.python.org/mailman/listinfo/p

Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-20 Thread Sam Ezeh
I'll see if I can find out how positional only and keyword only arguments are used in __init__ methods in the wild and I'll see if there have been any other discussions talking about what this approach could offer. On Sun, 17 Apr 2022 at 02:54, dn wrote: > > On 17/04/2022 09.20

Re: Tuple unpacking inside lambda expressions

2022-04-16 Thread Sam Ezeh
Angelico wrote: > > On Sun, 17 Apr 2022 at 07:37, Sam Ezeh wrote: > > > > Two questions here. > > > > Firstly, does anybody know of existing discussions (e.g. on here or on > > python-ideas) relating to unpacking inside lambda expressions? > > > > I

Fwd: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-16 Thread Sam Ezeh
I've just seen Pablo's very recent post on python-ideas so I thought I'd link it here. [1] [1]: https://mail.python.org/archives/list/python-id...@python.org/message/SCXHEWCHBJN3A7DPGGPPFLSTMBLLAOTX/ Kind Regards, Sam Ezeh On Fri, 15 Apr 2022 at 22:57, Ethan Furman wrote: &g

Fwd: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-16 Thread Sam Ezeh
ncern I have is that even if this is useful, it might still fall to the same fate. [1]: https://mail.python.org/archives/list/python-id...@python.org/message/SCTXSEKOWDRDGVXXOEB7JUC6WE7XKGMO/ On Fri, 15 Apr 2022 at 22:30, dn wrote: > > On 15/04/2022 23.19, Sam Ezeh wrote: > ..

Tuple unpacking inside lambda expressions

2022-04-16 Thread Sam Ezeh
ocess(*job), jobs ) ``` Secondly, for situations like these, do you have any go-to methods of rewriting these while maintaining clarity? Kind Regards, Sam Ezeh -- https://mail.python.org/mailman/listinfo/python-list

Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-15 Thread Sam Ezeh
other people think about this proposal. To perform the queries I created a tool called presearch which others might find useful. I found it quite fun to make however it's only been in existence for 2 days so there currently isn't any documentation and it's lacking in several areas. The source code can be found here: https://github.com/dignissimus/presearch Kind Regards, Sam Ezeh -- https://mail.python.org/mailman/listinfo/python-list

Re: Functionality like local static in C

2022-04-14 Thread Sam Ezeh
rint(function.variable) ... function.variable += 1 ... >>> function.variable = 1 >>> function() 1 >>> function() 2 >>> ``` If necessary, the variable can be initialised inside the function too. Kind Regards, Sam Ezeh On Thu, 14 Apr 2022 at 16:36, Sam Ezeh wrote: > > I