Re: Why does super(bool) give None
On Fri, Apr 24, 2020 at 4:16 PM Cecil Westerhof wrote: > > issubclass(bool, int) gives True > but > super(bool) gives > > Do I not understand the meaning of super, or is this inconsistent? > > (Until now I have not down much work with classes in Python.) > One-arg super is an unbound object, and the "None" just indicates that. (Although every Python that I've tried says NULL there, not None. What version are you using?) It doesn't say what "the parent class" is, because super doesn't actually work with parent classes - it lets you call the *next* class. (In complex inheritance trees, that can mean going across a diamond or anything.) I've never actually looked at the repr of a super object - I've always just called a method on it immediately after constructing it. Never seen a need to hang onto one :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Why does super(bool) give None
issubclass(bool, int) gives True but super(bool) gives Do I not understand the meaning of super, or is this inconsistent? (Until now I have not down much work with classes in Python.) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
He is talking about this. https://mail.python.org/mailman/listinfo/python-list Scroll down to the bottom of the page and you will find overview of all.. Souvik flutter dev On Fri, Apr 24, 2020, 7:50 AM Deac-33 Lancaster wrote: > On Thursday, April 23, 2020 at 7:14:16 PM UTC-7, DL Neil wrote: > > ... Is there a way to see all of the groups? > > > > Yes! Follow the link at the bottom of this email msg. Then follow the > > link at the bottom of this list's web-page ... > > -- > > Regards =dn > > Sorry, I don't see the link. > -deac33 > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
On Thursday, April 23, 2020 at 7:14:16 PM UTC-7, DL Neil wrote: > ... Is there a way to see all of the groups? > > Yes! Follow the link at the bottom of this email msg. Then follow the > link at the bottom of this list's web-page ... > -- > Regards =dn Sorry, I don't see the link. -deac33 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
... Is there a way to see all of the groups? Yes! Follow the link at the bottom of this email msg. Then follow the link at the bottom of this list's web-page ... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
On Thursday, April 23, 2020 at 7:11:47 PM UTC-7, DL Neil wrote: > On 24/04/20 1:24 PM, Deac-33 Lancaster wrote: > > I'm aware that you can find the type of a variable with > > type(var) > > > > But are there Boolean operators in Python3.8 to test the data type, e.g. > >is_floate(var) > >is_string(var) > > etc. ? > > There is also a 'pythonic' answer (what is the 'Python way'?) and that > is to proceed on the basis of "duck typing" and 'presumption'. The > latter known as EAFP ("It's Easier To Ask Forgiveness Than To Get > Permission"), eg: > > >>> n = 2 > >>> d = 'two' > > my training/first inclination has always been to check before use - in > this case, that both the numerator and denominator are numeric and that > the latter is non-zero - seeking to avoid: > > >>> n / d > Traceback (most recent call last): >File "", line 1, in > TypeError: unsupported operand type(s) for /: 'int' and 'str' > > > Crash! > > Conversely, here is the pythonic EAFP approach: > > >>> try: > ... n / d > ... except TypeError: > ... print( "I'm sorry, Dave. I'm afraid I can't do that." ) > ... > I'm sorry, Dave. I'm afraid I can't do that. > >>> > > > and if you want to go all-in and try to break the laws of mathematics: > > >>> n = 2 > >>> d = 0 > > >>> try: > ... n / d > ... except TypeError: > ... print( "I'm sorry, Dave. I'm afraid I can't do that." ) > ... except ZeroDivisionError: > ... print( "Officer, it wasn't me - honest!" ) > ... > Officer, it wasn't me - honest! > >>> > > > or just-for-fun: > > >>> try: > ... n / d > ... except ( ZeroDivisionError, TypeError ): > ... print( "I'm sorry, Dave. I'm afraid I can't do that." ) > ... > I'm sorry, Dave. I'm afraid I can't do that. > -- > Regards =dn DL, I love it. I like the style as well. thanks again, -deac33 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
On 24/04/20 1:24 PM, Deac-33 Lancaster wrote: I'm aware that you can find the type of a variable with type(var) But are there Boolean operators in Python3.8 to test the data type, e.g. is_floate(var) is_string(var) etc. ? There is also a 'pythonic' answer (what is the 'Python way'?) and that is to proceed on the basis of "duck typing" and 'presumption'. The latter known as EAFP ("It's Easier To Ask Forgiveness Than To Get Permission"), eg: >>> n = 2 >>> d = 'two' my training/first inclination has always been to check before use - in this case, that both the numerator and denominator are numeric and that the latter is non-zero - seeking to avoid: >>> n / d Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for /: 'int' and 'str' Crash! Conversely, here is the pythonic EAFP approach: >>> try: ... n / d ... except TypeError: ... print( "I'm sorry, Dave. I'm afraid I can't do that." ) ... I'm sorry, Dave. I'm afraid I can't do that. >>> and if you want to go all-in and try to break the laws of mathematics: >>> n = 2 >>> d = 0 >>> try: ... n / d ... except TypeError: ... print( "I'm sorry, Dave. I'm afraid I can't do that." ) ... except ZeroDivisionError: ... print( "Officer, it wasn't me - honest!" ) ... Officer, it wasn't me - honest! >>> or just-for-fun: >>> try: ... n / d ... except ( ZeroDivisionError, TypeError ): ... print( "I'm sorry, Dave. I'm afraid I can't do that." ) ... I'm sorry, Dave. I'm afraid I can't do that. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
On Thursday, April 23, 2020 at 6:47:04 PM UTC-7, DL Neil wrote: > On 24/04/20 1:24 PM, Deac-33 Lancaster wrote: > > I'm aware that you can find the type of a variable with > > type(var) > > > > But are there Boolean operators in Python3.8 to test the data type, e.g. > >is_floate(var) > >is_string(var) > > etc. ? > > You are close! https://docs.python.org/3/library/functions.html#isinstance > > > > (If this is the wrong group for this question, what group should I use.) > > We're happy to help. There is a Python-Tutor group which is a good > 'home' for beginners or new-converts to Python... > -- > Regards =dn DL Neil, Much thanks, exactly what I was looking for. And I found and joined Python-Tutor. Is there a way to see all of the groups? Mucho thanks, -deac33 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
On Thursday, April 23, 2020 at 6:46:14 PM UTC-7, Alan Bawden wrote: > Deac-33 Lancaster writes: > > > I'm aware that you can find the type of a variable with > >type(var) > > (Strictly speaking, variables don't have types. This gives you the type of > the variable's current value. But we know what you meant.) > > > But are there Boolean operators in Python3.8 to test the data type, e.g. > > is_floate(var) > > is_string(var) > > etc. ? > > You should probably be using isinstance(), as in: > isinstance(var, float) > isinstance(var, str) > > -- > Alan Bawden Alan, Much thanks for the response. Yes, dynamic typing so it can change. But this is what I was looking for, unable to find it in the docs, need more practice at that. :-) -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
Deac-33 Lancaster writes: > I'm aware that you can find the type of a variable with >type(var) (Strictly speaking, variables don't have types. This gives you the type of the variable's current value. But we know what you meant.) > But are there Boolean operators in Python3.8 to test the data type, e.g. > is_floate(var) > is_string(var) > etc. ? You should probably be using isinstance(), as in: isinstance(var, float) isinstance(var, str) -- Alan Bawden -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
ChrisA, Most awesome, thank you very much, I just couldn't find that in the docs. Still learning! Much thanks, -deac33 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
On 24/04/20 1:24 PM, Deac-33 Lancaster wrote: I'm aware that you can find the type of a variable with type(var) But are there Boolean operators in Python3.8 to test the data type, e.g. is_floate(var) is_string(var) etc. ? You are close! https://docs.python.org/3/library/functions.html#isinstance (If this is the wrong group for this question, what group should I use.) We're happy to help. There is a Python-Tutor group which is a good 'home' for beginners or new-converts to Python... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: How to test the data type of a variable
On Fri, Apr 24, 2020 at 11:26 AM Deac-33 Lancaster wrote: > > I'm aware that you can find the type of a variable with >type(var) > > But are there Boolean operators in Python3.8 to test the data type, e.g. > is_floate(var) > is_string(var) > etc. ? > > (If this is the wrong group for this question, what group should I use.) > Yep! You can ask questions like this: isinstance(var, int) isinstance(var, str) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
How to test the data type of a variable
I'm aware that you can find the type of a variable with type(var) But are there Boolean operators in Python3.8 to test the data type, e.g. is_floate(var) is_string(var) etc. ? (If this is the wrong group for this question, what group should I use.) thanks much, -deac33 -- https://mail.python.org/mailman/listinfo/python-list
Re: Problem in importing pandas
On 2020-04-23 18:57, Amit Jain wrote: Dear Sir/Madam, After *successful installation of PIP for PANDAS *when I try to *import pandas*, It gives error as given below - import pandas as pd Traceback (most recent call last): File "", line 1, in import pandas as pd File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\__init__.py", line 55, in from pandas.core.api import ( File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\api.py", line 29, in from pandas.core.groupby import Grouper, NamedAgg File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\__init__.py", line 1, in from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\generic.py", line 60, in from pandas.core.frame import DataFrame File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\frame.py", line 124, in from pandas.core.series import Series File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\series.py", line 4572, in Series._add_series_or_dataframe_operations() File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\generic.py", line 10349, in _add_series_or_dataframe_operations from pandas.core.window import EWM, Expanding, Rolling, Window File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\__init__.py", line 1, in from pandas.core.window.ewm import EWM # noqa:F401 File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\ewm.py", line 5, in import pandas._libs.window.aggregations as window_aggregations ImportError: DLL load failed while importing aggregations: The specified module could not be found. I am not able to run pandas. *Kindly help me to resolve this problem.* After searching on Google, this looks like your problem: ImportError: DLL load failed with Windows wheel for 1.0.2 and 1.0.3 #32857 https://github.com/pandas-dev/pandas/issues/32857 The last comment (jshridha) gives a solution. -- https://mail.python.org/mailman/listinfo/python-list
Problem in importing pandas
Dear Sir/Madam, After *successful installation of PIP for PANDAS *when I try to *import pandas*, It gives error as given below - >>> import pandas as pd Traceback (most recent call last): File "", line 1, in import pandas as pd File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\__init__.py", line 55, in from pandas.core.api import ( File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\api.py", line 29, in from pandas.core.groupby import Grouper, NamedAgg File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\__init__.py", line 1, in from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\groupby\generic.py", line 60, in from pandas.core.frame import DataFrame File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\frame.py", line 124, in from pandas.core.series import Series File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\series.py", line 4572, in Series._add_series_or_dataframe_operations() File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\generic.py", line 10349, in _add_series_or_dataframe_operations from pandas.core.window import EWM, Expanding, Rolling, Window File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\__init__.py", line 1, in from pandas.core.window.ewm import EWM # noqa:F401 File "C:\Users\Amit\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\window\ewm.py", line 5, in import pandas._libs.window.aggregations as window_aggregations ImportError: DLL load failed while importing aggregations: The specified module could not be found. I am not able to run pandas. *Kindly help me to resolve this problem.* *Regards * *Amit Kumar Jain* -- https://mail.python.org/mailman/listinfo/python-list
Re: news.bbs.nz is spewing duplicates to comp.lang.python
> > Have tracked-down and communicated with the site owner/operator. He > advised a loop-back problem which has now been blocked. > I believe this has been corrected in the past, more than once, though my memory is a bit hazy now. It's not clear to me why this particular site keeps messing up their configs. Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: news.bbs.nz is spewing duplicates to comp.lang.python
Have tracked-down and communicated with the site owner/operator. He advised a loop-back problem which has now been blocked. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list