Re: For Loop Dilema [python-list]

2018-02-25 Thread Chris Angelico
On Mon, Feb 26, 2018 at 5:19 AM, wrote: > Why we don’t use: > > for _ in _ in _ > > Instead of > > for _ in _: > for _ in _: > > Ex: > > Names = ["Arya","Pupun"] > > for name in Names: >for c in name: >print(c) > > instead use: > > for c in name in Names: > print(c) B

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Sunday, February 25, 2018 at 10:35:29 PM UTC-6, Steven D'Aprano wrote: [...] > Ah, you mean just like the way things were in Python 1.0 > through 2.1? Hands up anyone who has seen an integer > OverflowError in the last 10 years? Anyone? I think Python2.1 is much older than 10 years, so yeah, of

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Steven D'Aprano
On Sun, 25 Feb 2018 18:33:47 -0800, Rick Johnson wrote: > On Friday, February 23, 2018 at 10:41:45 AM UTC-6, Steven D'Aprano > wrote: [...] >> There are dozens of languages that have made the design choice to limit >> their default integers to 16- 32- or 64-bit fixed size, and let the >> user worr

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Sunday, February 25, 2018 at 8:45:56 PM UTC-6, Chris Angelico wrote: > On Mon, Feb 26, 2018 at 1:33 PM, Rick Johnson > wrote: [...] > > A default "integer-diversity-and-inclusivity-doctrine" is > > all fine and dandy by me, (Hey, even integers need safe spaces), > > In Python 3.6+, integers ha

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Sunday, February 25, 2018 at 8:45:56 PM UTC-6, Chris Angelico wrote: > On Mon, Feb 26, 2018 at 1:33 PM, Rick Johnson [...] > > but i do wish we pythonistas had a method to turn off this > > (and other) cycle burning "features" -- you know -- in the > > 99.9 percent of time that we don'

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Friday, February 23, 2018 at 8:48:55 PM UTC-6, Steven D'Aprano wrote: [...] > Take the Fibonacci double-recursion benchmark. Okay, it > tests how well your language does at making millions of > function calls. Why? Because making "millons of function calls" is what software *DOES*! Granted, an

Re: For Loop Dilema [python-list]

2018-02-25 Thread INADA Naoki
https://docs.python.org/3.6/library/itertools.html#itertools.product On Mon, Feb 26, 2018 at 3:19 AM, wrote: > Why we don’t use: > > for _ in _ in _ > > Instead of > > for _ in _: > for _ in _: > > Ex: > > Names = ["Arya","Pupun"] > > for name in Names: >for c in name: >print

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Chris Angelico
On Mon, Feb 26, 2018 at 1:33 PM, Rick Johnson wrote: > On Friday, February 23, 2018 at 10:41:45 AM UTC-6, Steven D'Aprano wrote: > [...] >> There are dozens of languages that have made the design >> choice to limit their default integers to 16- 32- or 64-bit >> fixed size, and let the user worry a

Re: How to make Python run as fast (or faster) than Julia

2018-02-25 Thread Rick Johnson
On Friday, February 23, 2018 at 10:41:45 AM UTC-6, Steven D'Aprano wrote: [...] > There are dozens of languages that have made the design > choice to limit their default integers to 16- 32- or 64-bit > fixed size, and let the user worry about overflow. Bart, > why does it upset you so that Python m

Re: For Loop Dilema [python-list]

2018-02-25 Thread Rick Johnson
On Sunday, February 25, 2018 at 12:19:56 PM UTC-6, arya.ku...@gmail.com wrote: > Ex: > > Names = ["Arya","Pupun"] > > for name in Names: >for c in name: >print(c) > > instead use: > > for c in name in Names: > print(c) Hmm. Why stop there? bit = ["kibbles"] bits = [bit, bit

Re: For Loop Dilema [python-list]

2018-02-25 Thread Ian Kelly
On Sun, Feb 25, 2018 at 11:19 AM, wrote: > Why we don’t use: > > for _ in _ in _ > > Instead of > > for _ in _: > for _ in _: > > Ex: > > Names = ["Arya","Pupun"] > > for name in Names: >for c in name: >print(c) > > instead use: > > for c in name in Names: > print(c)

Re: matrix multiplication

2018-02-25 Thread Terry Reedy
On 2/25/2018 12:45 PM, Seb wrote: Hello, The following is an example of an Nx3 matrix (`uvw`) representing N vectors that need to be multiplied by a 3x3 matrix (generated by `randint_mat` function) and store the result in `uvw_rots`: ---

Re: read Unicode characters one by one in python2

2018-02-25 Thread Chris Angelico
On Mon, Feb 26, 2018 at 3:57 AM, Steven D'Aprano wrote: > On Mon, 26 Feb 2018 01:50:16 +1100, Chris Angelico wrote: > >> If you actually need character-by-character, you'd need "for character >> in fh.read()" rather than iterating over the file itself. Iterating over >> a file yields lines. > > In

For Loop Dilema [python-list]

2018-02-25 Thread arya . kumar2494
Why we don’t use: for _ in _ in _ Instead of for _ in _: for _ in _: Ex: Names = ["Arya","Pupun"] for name in Names: for c in name: print(c) instead use: for c in name in Names: print(c) -- https://mail.python.org/mailman/listinfo/python-list

matrix multiplication

2018-02-25 Thread Seb
Hello, The following is an example of an Nx3 matrix (`uvw`) representing N vectors that need to be multiplied by a 3x3 matrix (generated by `randint_mat` function) and store the result in `uvw_rots`: ------ import numpy as np

Re: read Unicode characters one by one in python2

2018-02-25 Thread Steven D'Aprano
On Mon, 26 Feb 2018 01:50:16 +1100, Chris Angelico wrote: > If you actually need character-by-character, you'd need "for character > in fh.read()" rather than iterating over the file itself. Iterating over > a file yields lines. Indeed. But I wonder if there's a performance cost/gain to iterating

Re: read Unicode characters one by one in python2

2018-02-25 Thread Chris Angelico
On Mon, Feb 26, 2018 at 12:33 AM, Chris Warrick wrote: > On 24 February 2018 at 17:17, Peng Yu wrote: >> Here shows some code for reading Unicode characters one by one in >> python2. Is it the best code for reading Unicode characters one by one >> in python2? >> >> https://rosettacode.org/wiki/Re

Re: read Unicode characters one by one in python2

2018-02-25 Thread Chris Warrick
On 24 February 2018 at 17:17, Peng Yu wrote: > Here shows some code for reading Unicode characters one by one in > python2. Is it the best code for reading Unicode characters one by one > in python2? > > https://rosettacode.org/wiki/Read_a_file_character_by_character/UTF8#Python No, it’s terrible