Re: Python question
On 12/03/2020 1:47 pm, DL Neil via Python-list wrote: On 12/03/20 3:03 AM, Rhodri James wrote: On 11/03/2020 04:06, Michael Torrie wrote: On 3/10/20 6:49 PM, Souvik Dutta wrote: What about moving on to a social media app completely made in pythoj for python? No thanks. I don't want to be on yet another web forum. I don't need "social media" or a "social media app." Email works exceedingly well for this sort of thing, despite Google's antics. +10 The best response to "This system breaks when I abuse it" is almost always "Well stop abusing it then." +1 Didn't someone once claim "do no harm"? There are two sides to every story! Rather than changing the (Discussion List) server, which affects everyone; ask those who don't like Google's tactics/behavior to change their (email) client! I agree email is better than social media, but I suspect Souvik was merely expressing a desire to do something in Python since this is a Python list. That's the motivation of a Python enthusiast and perhaps should be encouraged. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python question
Ya at least I thought that. On Thu, Mar 12, 2020, 12:45 PM Mike Dewhirst wrote: > On 12/03/2020 1:47 pm, DL Neil via Python-list wrote: > > On 12/03/20 3:03 AM, Rhodri James wrote: > >> On 11/03/2020 04:06, Michael Torrie wrote: > >>> On 3/10/20 6:49 PM, Souvik Dutta wrote: > What about moving on to a social media app completely made in > pythoj for > python? > >>> No thanks. I don't want to be on yet another web forum. I don't need > >>> "social media" or a "social media app." Email works exceedingly well > >>> for this sort of thing, despite Google's antics. > >> > >> +10 > >> > >> The best response to "This system breaks when I abuse it" is almost > >> always "Well stop abusing it then." > > > > > > +1 > > > > Didn't someone once claim "do no harm"? > > > > There are two sides to every story! Rather than changing the > > (Discussion List) server, which affects everyone; ask those who don't > > like Google's tactics/behavior to change their (email) client! > > > > I agree email is better than social media, but I suspect Souvik was > merely expressing a desire to do something in Python since this is a > Python list. That's the motivation of a Python enthusiast and perhaps > should be encouraged. > > > > > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: link to venv python sees a different sys.path
On 11/03/2020 17:24, Dieter Maurer wrote: Robin Becker wrote at 2020-3-11 15:26 +: I'm trying to understand why python 3.8.2 venv behaves differently when it is executed va a link Make the env rptlab@everest:~/code/hg-repos $ python38 -mvenv __py__/382v ... so the linked version of the venv python sees the base python site packages and not the expected venv site-packages. I guess (!) that it is using the path to the interpreter program in order to locate the venv's "site-packages" and falls back to the system's when this is not possible. If my guess is correct, then some links will not work. But, you should be able to use links which find "site-packages" via "/../lib/python/site-packages". Not sure I understand exactly what you are getting at, but a workaround is presumably feasible in any particular script. The documentation says "You don’t specifically need to activate an environment; activation just prepends the virtual environment’s binary directory to your path, so that “python” invokes the virtual environment’s Python interpreter and you can run installed scripts without having to use their full path. However, all scripts installed in a virtual environment should be runnable without activating it, and run with the virtual environment’s Python automatically." I am not running an installed script, but the actual python, however with venv this is just a link to the base python. It seems as though the above doesn't apply to the python itself which seems kind of dumb. A quick check reveals that the documentation later which says "When a virtual environment is active (i.e., the virtual environment’s Python interpreter is running), the attributes sys.prefix and sys.exec_prefix point to the base directory of the virtual environment, whereas sys.base_prefix and sys.base_exec_prefix point to the non-virtual environment Python installation which was used to create the virtual environment. If a virtual environment is not active, then sys.prefix is the same as sys.base_prefix and sys.exec_prefix is the same as sys.base_exec_prefix (they all point to a non-virtual environment Python installation)." is wrong as if you invoke the env/bin/python directly it does change the sys_exec prefix even though the virtual environment is not 'active'. $ __py__/382v/bin/python -c"import sys;print(sys.exec_prefix)" /home/rptlab/code/hg-repos/__py__/382v whereas that's not the case when invoked via a link $ bin/python382v -c"import sys;print(sys.exec_prefix)" /home/rptlab/bin/../LOCAL/382 I guess the problem is that the venv python itself is just a link to the base python whereas the virtualenv pythons are actual copies of base so presumably know where they live. I guess I'll continue to use an older mechanism that works for me. -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
Re: link to venv python sees a different sys.path
Robin Becker wrote at 2020-3-12 09:07 +: >On 11/03/2020 17:24, Dieter Maurer wrote: >> Robin Becker wrote at 2020-3-11 15:26 +: >>> I'm trying to understand why python 3.8.2 venv behaves differently when it >>> is executed va a link >>> >>> Make the env rptlab@everest:~/code/hg-repos $ python38 -mvenv __py__/382v >... >>> >>> so the linked version of the venv python sees the base python site packages >>> and not the expected venv site-packages. >> >> I guess (!) that it is using the path to the interpreter program >> in order to locate the venv's "site-packages" and falls back to >> the system's when this is not possible. >> >> If my guess is correct, then some links will not work. >> But, you should be able to use links which find >> "site-packages" via "> path>/../lib/python/site-packages". >> >Not sure I understand exactly what you are getting at, but a workaround is >presumably feasible in any particular script. > >The documentation says > >"You don’t specifically need to activate an environment; activation just >prepends the virtual environment’s binary >directory to your path, so that “python” invokes the virtual environment’s >Python interpreter and you can run installed >scripts without having to use their full path. However, all scripts installed >in a virtual environment should be >runnable without activating it, and run with the virtual environment’s Python >automatically." > >I am not running an installed script, but the actual python, however with venv >this is just a link to the base python. > >It seems as though the above doesn't apply to the python itself which seems >kind of dumb. A quick check reveals that the >documentation later which says Let me try again: When you start "python", its "site" module extends "sys.path" to include an appropriate "site-packages". For this, it uses a heuristic based on the path with which you have called the interpreter: i.e. it tries to use dirname()/../lib/python/site-packages If this does not exist, it falls back to the base interpreter' "site-packages". This works fine when you do not use symbolic links. It can work when your symbolic links do not let the heuristic fail. As you have observed, some kind of symbolic links break it, however. -- https://mail.python.org/mailman/listinfo/python-list
Re: link to venv python sees a different sys.path
On 12/03/2020 09:19, Dieter Maurer wrote: Let me try again: When you start "python", its "site" module extends "sys.path" to include an appropriate "site-packages". For this, it uses a heuristic based on the path with which you have called the interpreter: i.e. it tries to use dirname()/../lib/python/site-packages If this does not exist, it falls back to the base interpreter' "site-packages". This works fine when you do not use symbolic links. It can work when your symbolic links do not let the heuristic fail. As you have observed, some kind of symbolic links break it, however. Ok I see what you are getting at. However, this sort of defeats the purpose of virtual environments for my case ie when I want many different versions of python all in one place to use for testing. It's fairly clear that links to links to links make it quite hard to decide where the real environment is. However, since the virtual environment does have a lib parallel to the bin it ought not to be impossible. I can continue to use the 'legacy' version of virtualenv, but it seems as though the latest virtualenv (20.0.8) has changed something and its linked python now has the same behaviour as the venv version even when the --copies option is used. -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
using classes
The following code that uses a class 'Fahrzeug' and an inherited class
'PKW' runs correctly. However, if I use the 'super ' statement in in the
PKW class, it ends with the following error message:
*Traceback (most recent call last): File "erben_a.py", line 19, in
fiat = PKW("Fiat Marea",50,0) File "erben_a.py", line 11, in
__init__super(PKW, self).__init__()TypeError: __init__() missing 2
required positional arguments: 'bez' and 'ge'*
- CODE THAT WORKS ---
class Fahrzeug:
def __init__(self, bez, ge):
self.bezeichnung = bez
self.geschwindigkeit = ge
def beschleunigen(self, wert):
self.geschwindigkeit += wert
def __str__(self):
return self.bezeichnung + " " +str(self.geschwindigkeit) + " km/h"
class PKW(Fahrzeug):
def __init__(self, bez, ge, ins):
Fahrzeug.__init__(self, bez, ge)
self.insassen = ins
def __str__(self):
return Fahrzeug.__str__(self) + " " + str(self.insassen) + "
Insassen"
def einsteigen(self, anzahl):
self.insassen += anzahl
def aussteigen(self, anzahl):
self.insassen -= anzahl
fiat = PKW("Fiat Marea",50,0)
fiat.einsteigen(3)
fiat.aussteigen(1)
fiat.beschleunigen(10)
print(fiat)
-CODE THAT FAILS --
class Fahrzeug:
def __init__(self, bez, ge):
self.bezeichnung = bez
self.geschwindigkeit = ge
def beschleunigen(self, wert):
self.geschwindigkeit += wert
def __str__(self):
return self.bezeichnung + " " +str(self.geschwindigkeit) + " km/h"
class PKW(Fahrzeug):
def __init__(self, bez, ge, ins):
*super(PKW, self).__init__()*
self.insassen = ins
def __str__(self):
return Fahrzeug.__str__(self) + " " + str(self.insassen) + "
Insassen"
def einsteigen(self, anzahl):
self.insassen += anzahl
def aussteigen(self, anzahl):
self.insassen -= anzahl
fiat = PKW("Fiat Marea",50,0)
fiat.einsteigen(3)
fiat.aussteigen(1)
fiat.beschleunigen(10)
print(fiat)
--
Regards,
Joseph Pareti - Artificial Intelligence consultant
Joseph Pareti's AI Consulting Services
https://www.joepareti54-ai.com/
cell +49 1520 1600 209
cell +39 339 797 0644
--
https://mail.python.org/mailman/listinfo/python-list
Re: link to venv python sees a different sys.path
Robin Becker wrote at 2020-3-12 10:25 +: > ... >I want many different versions of python all in one place to use for testing. I contribute to the `zopefoundation` projects. They, too, have a need to test with many different Python versions -- and use "tox" for it. Maybe, "tox" can also help solve your problem (without a need for symbolic links). -- https://mail.python.org/mailman/listinfo/python-list
Re: using classes
On 2020-03-12 10:54, joseph pareti wrote:
The following code that uses a class 'Fahrzeug' and an inherited class
'PKW' runs correctly. However, if I use the 'super ' statement in in the
PKW class, it ends with the following error message:
*Traceback (most recent call last): File "erben_a.py", line 19, in
fiat = PKW("Fiat Marea",50,0) File "erben_a.py", line 11, in
__init__super(PKW, self).__init__()TypeError: __init__() missing 2
required positional arguments: 'bez' and 'ge'*
- CODE THAT WORKS ---
class Fahrzeug:
def __init__(self, bez, ge):
self.bezeichnung = bez
self.geschwindigkeit = ge
def beschleunigen(self, wert):
self.geschwindigkeit += wert
def __str__(self):
return self.bezeichnung + " " +str(self.geschwindigkeit) + " km/h"
class PKW(Fahrzeug):
def __init__(self, bez, ge, ins):
Fahrzeug.__init__(self, bez, ge)
self.insassen = ins
def __str__(self):
return Fahrzeug.__str__(self) + " " + str(self.insassen) + "
Insassen"
def einsteigen(self, anzahl):
self.insassen += anzahl
def aussteigen(self, anzahl):
self.insassen -= anzahl
fiat = PKW("Fiat Marea",50,0)
fiat.einsteigen(3)
fiat.aussteigen(1)
fiat.beschleunigen(10)
print(fiat)
-CODE THAT FAILS --
class Fahrzeug:
def __init__(self, bez, ge):
self.bezeichnung = bez
self.geschwindigkeit = ge
def beschleunigen(self, wert):
self.geschwindigkeit += wert
def __str__(self):
return self.bezeichnung + " " +str(self.geschwindigkeit) + " km/h"
class PKW(Fahrzeug):
def __init__(self, bez, ge, ins):
*super(PKW, self).__init__()*
self.insassen = ins
def __str__(self):
return Fahrzeug.__str__(self) + " " + str(self.insassen) + "
Insassen"
def einsteigen(self, anzahl):
self.insassen += anzahl
def aussteigen(self, anzahl):
self.insassen -= anzahl
fiat = PKW("Fiat Marea",50,0)
fiat.einsteigen(3)
fiat.aussteigen(1)
fiat.beschleunigen(10)
print(fiat)
The traceback tells you what the problem is. The line should be:
super(PKW, self).__init__(bez, ge)
--
https://mail.python.org/mailman/listinfo/python-list
Re: using classes
thank you, that fixes it. I also noticed that both statements work:
super(PKW, self).__init__(bez,ge)
or
super().__init__(bez,ge)
Am Do., 12. März 2020 um 12:58 Uhr schrieb MRAB :
> On 2020-03-12 10:54, joseph pareti wrote:
> > The following code that uses a class 'Fahrzeug' and an inherited class
> > 'PKW' runs correctly. However, if I use the 'super ' statement in in the
> > PKW class, it ends with the following error message:
> >
> >
> >
> > *Traceback (most recent call last): File "erben_a.py", line 19, in
> > fiat = PKW("Fiat Marea",50,0) File "erben_a.py", line 11, in
> > __init__super(PKW, self).__init__()TypeError: __init__() missing 2
> > required positional arguments: 'bez' and 'ge'*
> >
> > - CODE THAT WORKS ---
> > class Fahrzeug:
> > def __init__(self, bez, ge):
> >self.bezeichnung = bez
> >self.geschwindigkeit = ge
> > def beschleunigen(self, wert):
> >self.geschwindigkeit += wert
> > def __str__(self):
> >return self.bezeichnung + " " +str(self.geschwindigkeit) + " km/h"
> > class PKW(Fahrzeug):
> > def __init__(self, bez, ge, ins):
> > Fahrzeug.__init__(self, bez, ge)
> > self.insassen = ins
> > def __str__(self):
> > return Fahrzeug.__str__(self) + " " + str(self.insassen) + "
> > Insassen"
> > def einsteigen(self, anzahl):
> > self.insassen += anzahl
> > def aussteigen(self, anzahl):
> > self.insassen -= anzahl
> > fiat = PKW("Fiat Marea",50,0)
> > fiat.einsteigen(3)
> > fiat.aussteigen(1)
> > fiat.beschleunigen(10)
> > print(fiat)
> >
> > -CODE THAT FAILS --
> > class Fahrzeug:
> > def __init__(self, bez, ge):
> >self.bezeichnung = bez
> >self.geschwindigkeit = ge
> > def beschleunigen(self, wert):
> >self.geschwindigkeit += wert
> > def __str__(self):
> >return self.bezeichnung + " " +str(self.geschwindigkeit) + " km/h"
> > class PKW(Fahrzeug):
> > def __init__(self, bez, ge, ins):
> > *super(PKW, self).__init__()*
> > self.insassen = ins
> > def __str__(self):
> > return Fahrzeug.__str__(self) + " " + str(self.insassen) + "
> > Insassen"
> > def einsteigen(self, anzahl):
> > self.insassen += anzahl
> > def aussteigen(self, anzahl):
> > self.insassen -= anzahl
> > fiat = PKW("Fiat Marea",50,0)
> > fiat.einsteigen(3)
> > fiat.aussteigen(1)
> > fiat.beschleunigen(10)
> > print(fiat)
> >
> >
> The traceback tells you what the problem is. The line should be:
>
> super(PKW, self).__init__(bez, ge)
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
Regards,
Joseph Pareti - Artificial Intelligence consultant
Joseph Pareti's AI Consulting Services
https://www.joepareti54-ai.com/
cell +49 1520 1600 209
cell +39 339 797 0644
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python question
On 3/11/20 8:47 PM, DL Neil via Python-list wrote: > Didn't someone once claim "do no harm"? > > There are two sides to every story! Rather than changing the (Discussion > List) server, which affects everyone; ask those who don't like Google's > tactics/behavior to change their (email) client! In Gmail's case it's a matter of not using gmail at all, as their mailing list -breaking behavior happens whether you use IMAP and thunderbird. I work around gmail's breakage right now by using my own SMTP server for sending messages to the list, so gmail won't recognize my messages and discard them. I could leave gmail, but it's not worth it for me at this point. Python is the only mailing list left of all the open source projects I used to follow. It's pretty sad how they all abandoned a format that works very well for web based formats. -- https://mail.python.org/mailman/listinfo/python-list
Re: using classes
> On 12 Mar 2020, at 14:28, joseph pareti wrote:
>
> thank you, that fixes it. I also noticed that both statements work:
>
> super(PKW, self).__init__(bez,ge)
This form is for python 2 compatibility.
>
> or
>
> super().__init__(bez,ge)
This is the python 3 way. If you do not have to care about python 2 then this
is the form to use.
Barry
>
>> Am Do., 12. März 2020 um 12:58 Uhr schrieb MRAB >> :
>>
>>> On 2020-03-12 10:54, joseph pareti wrote:
>>> The following code that uses a class 'Fahrzeug' and an inherited class
>>> 'PKW' runs correctly. However, if I use the 'super ' statement in in the
>>> PKW class, it ends with the following error message:
>>>
>>>
>>>
>>> *Traceback (most recent call last): File "erben_a.py", line 19, in
>>> fiat = PKW("Fiat Marea",50,0) File "erben_a.py", line 11, in
>>> __init__super(PKW, self).__init__()TypeError: __init__() missing 2
>>> required positional arguments: 'bez' and 'ge'*
>>>
>>> - CODE THAT WORKS ---
>>> class Fahrzeug:
>>> def __init__(self, bez, ge):
>>> self.bezeichnung = bez
>>> self.geschwindigkeit = ge
>>> def beschleunigen(self, wert):
>>> self.geschwindigkeit += wert
>>> def __str__(self):
>>> return self.bezeichnung + " " +str(self.geschwindigkeit) + " km/h"
>>> class PKW(Fahrzeug):
>>> def __init__(self, bez, ge, ins):
>>>Fahrzeug.__init__(self, bez, ge)
>>>self.insassen = ins
>>> def __str__(self):
>>>return Fahrzeug.__str__(self) + " " + str(self.insassen) + "
>>> Insassen"
>>> def einsteigen(self, anzahl):
>>>self.insassen += anzahl
>>> def aussteigen(self, anzahl):
>>>self.insassen -= anzahl
>>> fiat = PKW("Fiat Marea",50,0)
>>> fiat.einsteigen(3)
>>> fiat.aussteigen(1)
>>> fiat.beschleunigen(10)
>>> print(fiat)
>>>
>>> -CODE THAT FAILS --
>>> class Fahrzeug:
>>> def __init__(self, bez, ge):
>>> self.bezeichnung = bez
>>> self.geschwindigkeit = ge
>>> def beschleunigen(self, wert):
>>> self.geschwindigkeit += wert
>>> def __str__(self):
>>> return self.bezeichnung + " " +str(self.geschwindigkeit) + " km/h"
>>> class PKW(Fahrzeug):
>>> def __init__(self, bez, ge, ins):
>>>*super(PKW, self).__init__()*
>>>self.insassen = ins
>>> def __str__(self):
>>>return Fahrzeug.__str__(self) + " " + str(self.insassen) + "
>>> Insassen"
>>> def einsteigen(self, anzahl):
>>>self.insassen += anzahl
>>> def aussteigen(self, anzahl):
>>>self.insassen -= anzahl
>>> fiat = PKW("Fiat Marea",50,0)
>>> fiat.einsteigen(3)
>>> fiat.aussteigen(1)
>>> fiat.beschleunigen(10)
>>> print(fiat)
>>>
>>>
>> The traceback tells you what the problem is. The line should be:
>>
>> super(PKW, self).__init__(bez, ge)
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>
> --
> Regards,
> Joseph Pareti - Artificial Intelligence consultant
> Joseph Pareti's AI Consulting Services
> https://www.joepareti54-ai.com/
> cell +49 1520 1600 209
> cell +39 339 797 0644
> --
> https://mail.python.org/mailman/listinfo/python-list
--
https://mail.python.org/mailman/listinfo/python-list
Re: using classes
joseph pareti writes: > thank you, that fixes it. I also noticed that both statements work: > > super(PKW, self).__init__(bez,ge) > > or > >super().__init__(bez,ge) The first is the required Python 2 calling (at least the first argument is required). The second way can be used in Python 3. -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list
Multiple comparisons in a single statement
A quickie (I hope!).
I am running Python 2.7.10 (and, yes, I know, support for it has been
withdrawn.)
I have three tuples that have been generated separately and I want to check
that they are identical. all I want to do is to terminate the program and
report an error if all three are not identical.
My initial attempt to do this is to use logic of the form
if not (mytup1 == mytup2 == mytup3):
raise Exception ("Tuples are not identical")
I have tried this logic form in IDLE, and it seems to do what I want.
Is this a reasonable way to do this, or is there a better way?
Thanks in anticipation.
Stephen Tucker.
Virus-free.
www.avast.com
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
--
https://mail.python.org/mailman/listinfo/python-list
Re: Multiple comparisons in a single statement
On Fri, Mar 13, 2020 at 4:55 AM Stephen Tucker wrote:
>
> A quickie (I hope!).
>
> I am running Python 2.7.10 (and, yes, I know, support for it has been
> withdrawn.)
This is the same in Python 3.
> I have three tuples that have been generated separately and I want to check
> that they are identical. all I want to do is to terminate the program and
> report an error if all three are not identical.
>
> My initial attempt to do this is to use logic of the form
>
> if not (mytup1 == mytup2 == mytup3):
>raise Exception ("Tuples are not identical")
>
> I have tried this logic form in IDLE, and it seems to do what I want.
>
> Is this a reasonable way to do this, or is there a better way?
>
Yes absolutely! (Although, as a minor quibble, I would say "equal"
rather than "identical" here - when you talk about identity, you're
usually using the 'is' operator.) The meaning of chained comparisons
is broadly equivalent to comparing the middle one against the others
("a==b==c" is "a==b and b==c"), which does the right thing here.
It's slightly unusual to negate a query rather than using "!=", but it
makes good sense here.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
Re: Multiple comparisons in a single statement
On 2020-03-12 18:08, Chris Angelico wrote:
On Fri, Mar 13, 2020 at 4:55 AM Stephen Tucker wrote:
A quickie (I hope!).
I am running Python 2.7.10 (and, yes, I know, support for it has been
withdrawn.)
This is the same in Python 3.
I have three tuples that have been generated separately and I want to check
that they are identical. all I want to do is to terminate the program and
report an error if all three are not identical.
My initial attempt to do this is to use logic of the form
if not (mytup1 == mytup2 == mytup3):
raise Exception ("Tuples are not identical")
I have tried this logic form in IDLE, and it seems to do what I want.
Is this a reasonable way to do this, or is there a better way?
Yes absolutely! (Although, as a minor quibble, I would say "equal"
rather than "identical" here - when you talk about identity, you're
usually using the 'is' operator.) The meaning of chained comparisons
is broadly equivalent to comparing the middle one against the others
("a==b==c" is "a==b and b==c"), which does the right thing here.
There's also the question of whether you consider, say, the int value 0
to be identical to the float value 0.0. Equal? Yes. Identical? Depends
what you mean by "identical".
It's slightly unusual to negate a query rather than using "!=", but it
makes good sense here.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Lock acquisition by the same thread - deadlock protection
Yonatan wrote at 2020-3-11 16:24 +0200: >That code I'm talking about didn't require a reentrant lock - the >algorithm really wasn't reentrant. > >Let me clarify my point: I'm wondering why the non-reentrant lock >doesn't raise an exception immediately on this >erroneous situation. >I thought it could be altered, or at least we could add an option to >let a `threading.Lock` behave like a pthread >mutex in mode `PTHREAD_MUTEX_ERRORCHECK`: Disallow double locking by >same thread, disallow unlocking >by another thread. The documentation for the basic lock explicitely allows lock release by a foreign thread. As I understand the documentation, this lock type is by design very basic - a mechanism to implement higher level abstractions. I use other synchronisation mechanisms when the basic lock does not fit my requirements. -- https://mail.python.org/mailman/listinfo/python-list
EuroPython 2020 and COVID-19
As you probably already know, the Coronavirus is spreading throughout Europe and we wanted to give you an update on our current plans around on the situation. We will update this blog post as new information becomes available: https://blog.europython.eu/post/612393987829039104/europython-2020-and-covid-19 2020-03-12: The number of cases in Ireland is still low compared to other countries, but the Irish government is already starting to put limited bans on larger indoor events. Since EuroPython is planned for July 20-26, we are hopeful that the situation will have improved by then and continue the conference planning with the aim of having the conference on the planned date. We would still like to ask all attendees to take the necessary and recommended hygienic precautions when attending the event and pay close attention to your country’s travel guidelines. If you don’t feel well, please do not attend the conference - instead, please follow the COVID-19 advice of the Irish Health Service. We will refund your ticket. Should the conference need to be canceled as a result of the official ban still being in effect in July, we will refund all tickets - even after the official refund cut-off date (June 19th). We are in discussion with the venue to explore options in case the conference has to be canceled, which we will share with you soon as we have any update. Because the situation is very much in flux, we would recommend that you make booking arrangements with an option to cancel the booking closer to the event date. Resources: - Irish Governement: COVID-19 (Coronavirus): Advice https://www.gov.ie/en/publication/472f64-covid-19-coronavirus-guidance-and-advice/ - Irish Health Service: Coronavirus (COVID-19) https://www2.hse.ie/conditions/coronavirus/coronavirus.html - Coronavirus COVID-19 Global Cases Overview (with daily updates) https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6 - WHO: Q&A on coronaviruses (COVID-19) https://www.who.int/news-room/q-a-detail/q-a-coronaviruses - Irish Department of Foreign Affairs: Travel Advice https://www.dfa.ie/travel/travel-advice/ Help spread the word Please help us spread this message by sharing it on your social networks as widely as possible. Thank you ! Link to the blog post: https://blog.europython.eu/post/612393987829039104/europython-2020-and-covid-19 Tweet: https://twitter.com/europython/status/1238115794896240642 Thanks, -- EuroPython 2020 Team https://ep2020.europython.eu/ https://www.europython-society.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Multiple comparisons in a single statement
On 12/03/2020 18:08, Chris Angelico wrote:
On Fri, Mar 13, 2020 at 4:55 AM Stephen Tucker wrote:
A quickie (I hope!).
I am running Python 2.7.10 (and, yes, I know, support for it has been
withdrawn.)
This is the same in Python 3.
I have three tuples that have been generated separately and I want to check
that they are identical. all I want to do is to terminate the program and
report an error if all three are not identical.
My initial attempt to do this is to use logic of the form
if not (mytup1 == mytup2 == mytup3):
raise Exception ("Tuples are not identical")
I have tried this logic form in IDLE, and it seems to do what I want.
Is this a reasonable way to do this, or is there a better way?
Yes absolutely! (Although, as a minor quibble, I would say "equal"
rather than "identical" here - when you talk about identity, you're
usually using the 'is' operator.) The meaning of chained comparisons
is broadly equivalent to comparing the middle one against the others
("a==b==c" is "a==b and b==c"), which does the right thing here.
It's slightly unusual to negate a query rather than using "!=", but it
makes good sense here.
In case anyone thinks the original expr
not (mytup1 == mytup2 == mytup3)
could be changed to
(mytup1 != mytup2!= mytup3)
remember that applying De Morgan's theorem to the original expression
would require the 'and' operation used in chained comparisons to change
to an 'or' operation (Python always does the 'and' operation in chained
comparisions). EG for simple integers instead of tuples,
>>> not (1==1==1)
False
>>> not (2==1==1)
True
>>> (1!=1!=1)
False correct as before
>>> (2!=1!=1)
False oops!
John
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
