Re: C is it always faster than nump?

2022-02-25 Thread BELAHCENE Abdelkader
Thanks every body, I want to close the subject, but just a naive question: Does numpy use a* vectorization *for arrays? I mean when I add 2 arrays ( or in sum function) how it is done, in an other word b=np.arange(100); t=np.sum(b) is equivalent or not to s=0 for i in range(100): s +=b[i] thanks

Re: C is it always faster than nump?

2022-02-25 Thread Dan Stromberg
On Fri, Feb 25, 2022 at 8:12 AM BELAHCENE Abdelkader < abdelkader.belahc...@enst.dz> wrote: > Hi, > a lot of people think that C (or C++) is faster than python, yes I agree, > but I think that's not the case with numpy, I believe numpy is faster than > C, at least in some cases. > This is all "la

Re: C is it always faster than nump?

2022-02-25 Thread Dan Stromberg
On Fri, Feb 25, 2022 at 9:03 PM Chris Angelico wrote: > On Sat, 26 Feb 2022 at 15:39, Avi Gross via Python-list > wrote: > > Take interpreted languages including Python and R that specify all kinds > of functions that may be written within the language at first. Someone may > implement a functio

Re: C is it always faster than nump?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 15:39, Avi Gross via Python-list wrote: > Take interpreted languages including Python and R that specify all kinds of > functions that may be written within the language at first. Someone may > implement a function like sum() (just an example) that looks like the sum of >

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
Agreed, Chris. There are many ways to get something done. I often use the Anaconda distribution because it tends to bundle many of the modules I need and more. Not that it is such a big deal to load the ones you need, but if you share your program, others trying to use it may have some problems

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
Yes, Chris, C is real as a somewhat abstract concept. There are a whole slew of different variations each time it is released anew with changes and then some people at various times built actual compilers that implement a varying subset of what is possible, and not necessarily in quite the same

Re: C is it always faster than nump?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 14:35, Avi Gross via Python-list wrote: > But with numpy and more available anyway, it may not be necessary to reinvent > much of that. I was just wondering if it ever made sense to simply include it > in the base python, perhaps as a second executable with a name like pyt

Re: Best way to check if there is internet?

2022-02-25 Thread Abdur-Rahmaan Janhangeer
> I never knew this. Where can I read more about this origin? https://python-history.blogspot.com/2009/01/personal-history-part-1-cwi.html?m=1 <> There are more sources which i cannot remember from the top of my head -- https://mail.python.org/mailman/listinfo/python-list

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
Dennis, What you describe may be a start but is it anything I might not have easily created myself? https://docs.python.org/3/library/array.html I can see creating my own object and adding those methods and attributes while gaining very little, except perhaps storage. Can I add or multiply tw

Re: C is it always faster than nump?

2022-02-25 Thread Oscar Benjamin
On Sat, 26 Feb 2022 at 03:10, Dennis Lee Bieber wrote: > > On Fri, 25 Feb 2022 23:06:57 + (UTC), Avi Gross > declaimed the following: > > >I do have to wonder if anyone ever considered adding back enough > >functionality into base Python to make some additions less needed. Is there > >any r

Re: Best way to check if there is internet?

2022-02-25 Thread Abdur-Rahmaan Janhangeer
Yes i know that JS has switch from before I was referring to the pattern matching proposal. I cannot find the original place i read it from but here's the github one https://github.com/tc39/proposal-pattern-matching -- https://mail.python.org/mailman/listinfo/python-list

Re: C is it always faster than nump?

2022-02-25 Thread Dennis Lee Bieber
On Fri, 25 Feb 2022 23:06:57 + (UTC), Avi Gross declaimed the following: >I do have to wonder if anyone ever considered adding back enough functionality >into base Python to make some additions less needed. Is there any reason the >kind of structures used by so many languages cannot be made

Re: C is it always faster than nump?

2022-02-25 Thread Oscar Benjamin
On Fri, 25 Feb 2022 at 23:13, Barry wrote: > > > On 25 Feb 2022, at 23:00, Richard Damon wrote: > > > > On 2/25/22 2:47 PM, Chris Angelico wrote: > >>> On Sat, 26 Feb 2022 at 05:49, Richard Damon > >>> wrote: > >>> On 2/25/22 4:12 AM, BELAHCENE Abdelkader wrote: > Hi, > a lot of peop

Re: Best way to check if there is internet?

2022-02-25 Thread Greg Ewing
On 26/02/22 11:22 am, Chris Angelico wrote: What's the best language for swearing in? Ah, that one I can't help you with, although I've heard good things about French. :) Russian seems to be quite good for it too, judging by certain dashcam footage channels. -- Greg -- https://mail.python.org/

Re: One-liner to merge lists?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 10:05, Albert-Jan Roskam wrote: >Was also thinking about reduce, though this one uses a dunder method: >from functools import reduce >d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']} >print(reduce(list.__add__, list(d.values( If you don't want to use th

Re: C is it always faster than nump?

2022-02-25 Thread Barry
> On 25 Feb 2022, at 23:00, Richard Damon wrote: > > On 2/25/22 2:47 PM, Chris Angelico wrote: >>> On Sat, 26 Feb 2022 at 05:49, Richard Damon >>> wrote: >>> On 2/25/22 4:12 AM, BELAHCENE Abdelkader wrote: Hi, a lot of people think that C (or C++) is faster than python, yes I agree

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
Is that fair, Grant? I go back far enough that in my earliest years I was submitting FORTRAN programs written on punched cards and often getting them back the next day. The compiling was not the major factor in how long it took. For many cases, a compiled language only needs to be compiled once

Re: One-liner to merge lists?

2022-02-25 Thread Albert-Jan Roskam
If you don't like the idea of 'adding' strings you can 'concat'enate: >>> items = [[1,2,3], [4,5], [6]] >>> functools.reduce(operator.concat, items) [1, 2, 3, 4, 5, 6] >>> functools.reduce(operator.iconcat, items, []) [1, 2, 3, 4, 5, 6] The latter is the functio

Re: C is it always faster than nump?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 09:58, Richard Damon wrote: > > On 2/25/22 2:47 PM, Chris Angelico wrote: > > On Sat, 26 Feb 2022 at 05:49, Richard Damon > > wrote: > >> On 2/25/22 4:12 AM, BELAHCENE Abdelkader wrote: > >>> Hi, > >>> a lot of people think that C (or C++) is faster than python, yes I agre

Re: C is it always faster than nump?

2022-02-25 Thread Richard Damon
On 2/25/22 2:47 PM, Chris Angelico wrote: On Sat, 26 Feb 2022 at 05:49, Richard Damon wrote: On 2/25/22 4:12 AM, BELAHCENE Abdelkader wrote: Hi, a lot of people think that C (or C++) is faster than python, yes I agree, but I think that's not the case with numpy, I believe numpy is faster than

Re: Best way to check if there is internet?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 09:04, Barry Scott wrote: > > > > > On 25 Feb 2022, at 18:07, Abdur-Rahmaan Janhangeer > > wrote: > > > > Normally people put Python in the scripting category. > > I learnt typed languages like C++ and Java at first. > > People who learn languages like these tend to put >

Re: Best way to check if there is internet?

2022-02-25 Thread Barry Scott
> On 25 Feb 2022, at 18:07, Abdur-Rahmaan Janhangeer > wrote: > > Normally people put Python in the scripting category. > I learnt typed languages like C++ and Java at first. > People who learn languages like these tend to put > Python in a non-serious category. The post was > more ironic tha

Re: Best way to check if there is internet?

2022-02-25 Thread Michael F. Stemper
On 25/02/2022 14.30, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2022-02-25 at 13:48:32 -0600, "Michael F. Stemper" wrote: On 25/02/2022 12.07, Abdur-Rahmaan Janhangeer wrote: I have been following language feature proposals from various languages. Some decide to avoid Python's route, but

Re: Best way to check if there is internet?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 07:32, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2022-02-25 at 13:48:32 -0600, > "Michael F. Stemper" wrote: > > > On 25/02/2022 12.07, Abdur-Rahmaan Janhangeer wrote: > > > > I have been following language feature proposals from various > > > languages. Some decide

Re: C is it always faster than nump?

2022-02-25 Thread Grant Edwards
On 2022-02-25, Richard Damon wrote: > On 2/25/22 4:12 AM, BELAHCENE Abdelkader wrote: >> Hi, >> a lot of people think that C (or C++) is faster than python, yes I agree, >> but I think that's not the case with numpy, I believe numpy is faster than >> C, at least in some cases. > > My understanding

Re: Best way to check if there is internet?

2022-02-25 Thread 2QdxY4RzWzUUiLuE
On 2022-02-25 at 13:48:32 -0600, "Michael F. Stemper" wrote: > On 25/02/2022 12.07, Abdur-Rahmaan Janhangeer wrote: > > I have been following language feature proposals from various > > languages. Some decide to avoid Python's route, but others have been > > trying hard to catch up with Python.

Re: Best way to check if there is internet?

2022-02-25 Thread Michael F. Stemper
On 25/02/2022 12.07, Abdur-Rahmaan Janhangeer wrote: I have been following language feature proposals from various languages. Some decide to avoid Python's route, but others have been trying hard to catch up with Python. One gleaming example is the switch case. JS recently proposed pattern match

Re: C is it always faster than nump?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 06:44, Avi Gross via Python-list wrote: > > I agree with Richard. > > Some people may be confused and think c is the speed of light and > relativistically speaking, nothing can be faster. (OK, just joking. The uses > of the same letter of the alphabet are not at all relate

Re: C is it always faster than nump?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 05:49, Richard Damon wrote: > > On 2/25/22 4:12 AM, BELAHCENE Abdelkader wrote: > > Hi, > > a lot of people think that C (or C++) is faster than python, yes I agree, > > but I think that's not the case with numpy, I believe numpy is faster than > > C, at least in some cases.

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
I agree with Richard. Some people may be confused and think c is the speed of light and relativistically speaking, nothing can be faster. (OK, just joking. The uses of the same letter of the alphabet are not at all related. One is named for the language that came after the one named B, while th

Re: C is it always faster than nump?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 03:13, BELAHCENE Abdelkader wrote: > *This is the Python3 program :import timeit as itimport numpy as npimport > systry : n=eval(sys.argv[1])except: print ("needs integer as argument") ; > exit() a=range(1,n+1)b=np.array(a)def func1(): return sum(a)def > func2(): return

Re: Threading question .. am I doing this right?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 05:16, Robert Latest via Python-list wrote: > > Chris Angelico wrote: > > Depending on your database, this might be counter-productive. A > > PostgreSQL database running on localhost, for instance, has its own > > caching, and data transfers between two apps running on the s

Re: Best way to check if there is internet?

2022-02-25 Thread Chris Angelico
On Sat, 26 Feb 2022 at 05:09, Abdur-Rahmaan Janhangeer wrote: > > Normally people put Python in the scripting category. You have a very interesting definition of "normal". ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: C is it always faster than nump?

2022-02-25 Thread Richard Damon
On 2/25/22 4:12 AM, BELAHCENE Abdelkader wrote: Hi, a lot of people think that C (or C++) is faster than python, yes I agree, but I think that's not the case with numpy, I believe numpy is faster than C, at least in some cases. My understanding is that numpy is written in C, so for it to be fast

Re: Threading question .. am I doing this right?

2022-02-25 Thread Robert Latest via Python-list
Greg Ewing wrote: > * If more than one thread calls get_data() during the initial > cache filling, it looks like only one of them will wait for > the thread -- the others will skip waiting altogether and > immediately return None. Right. But that needs to be dealt with somehow. No data is no data.

Re: Threading question .. am I doing this right?

2022-02-25 Thread Robert Latest via Python-list
Chris Angelico wrote: > Depending on your database, this might be counter-productive. A > PostgreSQL database running on localhost, for instance, has its own > caching, and data transfers between two apps running on the same > computer can be pretty fast. The complexity you add in order to do > you

Re: Best way to check if there is internet?

2022-02-25 Thread Abdur-Rahmaan Janhangeer
Normally people put Python in the scripting category. I learnt typed languages like C++ and Java at first. People who learn languages like these tend to put Python in a non-serious category. The post was more ironic than litteral. After 5 years of following the mailing lists i realised that there

Re: Best way to check if there is internet?

2022-02-25 Thread Benjamin Schollnick
>>> Thanks for the in-between. I really like the Python comunity as, >>> even though it's a 'scripting' language, > > And we like you, even though you're only a ... > > In English, a statement like that is considered rather insulting. > >> To me, it's a programming language. In my usage, a "scri

Re: Best way to check if there is internet?

2022-02-25 Thread Grant Edwards
On 2022-02-25, Michael F. Stemper wrote: > On 25/02/2022 06.49, Abdur-Rahmaan Janhangeer wrote: > >> Thanks for the in-between. I really like the Python comunity as, >> even though it's a 'scripting' language, And we like you, even though you're only a ... In English, a statement like that is co

Re: Best way to check if there is internet?

2022-02-25 Thread Michael F. Stemper
On 25/02/2022 06.49, Abdur-Rahmaan Janhangeer wrote: Thanks for the in-between. I really like the Python comunity as, even though it's a 'scripting' language, To me, it's a programming language. In my usage, a "script" is a bunch of OS commands. -- Michael F. Stemper Life's too important to t

Re: Threading question .. am I doing this right?

2022-02-25 Thread Greg Ewing
On 25/02/22 1:08 am, Robert Latest wrote: My question is: Is this a solid approach? Am I forgetting something? I can see a few of problems: * If more than one thread calls get_data() during the initial cache filling, it looks like only one of them will wait for the thread -- the others will sk

When to use SQLAlchemy listen events

2022-02-25 Thread Loris Bennett
Hi, I am wondering whether SQLAlchemy listen events are appropriate for the following situation: I have a table containing users and a table for events related to users class User(Base): __tablename__ = "users" uid = Column('uid', String(64), primary_key=True) gid = Column('

C is it always faster than nump?

2022-02-25 Thread BELAHCENE Abdelkader
Hi, a lot of people think that C (or C++) is faster than python, yes I agree, but I think that's not the case with numpy, I believe numpy is faster than C, at least in some cases. *Is there another explanation ?Or where can find a doc speaking about the subject?*Thanks a lot Regards Numpy imple

Re: Best way to check if there is internet?

2022-02-25 Thread Abdur-Rahmaan Janhangeer
Avi solved the captive portal problem above. It's by comparing the page content to a dynamic output. I was asking for wifi just in case i missed anything we did not yet discuss. I consider the thread closed, thanks everybody, it was very fruitful for me. Thanks for the in-between. I really like