Am Sat, Sep 16, 2023 at 02:17:19PM +1200 schrieb Rimu Atkinson via Python-list:
> Everyone uses virtual environments.
Umm, like, no.
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
--
https://mail.python.org/mailman/listinfo/python-list
Am Thu, Nov 02, 2023 at 09:35:43PM - schrieb Jon Ribbens via Python-list:
Regardless of ...
> Because pip barely plays well by itself, let alone with other package
> managers at the same time.
... being true ...
> > I do only install a few things using pip.
>
> Are they not available in
Am Thu, Nov 02, 2023 at 04:07:33PM -0600 schrieb Mats Wichmann via Python-list:
> >So they now have only python3 and there is no python executable in
> >PATH.
>
> FWIW, for this you install the little stub package python-is-python3.
> Especially if you
> want to keep a python2 installation
> > .From all the posts I gather the answer to my question is
> > "simply": unpackaged-but-needed modules need to be packaged.
>
> I think there is one aspect that isn't getting consideration here. And
> that is whether or not you want these packages installed in the default
> system Python
Am Sun, Nov 05, 2023 at 03:00:41PM + schrieb Chris Green via Python-list:
> > * contact every single maintainer of every single one of the packages
> > that needs updating and persuade them to update their packages and
> > reassure them that you are getting all the other package
Am Fri, Nov 03, 2023 at 01:53:32PM - schrieb Jon Ribbens via Python-list:
> >> Are they not available in your system's package manager?
> >
> > ... this clearly often answers to "no" for applications of
> > any complexity.
> >
> > Is there a suggested proper path to deal with that (Debian is
Am Fri, Nov 03, 2023 at 05:26:06PM +0100 schrieb Dieter Maurer:
> Karsten Hilbert wrote at 2023-11-3 14:47 +0100:
> > ...
> >> Are they not available in your system's package manager?
> >
> >... this clearly often answers to "no" for applications of
> >any complexity.
> >
> >Is there a suggested
Am Mon, Nov 06, 2023 at 01:17:11AM - schrieb Jon Ribbens via Python-list:
> >> >> Are they not available in your system's package manager?
> >> >
> >> > ... this clearly often answers to "no" for applications of
> >> > any complexity.
> >> >
> >> > Is there a suggested proper path to deal
Am Mon, Nov 06, 2023 at 08:58:00AM +0100 schrieb Dieter Maurer:
> I know that debian packagers create debian packages
> from Python distributions not using the approach sketched above
> and likely they have their reasons.
>
> You might want to discuss this on an `apt` related mailing list.
Yeah,
Am Mon, Nov 06, 2023 at 02:43:47PM -0700 schrieb Mats Wichmann via Python-list:
> >I had just hoped someone here might have a handy pointer for
> >how to deal with modules having to be installed from pip for
> >use with an apt-installed python-based application.
>
> That just shouldn't happen -
> > or something like that. Basically, any way to avoid writing `= None` over
> > and over again.
>
> Fundamentally no, at least not without some shenanigans. Type hints do
> not affect the regular running of the code,
Except when they do ;-)
... depending on what counts as (valid) code ...
In
A type annotation isn't supposed to change what code does,
or so I thought:
#
class Borg:
_instances:dict = {}
def __new__(cls, *args, **kargs):
# look up subclass instance cache
if
Am Sun, Oct 01, 2023 at 09:04:05AM +1300 schrieb dn via Python-list:
> >class WorkingSingleton(Borg):
> >
> > def __init__(self):
> > print(self.__class__.__name__, ':')
> > try:
> > self.already_initialized
> > print('already
Sorry for having conflated the core of the matter with all
the Borg shenanigans, that's where I found the problem in my
real code, so there :-)
Consider this:
#
class Surprise:
def __init__(self, with_type_annotation=False):
> > As per my recent foray into abusing existence-checking for Singleton
> > assurance
> > along such lines as
> >
> > >>> try: self.initialized
> > >>> except AttributeError: print('first instantiation'); self.initialized =
> > >>> True
> >
> > and then changing that to
> >
> > >>> try:
> > > Fundamentally no, at least not without some shenanigans. Type hints do
> > > not affect the regular running of the code,
> >
> > Except when they do ;-)
> >
> > ... depending on what counts as (valid) code ...
> >
> > In Python a distinction can be made between "runnable" and "valid" :-D
> >
Am Wed, Oct 04, 2023 at 05:25:04PM +1300 schrieb dn via Python-list:
> The first question when dealing with the Singleton Pattern is what to do when
> more than
> one instantiation is attempted:
>
> - silently return the first instance
This, in my case.
> and so, returning to the matter of
> I'm fairly sure your database queries don't actually give you strings or
> dicts, right? You probably get lists (or iterators) of tuples and
> somewhere you convert them to the arguments you are feeding to
> run_queries().
Ah, no, those queries are enshrined within the middleware as Python
Dear Thomas,
thanks for taking the time to look into my issue.
Maybe it helps if I explain what I want (sorry that my web mailer does not
respect
indentation, I will insert dots).
I want a function to run SQL queries:
run_queries(conn, queries):
...for q in queries:
..conn.execute(q)
I
> It occurs to me that you could simplify things if you converted those
> plain query strings to dicts:
>
> 'SELECT 1' --> {'SQL': 'SELECT 1'}
Ha, indeed. There's likely not that many "simple string SQL queries"
in that codebase so I shall take it as an opportunity to refactor them.
So, at least
Hi Greg,
> dict[str, str] is not a subtype of dict[str, str | something_else]
> because you can assign a value of type something_else to the latter
> but not the former.
I understand what you are saying but I do not yet understand why this
applies to my situation.
I don't have Python at hand
Thanks to all. I ended up using Sequence for the list part
and Mapping for the dict part, which does require "import
typing" which I would rather have avoided.
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
--
https://mail.python.org/mailman/listinfo/python-list
Hi all,
I am not sure why mypy thinks this
gmPG2.py:554: error: Argument "queries" to "run_rw_queries" has incompatible
type "List[Dict[str, str]]"; expected
"List[Dict[str, Union[str, List[Any], Dict[str, Any" [arg-type]
rows, idx = run_rw_queries(link_obj = conn,
Am Fri, Dec 29, 2023 at 01:15:29PM +0100 schrieb Karsten Hilbert via
Python-list:
> I am not sure why mypy thinks this
>
> gmPG2.py:554: error: Argument "queries" to "run_rw_queries" has incompatible
> type "List[Dict[str, str]]"; expected
> "
Am Fri, Dec 29, 2023 at 07:49:17AM -0700 schrieb Mats Wichmann via Python-list:
> >I am not sure why mypy thinks this
> >
> >gmPG2.py:554: error: Argument "queries" to "run_rw_queries" has incompatible
> >type "List[Dict[str, str]]"; expected
> >"List[Dict[str, Union[str, List[Any], Dict[str,
Am Fri, Dec 29, 2023 at 11:04:59AM -0700 schrieb Mats Wichmann via Python-list:
> >For what it's worth here's the signature of that function:
> >
> > def run_rw_queries (
> > link_obj:_TLnkObj=None,
> > queries:list[dict[str, str | list | dict[str, Any]]]=None,
> >
Am Fri, Jan 12, 2024 at 02:23:43PM +0100 schrieb Antoon Pardon via Python-list:
> > queries:list[dict[str, str | list | dict[str, Any]]]=None,
> >
> >into
> >
> > "List[Dict[str, Union[str, List[Any], Dict[str, Any"
> >
> >seems accurate. I just don't understand why list[dict[str,
>
Am Sat, Jan 13, 2024 at 09:20:00PM +0100 schrieb Karsten Hilbert via
Python-list:
> > I was wondering if
> > your type hint for queries shouldn't be the following.
> >
> > queries:list[dict[str,str]|dict[str,list]|dict[str,dict[str, dict[str,
> > Ant]]]
Wait, not
> > Why not foxus on just the part you think you are better off using python,
> > namely personalization ?
> >
> > Create personalized files and send them with your trusted mailx solution ?
>
> Karsten,
>
> Too much time. And while mailx accepts the '-a' option for attachments but
> has none for
> On Tue, 30 Jan 2024, Karsten Hilbert wrote:
>
> > It doesn't need to. It just sends the (pre-personalized-by-Python) mail
> > files.
>
> Karsten,
>
> In which case, I might as well have Python format and send the messages. :-)
Certainly. But it seems you are wrestling with Python. Might as
> For 30 years I've used a bash script using mailx to send messages to a list
> of recipients. They have no salutation to personalize each one. Since I want
> to add that personalized salutation I decided to write a python script to
> replace the bash script.
Why not foxus on just the part you
31 matches
Mail list logo