Re: [python-uk] C is it faster than numpy
Hi, Simply check the original Numpy aka Numerical Python docs where it’s comprehensively explained that the library is implemented in C with a thin Python wrapper. The docs were written circa ‘98 by the original library author. The library was optimised over a long period before being released. I’ve seen similar results when replacing an optimised Fortran library with C/C++ the key is the effort given to optimisation, and care with avoiding unnecessary memory allocation. I’ll dig out the reference when I’ve tracked it down. Best of Luck Ed Hartley > On 25 Feb 2022, at 09:42, Giorgio Zoppi wrote: > > > Well, > numpy is written in C :) Maybe your C is not the numpy equivalent? > Best Regards, > Giorgio > >> Il giorno ven 25 feb 2022 alle ore 09:03 BELAHCENE Abdelkader >> ha scritto: >> 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 implements vectorization for arrays, or I'm wrong. Anyway here is an >> example Let's look at the following case: >> Here is the result on my laptop i3: >> >> Labs$ python3 tempsExe.py 5 >> sum with Python: 1250025000 and NumPy 1250025000 >> time used Python Sum: 37.28 sec >> time used Numpy Sum: 1.85 sec >> >> Labs$ ./tt5 >> CPU time :7.521730 >> The value : 1250025000 >> >> >> This is the Python3 program : >> >> import timeit as it >> import numpy as np >> import sys >> try : >> 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 np.sum(b) >> >> print(f"sum with Python: {func1()} and NumPy {func2()} ") >> tm1=it.timeit(stmt=func1, number=n) >> print(f"time used Python Sum: {round(tm1,2)} sec") >> tm2=it.timeit(stmt=func2, number=n) >> print(f"time used Numpy Sum: {round(tm2,2)} sec") >> >> and Here the C program: >> #include >> #include >> #include >> long func1(int n){ >> long r=0; >> for (int i=1; i<= n;i++) r+= i; >> return r; >> } >> int main(int argc, char* argv[]){ >> clock_t c0, c1; >> long v,count; int n; >>if ( argc < 2) { >> printf("Please give an argument"); >> return -1; >> } >> n=atoi(argv[1]); >> c0 = clock(); >> for (int j=0;j < n;j++) v=func1(n); >> c1 = clock(); >> printf ("\tCPU time :%.2f sec", (float)(c1 - c0)/CLOCKS_PER_SEC); >> printf("\n\tThe value : %ld\n", v); >> } >> ___ >> python-uk mailing list >> python-uk@python.org >> https://mail.python.org/mailman/listinfo/python-uk > > > -- > Life is a chess game - Anonymous. > ___ > python-uk mailing list > python-uk@python.org > https://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org https://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] Your submission: A tour of data viz in Python
Hi I don’t think the entire mailing list needs to know all this. Thanks > On 14 Aug 2019, at 12:37, "a.gra...@gmail.com" wrote: > > "Requests for free or reduced prices tickets were made via the financial > assistance programme which closed for applications shortly after the CfP." > > My 2 cents: I see an issue here. A person will likely decide to attend or not > also depending if their talk/paper/poster is accepted or not. If you close > the financial aid right after the closure of CfP, people won't make it in > time to request it. Is this intentional? > >> On Wed, 14 Aug 2019 at 12:33, Ann Barr wrote: >> Dear Élèonore >> >> Requests for free or reduced prices tickets were made via the financial >> assistance programme which closed for applications shortly after the CfP. >> All allocations have now been made. >> >> If you are purchasing your own ticket, you can order an individual ticket >> which offers a significant discount on the standard ticket price. >> >> Kind Regards >> Ann Barr >> pyco...@uk.python.org >> http://2019.pyconuk.org >> https://twitter.com/PyConUK >> >> >> -- >> PyCon UK Society Ltd. Company Number: 10073469. Registered in England and >> Wales. >> Registered office: c/o Acconomy, Arena Business Centre, Holyrood Close, >> Poole BH17 7FJ, United Kingdom >> >>> On 14 Aug 2019, at 10:11, 'Éléonore Mayola' via 2019 CFP Reviewers >>> wrote: >>> >>> Hi there, >>> >>> Anyone checking this mailbox? >>> I'd like to know if poster presenters have a reduced price for the >>> conference ticket. >>> >>> Thank you, >>> >>> Éléonore >>> >>> >>> Sent with ProtonMail Secure Email. >>> >>> ‐‐‐ Original Message ‐‐‐ On Friday, 2 August 2019 15:50, Éléonore Mayola wrote: Hi, Is a conference ticket provided for poster presenters or should I buy my own ticket? Best regards, Éléonore Sent from ProtonMail mobile Original Message On 2 Jul 2019, 11:23, PyCon UK 2019 < nore...@pretalx.com> wrote: Hi! We are delighted to tell you that we have accepted your submission "A tour of data viz in Python" to PyCon UK 2019. Please click this link to confirm your attendance: https://pretalx.com/pyconuk-2019/me/submissions/APBVXQ/confirm We look forward to seeing you at PyCon UK 2019 - Please contact us if you have any questions! We will reach out again before the conference to tell you details about your slot in the schedule and technical details concerning the room and presentation tech. See you in Cardiff! The PyCon UK 2019 organisers >>> >> >> ___ >> python-uk mailing list >> python-uk@python.org >> https://mail.python.org/mailman/listinfo/python-uk > > > -- > Andrea Grandi - Software Engineer > Website: https://www.andreagrandi.it > Twitter: https://twitter.com/andreagrandi > GitHub: https://github.com/andreagrandi > PGP: https://www.andreagrandi.it/2240402E.asc > ___ > python-uk mailing list > python-uk@python.org > https://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org https://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] Announcing the Yorkshire Inquisition
> On 7 Dec 2016, at 13:36, Thomas Kluyver wrote: > >> On Wed, Dec 7, 2016, at 01:20 PM, Andy Robinson wrote: >> To enforce good conduct in a suitably Pythonic manner, I hereby >> propose the foundation of the Yorkshire Inquisition, headed by Steve. > > I don't think anybody expected that! > >> Such an institution will have truly terrifying powers of enforcement. >> Suggestions welcome on this thread > > Give the inquisition the power to restrict someone's use of language > features. For instance, in a relatively mild incident, the heretic may > be banned from using for loops for a month, and have to emulate them > using while instead. And have to prove they are not a witch by showing they don't float when pitched into the Ouse? > > Thomas > ___ > python-uk mailing list > python-uk@python.org > https://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org https://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] File upload with 'requests' package
Prolly a server side limit. > On 2 Dec 2016, at 16:15, Alistair Broomhead > wrote: > > Hi Florian, > > This is probably not the best forum for Q&A, but I think you might need to > look at > http://docs.python-requests.org/en/master/user/advanced/#chunk-encoded-requests > > Al > >> On Fri, 2 Dec 2016 at 16:11 Florian BERBAR wrote: >> Good evening everyone, >> >> I try to post a file (100MB) on a Web form with python3 and the 'requests' >> package. >> >> This is my implementation : >> >> --BOF- >> >> >> #!/usr/local/bin/python3 -u >> >> import requests >> >> email="u...@srv.fr" >> >> try: >>res = requests.post('http://server/Upload/upload.php', >>files={'aFile': open('/tmp/test.zip','rb')}, >>data={'email': email, 'submitFile': 'Envoyer le >> fichier'}) >> >> except requests.exceptions.Timeout: >>print('timeout') >> >> print(res.content) >> >> --EOF- >> >> This code semas to be correct, but it return a ConnectionResetError: [Errno >> 104] Connection reset by peer >> >> The same upload with curl work perfectly with this command : >> >> curl --form aFile=@"/tmp/test.zip" --form email="u...@srv.fr" --form >> submitFile="Envoyer le fichier" http://server/Upload/upload.php >> >> Thanks to the advance >> >> Florian___ >> python-uk mailing list >> python-uk@python.org >> https://mail.python.org/mailman/listinfo/python-uk > ___ > python-uk mailing list > python-uk@python.org > https://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org https://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] Volunteers wanted for an academic project
Hi, If NLP is what you're after it may benefit you and the project to take a look at UCREL and license CLAWS http://ucrel.lancs.ac.uk/claws/. Also look at http://ucrel.lancs.ac.uk/usas/ Best Ed > On 17 Jul 2016, at 20:47, Deborah Leem wrote: > > Hi everyone, > > I am working on a digital humanities project and have a very rudimentary > knowledge of Python. A friend of mine recommended to me to reach out to the > Python UK community as I am looking for some help from Python developers on > my text-mining project. > > Skills required: > · Natural Language Processing > · Text-mining experience > · Regex > · GIS experience desirable > > Funding may be available. Full credit will be given for all assistance > provided. > > It is a great opportunity for you to get involved in a very creative academic > research project with researchers. Please get in touch for more details if > you are interested in helping. > > Kind regards, > > Deborah Leem > > Wellcome exists to improve health for everyone by helping great ideas to > thrive. We're a global charitable foundation, both politically and > financially independent. We support scientists and researchers, take on big > problems, fuel imaginations and spark debate. > > The Wellcome Trust is a charity registered in England and Wales, no. 210183. > Its sole trustee is The Wellcome Trust Limited, a company registered in > England and Wales, no. 2711000 (whose registered office is at 215 Euston > Road, London NW1 2BE, UK) > > This message has been scanned for viruses by Websense Hosted Email Security > > ___ > python-uk mailing list > python-uk@python.org > https://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org https://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] URGENT: Volunteers for teacher collaboration please... :-)
Hi I've not seen what the commitment is but I can do something in the risibly named northern powerhouse corridor between Manchester and York dependent on contract commitments. 47 years programming 17 Python. Best Ed > On 17 Feb 2016, at 13:29, Nicholas H.Tollervey wrote: > > Hi Helen, Conrad, Ytian and Harry! > > :-P > > I'll be in touch! > > N. > >> On 17/02/16 12:50, Helen Sherwood-Taylor wrote: >> I could do Southampton. >> >>> On 17 February 2016 at 12:07, Conrad Ho wrote: >>> I can do London + if Harry goes somewhere I could also tag along. >>> >>> Conrad >>> >>> On 02/17-11:33, xtian wrote: I'm keen too! I can only really do London though, sorry. On Wed, 17 Feb 2016, 11:25 Harry Percival wrote: > v much up for this. London easiest for me but I'm sure I can wrangle > some > time off if you need someone to trek up the country somewhere... > >> On 17 February 2016 at 10:49, Zeth wrote: >> >> Hi Nick, >> >> Put me down for Birmingham of course, probably can do Nottingham and >> some of the Northern ones if needed. >> >> Best Wishes, >> Zeth >> >> On 17 February 2016 at 08:30, Nicholas H.Tollervey >> wrote: >>> Hi Folks, >>> >>> I realise I must sound like a stuck record about this sort of thing - >>> please accept my sincere apologies. >>> >>> TL;DR: I need volunteers from around the country to support a twilight >>> meetup of teachers happening in various parts of the UK. It's not >>> difficult and likely to be a lot of fun and will only take a few hours >>> of your time in the early evening of a single day. I may be able to >>> cover travel expenses. Please get in touch. More detail below... >>> >>> Computing at School (see: http://www.computingatschool.org.uk/), a >> grass >>> roots movement of computing teachers in the UK would like to run a >>> series of training courses for "Master Teachers" in MicroPython on the >>> BBC micro:bit during March. These teachers would go on to act as the >>> seed / catalyst for other teachers who require Python training during >>> a >>> series of training events over the summer. Put simply, this is an >>> exercise in Python evangelism for teachers. >>> >>> Master teachers are those who have demonstrated a combination of deep >>> subject knowledge and teaching skill. Put simply, they're the most >>> senior teachers you can get. They're also the leaders in the field and >>> what they say or do influences many hundreds of their colleagues. >>> >>> The idea is for the master teachers to get together with Python >>> developers (that'd be *you*) for a few hours to work through >>> MicroPython >>> related educational resources. These events would happen at university >>> based hubs around the country. As a Python developer you'll *get a BBC >>> micro:bit* and be expected to offer advice, answer questions and >>> demonstrate Python as needed. Honestly, it's not an onerous task and >>> will only last a few hours in a "twilight" session (i.e. after work). >>> >>> The locations and proposed dates are as follows: >>> >>> London: 25th February >>> Birmingham: 9th March >>> Nottingham: 15th March >>> Lancaster: 16th March >>> Newcastle: 17th March >>> Hertfordshire: 21st March >>> Manchester: 23rd March >>> Southampton: 23rd March >>> >>> It's easy for UK Python to be very London-centric. This is an >>> opportunity for Pythonistas throughout the UK to step up and get >> involved. >>> >>> Why should you volunteer a few hours of your time to help teachers? >>> Need >>> you ask? Your help and influence will ultimately contribute to the >>> education of the next generation of programmers - your future >>> colleagues. It's a way to give back to the community by fostering the >>> next generation of Pythonistas with the help of the CAS Master >>> Teachers. >>> It's also, from a moral point of view, simply a selfless and >>> unambiguously good thing to do. >>> >>> If you're thinking "oh, they won't want me", then YOU ARE EXACTLY THE >>> PERSON WE NEED! Your experience, perspective and knowledge is >>> invaluable >>> and teachers need to hear from you. Rest assured, this will not be a >>> difficult or high-pressure activity. In fact, it's likely to be a lot >>> of >>> fun. >>> >>> Remember that awesome person who mentored you and/or gave you a step >>> up? >>> Now's your chance to be that person for a group of master teachers. >>> >>> If this is of interest to you, please get in touch ASAP and I can >>> start >>> to coordinate things with CAS. >>> >>> I'm going to put in a grant request to the PSF to see if we can cover >>> travel costs for develop
Re: [python-uk] Suggestions / best practices for deployment
+1 from another dinosaur Ed On 16 May 2013, at 16:46, Andy Robinson wrote: > Speaking as a relatively obsolete dinosaur, I would suggest that if > you are going to discuss specific deployment practices, you start with > the most fundamental ones: SSH, the unix shell and so on. > > We have had issues over the years with people coming in and > introducing sexy new deployment tools, but ultimately they all just > run unix commands. Anyone managing a web application in the > non-microsoft world is ultimately depending on this. Some key skills > (assuming a Linux/Mac/Unix-ish environment): > - know about SSH keys and logging into remote machines > - know the basics of at least one command line editor (e.g. vi) > - basic shell knowledge: environment variables, testing for existence > of files and directories etc > - how to interact with your database from the command line, if you use > one (including dump and restore) > - how your web server works: starting, stopping, configuration files, > where log files live and how it talks to Python > > Fabric may be useful if you want to control half a dozen machines from > your desktop, and it might add a lot of value if you want to control a > hundred of them. But to update one server, you deploy by logging into > it and then running commands or short scripts. > > For example, we have a 'demo site' we rebuild pretty often that uses > Django, MYSQL, Celery and a few other things. It runs on plain > vanilla Ubuntu machines we build ourselves. The sequence is... > > 1. Log in via SSH > 2. CD to correct directory > 3. activate virtual environment > 4. stop any celery worker processes > 5. stop web server processes (* in our setup, we leave Apache running) > 6. pull latest code from mercurial - both the app, and 3-4 libraries > it depends on > 7. run a management command to rebuild the database > 8. run a smallish in-place test suite > 9. restart celery workers > 10.restart web server > 11. log out > > All of this after the login and CD can be handled by a shell script on > the path of the server, so you can just run a command called something > like > ./update_server > > More realistically, we tend to end up with a management shell script > called 'server' with a bunch of commands/arguments like 'stop / start > / restart / update-code-in-staging / copy-live-data-to-staging / > run-health-checks / swap-live-and-staging' and so on. SSH can execute > remote commands like this just fine with the right arguments, if > actually logging in is too tedious. > > Production sites are complex and all different. You might want to do > instantaneous swaps from live to staging (and be able to back out fast > if stuff goes wrong); to switch DNS so the world is looking at another > server while you update one; you might have large databases to copy or > migrate that need significant time; it may or may not be acceptable to > lose sessions and have downtime; and so on. > > > It takes less time to learn the fundamentals than you will spend > debugging why your fancy new deployment tool stopped working after > some Python dependency upgrade somewhere. And it is less likely that > your new hires will disagree if you stick with the lowest common > denominator. > > If you already know the fundamentals and make an informed decision to > use a popular deployment tool, that's fine. Just take the time to > write down why you use it in your docs so people will know if its no > longer appropriate one day. > > --- > > So, my 2p worth is that in the book you might want to show a > Linux/Apache setup, discuss what kind of scripts ought to exist on the > box for managing it, discuss concerns you MIGHT need to address during > deployment, and tell people to automate it. Then point out that > there are many popular higher-level tools. > > - Andy > ___ > python-uk mailing list > python-uk@python.org > http://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] Tell us what you did with Python this year....
On 20 Dec 2010, at 16:46, Tim Golden wrote: > On 20/12/2010 16:08, Alec Battles wrote: >> I >> still have no idea why tokenizing Hungarian text and tokenizing German >> text are not fundamentally the same operation > Those languages have different grammatical structure inflexion and stemming rules amongst others. HTH > I have no idea why they're not: > > > import codecs > > with codecs.open ("german.txt", "rb", encoding="utf8") as f: > german_text = f.read () > > with codecs.open ("hungarian.txt", "rb", encoding="utf8") as f: > hungarian_text = f.read () > > # do_stuff_with (german_text) > # do_stuff_with (hungarian_text) > > > > Of course, I'm assuming that you know what encoding has been > used to serialise the text, but if you don't then it's not > Python's fault ;) > > TJG > ___ > python-uk mailing list > python-uk@python.org > http://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] Python in Edinburgh
On 11 Aug 2010, at 17:46, Anand Kumria wrote: > Hey all, > > Just a head's up that there are a bunch of us Pythonista's meeting up in > Edinburgh on the 24th Aug (yes, during the festival!) > Hi good to here about this, I'll try to get along as I'm in the area for a week or two longer. Cheers Ed > We'll be at Bert's bar - http://www.bertsbar.co.uk/ > > If you are going to be in the area, pop along. > > Cheers, > Anand > ___ > python-uk mailing list > python-uk@python.org > http://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] Python UK user groups / website / coordination
On 2 Aug 2010, at 09:16, Nicholas Tollervey wrote: > Folks, > > During Europython a group of us who organise various Python related user > groups within the UK went for a drink. Here's what we talked about: > Hi, I'm all for this the main reason I turned from Python to iOS was the apparent impossibility of sustained UK contract or other freelance employment in the UK. Mind you iOS is equally interesting Best of Luck Ed > > Nicholas. > ___ > python-uk mailing list > python-uk@python.org > http://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] emacs and python and emacs-starter-kit
On 17 Mar 2010, at 14:44, Michael Sparks wrote: On Wednesday 17 March 2010 14:30:01 Andy Kilner wrote: You'll both be at the pyssup tonight so you can go and form a little emacs corner somewhere the cellar maybe? Surely you're not suggesting putting all the emacs users in a deep dark hole in the ground, are you ? If he does I may have to join them as I find myself in town today. :) ;-) Michael. ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] 2nd London Python Dojo - 18:30 15 October 2009 at Fry-IT
Sent from my iPhone at last the handheld that works! On 7 Oct 2009, at 12:41, Dave Kirby wrote: As Tim says, ipython is a superset of the regular python shell, so you can ignore all the features and get along with it just fine. The features I find most useful (and which I think will be of benefit to the dojo) are context-sensitive tab completion and the help system. Using these is an order of magnitude faster than looking things up in the docs and works for any modules or objects that ipython can see. Another use is when exploring an API or doing "what if's" on parameter values is to use log files. Then incrementally edit and reload as a method. Then extend the method, rinse and repeat. Finally wrap the results up into a class and add a main that exercises tests cases on the class. Ed It also has a bunch of built-in commands such as 'cd', 'ls', 'rm', 'cp' etc for accessing the filesystem, 'time' and 'timeit' for timing fragments of code, 'run' to execute a file in the namespace of the interactive session, 'ed' to edit text in a text editor and execute the code as if it was typed at the prompt, and many more. Dave ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk
Re: [python-uk] London Python meetup, Wednesday, October the 10th
Sorry I'm traveling that day, good luck with it though. Ed Hartley On 9/18/07, Sam Clegg <[EMAIL PROTECTED]> wrote: > > On Tue, 2007-09-18 at 15:15 +0100, Fuzzyman wrote: > > I could give a quick demo of IronPython and Silverlight - anything from > > 10mins upwards... > > Mmm... I love to see that. That isn't with moonlight on mono by any > chance? > > > > > > Michael > > > > Tim Golden wrote: > > > > >>ThoughtWorks UK (my employer) have given us the use of a room this > > >>time, so I'm looking for volunteer speakers, too. > > >> > > >> > > > > > >I'm in. Happy to give a talk, too. (WMI, active directory, win32 sort > of > > >stuff). > > > > > >TJG > > >___ > > >python-uk mailing list > > >python-uk@python.org > > >http://mail.python.org/mailman/listinfo/python-uk > > > > > > > > > > > > > ___ > > python-uk mailing list > > python-uk@python.org > > http://mail.python.org/mailman/listinfo/python-uk > > ___ > python-uk mailing list > python-uk@python.org > http://mail.python.org/mailman/listinfo/python-uk > > > ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk