Re: Embedded Python and C Callback functions

2015-06-07 Thread dieter
doc.mefi...@gmail.com writes: > I'm trying to debug and find my error. It goes wrong when: > PyObject *v; > v = va_arg(*p_va, PyObject *); > if (v != NULL) { > if (*(*p_format - 1) != 'N') > Py_INCREF(v); > } > > it tries to

Re: Function to show time to execute another function

2015-06-07 Thread Johannes Bauer
On 07.06.2015 22:35, Cecil Westerhof wrote: >> And you also posted your solution. I fail to find any question in >> your original posting at all. > > That is because there was no question: I just wanted to share > something I thought that could be useful. If you would have taken the > trouble to

Re: Query regarding sys.stdout.write

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 11:56 AM, Cameron Simpson wrote: > If you want do do this version portably, hook into the Python curses module > and get the result of curses.tigetstr('el'). If that returns None, the > terminal does not support clear-to-end-of-line and you should use the > spaces-overwrite

Re: Query regarding sys.stdout.write

2015-06-07 Thread Cameron Simpson
On 08Jun2015 10:18, Chris Angelico wrote: On Mon, Jun 8, 2015 at 7:17 AM, Sreenath Nair wrote: I have a general query about the following snippet: import os Import sys for each_dir in os.listdir("/home/tmpuser"): full_path = os.path.join("/home/tmpuser", each_dir) sys.stdout.write("\r

Re: Testing random

2015-06-07 Thread random832
On Sun, Jun 7, 2015, at 21:42, Chris Angelico wrote: > On Mon, Jun 8, 2015 at 11:34 AM, wrote: > > In general, as the number of trials increases, the probability of having > > e.g. at least one of each value never _reaches_ 1, but it gets > > arbitrarily close. > > And by "arbitrarily close", yo

Re: Testing random

2015-06-07 Thread MRAB
On 2015-06-08 02:42, Chris Angelico wrote: On Mon, Jun 8, 2015 at 11:34 AM, wrote: In general, as the number of trials increases, the probability of having e.g. at least one of each value never _reaches_ 1, but it gets arbitrarily close. And by "arbitrarily close", you mean any of: I belie

Re: Testing random

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 11:34 AM, wrote: > In general, as the number of trials increases, the probability of having > e.g. at least one of each value never _reaches_ 1, but it gets > arbitrarily close. And by "arbitrarily close", you mean any of: * So close to 1.0 that IEEE double precision is u

Re: Testing random

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 11:35 pm, Peter Otten wrote: > Steven D'Aprano wrote: > > >>> I wrote a very simple function to test random: >>> def test_random(length, multiplier = 1): >>> number_list = length * [0] >>> for i in range(length * multiplier): >>> number_list

Re: Testing random

2015-06-07 Thread random832
On Sun, Jun 7, 2015, at 16:56, Thomas 'PointedEars' Lahn wrote: > random...@fastmail.us wrote: > > > On Sun, Jun 7, 2015, at 16:09, Thomas 'PointedEars' Lahn wrote: > >> No. AISB, those sequences all have the same probability: > > > > Yes and the probability of getting _any_ of the sequences, is

Re: Testing random

2015-06-07 Thread Steven D'Aprano
On Mon, 8 Jun 2015 06:56 am, Thomas 'PointedEars' Lahn wrote: > You really should follow the references and brush up your math. You really should stop being patronising to everyone and pay attention to what is actually being said. If you won't believe us, and you won't believe mathematics, perha

Re: Testing random

2015-06-07 Thread Steven D'Aprano
On Mon, 8 Jun 2015 04:23 am, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: > >> On Mon, Jun 8, 2015 at 2:36 AM, Thomas 'PointedEars' Lahn >> wrote: The greater the multiplier, the lower the chance that any element will have no hits. >>> Wrong. >>> [ex falso quodlibet] >

Re: Query regarding sys.stdout.write

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 7:17 AM, Sreenath Nair wrote: > I have a general query about the following snippet: > > import os > Import sys > for each_dir in os.listdir("/home/tmpuser"): > full_path = os.path.join("/home/tmpuser", each_dir) > sys.stdout.write("\r%s" % full_path) > sys.stdout

Re: Built-in Python3 web server functionality - wsgiref & http.server

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 5:13 AM, Eric wrote: > I am trying to better understand the built-in python3 web server > functionality and have just started reading the documentation. > > There seem to be two options provided by Python 3. > > 1. > wsgiref > https://docs.python.org/3/library/wsgiref.html

Updated Python 2.7.10 and now causing XCode not to build new project?

2015-06-07 Thread Sebastian M Cheung
Updated my anaconda Python to 2.7.10 and now when I start my XCode new project i get: env: python: No such file or directory Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 127 Anyone experienced this issue? -- https:

Re: Query regarding sys.stdout.write

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 23:17 CEST, Sreenath Nair wrote: > I have a general query about the following snippet: > > import os > Import sys > for each_dir in os.listdir("/home/tmpuser"): > full_path = os.path.join("/home/tmpuser", each_dir) > sys.stdout.write("\r%s" % full_path) > sys.stdout.flush() >

Re: Detect if specific Python.app instance is already running

2015-06-07 Thread Ned Deily
In article <11e093d5-b78e-4ac6-9a7f-649cb2c2c...@googlegroups.com>, Andrei wrote: > Alright, I have had some development in > http://stackoverflow.com/questions/30694560/detect-if-specific-python-app-inst > ance-is-already-running and can prevent running multiple instances of the > same app/scr

Re: Is there a mail list like python-list in c?

2015-06-07 Thread Cameron Simpson
On 08Jun2015 01:18, Jimages wrote: i know that the question may not be suitable. But i am learning python as well as c. And i find the list valuable. After google mail list about c. i don't find even one mail list t about programming in C. So could you recommend a mail list about programming in

Re: Query regarding sys.stdout.write

2015-06-07 Thread Cameron Simpson
On 08Jun2015 02:47, Sreenath Nair wrote: I have a general query about the following snippet: import os Import sys for each_dir in os.listdir("/home/tmpuser"): full_path = os.path.join("/home/tmpuser", each_dir) sys.stdout.write("\r%s" % full_path) sys.stdout.flush() The snippet is a s

Query regarding sys.stdout.write

2015-06-07 Thread Sreenath Nair
Hi, I have a general query about the following snippet: import os Import sys for each_dir in os.listdir("/home/tmpuser"): full_path = os.path.join("/home/tmpuser", each_dir) sys.stdout.write("\r%s" % full_path) sys.stdout.flush() The snippet is a simplified example of me trying to pr

Is there a mail list like python-list in c?

2015-06-07 Thread Jimages
Hi! i know that the question may not be suitable. But i am learning python as well as c. And i find the list valuable. After google mail list about c. i don't find even one mail list t about programming in C. So could you recommend a mail list about programming in c? BTW excuse my bad English.

Re: Testing random

2015-06-07 Thread Ned Batchelder
On Sunday, June 7, 2015 at 2:26:02 PM UTC-4, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: > > > On Mon, Jun 8, 2015 at 2:36 AM, Thomas 'PointedEars' Lahn > > wrote: > >>> The greater the multiplier, the lower the chance that any element will > >>> have no hits. > >> Wrong. > >> > >>>

Re: How to inverse a particle emitter

2015-06-07 Thread Denis McMahon
On Thu, 04 Jun 2015 16:15:20 -0700, stephenppraneel7 wrote: > hey, i really need help, im a straight up beginner in scripting and i > need to figure out how to make an inverted particle emitter using python > in maya An emitter of inverted particles? Or an inverted emitter? Or an absorber / acce

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
random...@fastmail.us wrote: > On Sun, Jun 7, 2015, at 16:09, Thomas 'PointedEars' Lahn wrote: >> No. AISB, those sequences all have the same probability: > > Yes and the probability of getting _any_ of the sequences, is the sum of > the probabilities for each one of the sequences individually.

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 20:51 CEST, Johannes Bauer wrote: > On 07.06.2015 10:22, Cecil Westerhof wrote: > >> That only times the function. I explicitly mentioned I want both >> the needed time AND the output. > > And you also posted your solution. I fail to find any question in > your original posti

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
random...@fastmail.us wrote: > On Sun, Jun 7, 2015, at 16:09, Thomas 'PointedEars' Lahn wrote: >> No. AISB, those sequences all have the same probability: > > Yes and the probability of getting _any_ of the sequences, is the sum of > the probabilities for each one of the sequences individually.

Re: Testing random

2015-06-07 Thread random832
On Sun, Jun 7, 2015, at 16:09, Thomas 'PointedEars' Lahn wrote: > No. AISB, those sequences all have the same probability: Yes and the probability of getting _any_ of the sequences, is the sum of the probabilities for each one of the sequences individually. -- https://mail.python.org/mailman/l

Re: Embedded Python and C Callback functions

2015-06-07 Thread Stefan Behnel
doc.mefi...@gmail.com schrieb am 07.06.2015 um 10:56: > And I can't use Cython, because I have C++ module, and I have to use it. That's not a valid reason. Cython supports C++ code just fine. http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html Stefan -- https://mail.python.org/mailma

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
Peter Otten wrote: > Thomas 'PointedEars' Lahn wrote: >> Peter Otten wrote: >>> Steven D'Aprano wrote: > I wrote a very simple function to test random: > def test_random(length, multiplier = 1): > number_list = length * [0] > for i in range(length * multipl

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
random...@fastmail.us wrote: > On Sun, Jun 7, 2015, at 15:29, Thomas 'PointedEars' Lahn wrote: >> Jussi Piitulainen wrote: >> > Thomas 'PointedEars' Lahn writes: >> >> 8 3 6 3 1 2 6 8 2 1 6. >> > >> > There are more than four hundred thousand ways to get those numbers in >> > some order. >> >

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 19:23 CEST, Chris Angelico wrote: > On Mon, Jun 8, 2015 at 3:17 AM, C.D. Reimer wrote: >> This is the Python script that takes ~197 seconds to complete. >> >> import random, time >> >> startTime = time.time() >> >> f = [0] * 12 >> >> for i in range(5000): >> >> a = rando

Re: Detect if specific Python.app instance is already running

2015-06-07 Thread Andrei
Alright, I have had some development in http://stackoverflow.com/questions/30694560/detect-if-specific-python-app-instance-is-already-running and can prevent running multiple instances of the same app/script (by lockf), but I still need to identify which Python.app instance is running certain s

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > On Mon, Jun 8, 2015 at 4:23 AM, Thomas 'PointedEars' Lahn > wrote: >> If the set to choose from is integer numbers from 1 to 9, then *each* of >> those sequences has *the same* probability (1∕9)¹¹ ≈ 3.1866355 × 10⁻¹¹. >> >> AISB, those are *independent* events; the number

Re: Testing random

2015-06-07 Thread random832
On Sun, Jun 7, 2015, at 15:29, Thomas 'PointedEars' Lahn wrote: > Jussi Piitulainen wrote: > > > Thomas 'PointedEars' Lahn writes: > >> 8 3 6 3 1 2 6 8 2 1 6. > > > > There are more than four hundred thousand ways to get those numbers in > > some order. > > > > (11! / 2! / 2! / 2! / 3! / 2! =

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
Jussi Piitulainen wrote: > Thomas 'PointedEars' Lahn writes: >> 8 3 6 3 1 2 6 8 2 1 6. > > There are more than four hundred thousand ways to get those numbers in > some order. > > (11! / 2! / 2! / 2! / 3! / 2! = 415800) Fallacy. Order is irrelevant here. -- PointedEars Twitter: @PointedEa

Built-in Python3 web server functionality - wsgiref & http.server

2015-06-07 Thread Eric
I am trying to better understand the built-in python3 web server functionality and have just started reading the documentation. There seem to be two options provided by Python 3. 1. wsgiref https://docs.python.org/3/library/wsgiref.html 2. http.server https://docs.python.org/3/library/http.ser

Re: Testing random

2015-06-07 Thread Jussi Piitulainen
Thomas 'PointedEars' Lahn writes: > Chris Angelico wrote: > >> Huh. Do you want to explain how, mathematically, I am wrong, or do >> you want to join the RUE in my ignore list? > > I already did; you have overlooked it. In a nutshell, the probability > of > > 1 1 1 1 1 1 1 1 1 1 1 There is one

Re: Function to show time to execute another function

2015-06-07 Thread Johannes Bauer
On 07.06.2015 10:22, Cecil Westerhof wrote: > That only times the function. I explicitly mentioned I want both the > needed time AND the output. And you also posted your solution. I fail to find any question in your original posting at all. > Sadly the quality of the answers on this list is goin

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread C.D. Reimer
On 6/7/2015 11:33 AM, Steven D'Aprano wrote: C rand is not even close to random. The technical term for it is "shite". Looking through the BASIC book, I remembered all the tricks needed to get a half-way decent number generator on a 1MHz processor back in the day. Either the numbers start rep

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 4:40 AM, C.D. Reimer wrote: > PS Z:\projects\programming\python\basic_games\fastdice> python > test_fastdice.py > > TOTAL SPOTS NUMBER OF TIMES > > 21389911 > > 3222 > > 44168248 > > 55553632 > > 6

Re: Testing random

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 4:23 AM, Thomas 'PointedEars' Lahn wrote: > If the set to choose from is integer numbers from 1 to 9, then *each* of > those sequences has *the same* probability (1∕9)¹¹ ≈ 3.1866355 × 10⁻¹¹. > > AISB, those are *independent* events; the number of occurrences of an > outcome

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread C.D. Reimer
On 6/7/2015 10:33 AM, Chris Angelico wrote: The negative result is a strong indicator that you're not seeing the results of rand() here. While there is a potential for bias (check out RAND_MAX, and consider that there may be some small bias there; although on most modern systems, RAND_MAX is goin

Re: Testing random

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 4:28 AM, Steven D'Aprano wrote: > If my previous post didn't convince you, consider an even simpler random > distribution: tossing a fair coin. The probability of getting a head is > exactly 1/2 whether you toss the coin once or a thousand times. But if you > toss the coin o

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread Steven D'Aprano
On Mon, 8 Jun 2015 03:17 am, C.D. Reimer wrote: > Greetings, > > I've revisited my misbegotten childhood by translating the programs from > "BASIC Computer Games" by David H. Ahl into Python. This is mostly an > exercise in unraveling spaghetti code with all those GOTO statements > going all over

Re: Testing random

2015-06-07 Thread Steven D'Aprano
On Mon, 8 Jun 2015 02:36 am, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: >> The greater the multiplier, the lower the chance that any element will >> have no hits. > > Wrong. No, Chris is correct. The "multiplier" increases the number of samples. The larger the number of samples, t

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > On Mon, Jun 8, 2015 at 2:36 AM, Thomas 'PointedEars' Lahn > wrote: >>> The greater the multiplier, the lower the chance that any element will >>> have no hits. >> Wrong. >> >>> [ex falso quodlibet] > > Huh. Do you want to explain how, mathematically, I am wrong, or do you

Re: Testing random

2015-06-07 Thread Steven D'Aprano
On Mon, 8 Jun 2015 01:51 am, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: > >> On Sun, Jun 7, 2015 at 8:40 PM, Thomas 'PointedEars' Lahn >> wrote: >>> Cecil Westerhof wrote: I wrote a very simple function to test random: def test_random(length, multiplier = 1):

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 3:59 AM, C.D. Reimer wrote: > On 6/7/2015 10:23 AM, Chris Angelico wrote: >> >> Before you go any further, can you just try this script, please, and >> see how long it takes to run? >> >> import random, time >> startTime = time.time() >> for i in range(5000): >> pas

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread C.D. Reimer
On 6/7/2015 10:23 AM, Chris Angelico wrote: Before you go any further, can you just try this script, please, and see how long it takes to run? import random, time startTime = time.time() for i in range(5000): pass print '\n', time.time() - startTime I know, seems a stupid thing to try,

Re: Testing random

2015-06-07 Thread C.D. Reimer
On 6/7/2015 10:20 AM, Chris Angelico wrote: A fourth possibility is that mathematics works differently for him and for us, which I suppose is possible; when I visited sci.math a while ago, I found some people for whom everything I'd learned in grade school was clearly wrong, and they were doing t

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 3:17 AM, C.D. Reimer wrote: > The Python random shows a uniform bell curve with low numbers at the ends > and the peak in the middle, which is similar to the text in the book for the > BASIC program. The Cython C rand is over all the place (especially with a > negative numbe

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 3:17 AM, C.D. Reimer wrote: > This is the Python script that takes ~197 seconds to complete. > > import random, time > > startTime = time.time() > > f = [0] * 12 > > for i in range(5000): > > a = random.randint(1,6) > > b = random.randint(1,6) > > f[(a + b) -

Re: Testing random

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 3:07 AM, Ian Kelly wrote: > On Sun, Jun 7, 2015 at 10:44 AM, Chris Angelico wrote: >> On Mon, Jun 8, 2015 at 2:36 AM, Thomas 'PointedEars' Lahn >> wrote: The greater the multiplier, the lower the chance that any element will have no hits. >>> >>> Wrong. >>>

Python Random vs. Cython C Rand for Dice Rolls

2015-06-07 Thread C.D. Reimer
Greetings, I've revisited my misbegotten childhood by translating the programs from "BASIC Computer Games" by David H. Ahl into Python. This is mostly an exercise in unraveling spaghetti code with all those GOTO statements going all over the place. The dice program caught my attention in part

Re: Testing random

2015-06-07 Thread Ian Kelly
On Sun, Jun 7, 2015 at 10:44 AM, Chris Angelico wrote: > On Mon, Jun 8, 2015 at 2:36 AM, Thomas 'PointedEars' Lahn > wrote: >>> The greater the multiplier, the lower the chance that any element will >>> have no hits. >> >> Wrong. >> >>> [ex falso quodlibet] > > Huh. Do you want to explain how, ma

Re: Testing random

2015-06-07 Thread Peter Otten
Thomas 'PointedEars' Lahn wrote: > Peter Otten wrote: > >> Steven D'Aprano wrote: I wrote a very simple function to test random: def test_random(length, multiplier = 1): number_list = length * [0] for i in range(length * multiplier): nu

Re: Testing random

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 2:36 AM, Thomas 'PointedEars' Lahn wrote: >> The greater the multiplier, the lower the chance that any element will >> have no hits. > > Wrong. > >> [ex falso quodlibet] Huh. Do you want to explain how, mathematically, I am wrong, or do you want to join the RUE in my ignore

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > On Mon, Jun 8, 2015 at 1:51 AM, Thomas 'PointedEars' Lahn > wrote: >> Chris Angelico wrote: >> >>> On Sun, Jun 7, 2015 at 8:40 PM, Thomas 'PointedEars' Lahn >>> wrote: Cecil Westerhof wrote: > I wrote a very simple function to test random: > def test_rand

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
Peter Otten wrote: > Steven D'Aprano wrote: >>> I wrote a very simple function to test random: >>> def test_random(length, multiplier = 1): >>> number_list = length * [0] >>> for i in range(length * multiplier): >>> number_list[random.randint(0, length - 1)] +=

Re: Lawful != Mutable (was Can Python function return multiple data?)

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 2:20 AM, Rustom Mody wrote: > Ok now rewrite that para above with > s/tuple/numbers like 3 or 666/ > So I put '3' on the ram and grind it to finest powder. > Have all trinities (of religious or secular variety) disappeared? > 666 gone has the devil been banished from God's (

Re: Ah Python, you have spoiled me for all other languages

2015-06-07 Thread Steven D'Aprano
On Mon, 8 Jun 2015 12:58 am, random...@fastmail.us wrote: > On Sun, Jun 7, 2015, at 07:42, Steven D'Aprano wrote: >> The question of graphemes (what "ordinary people" consider letters and >> characters, e.g. "ch" is two letters to an English speaker but one letter >> to a Czech speaker) should be

Re: Testing random

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 1:51 AM, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: > >> On Sun, Jun 7, 2015 at 8:40 PM, Thomas 'PointedEars' Lahn >> wrote: >>> Cecil Westerhof wrote: I wrote a very simple function to test random: def test_random(length, multiplier = 1): >>

Re: Lawful != Mutable (was Can Python function return multiple data?)

2015-06-07 Thread Rustom Mody
On Saturday, June 6, 2015 at 10:20:49 AM UTC+5:30, Steven D'Aprano wrote: > On Sat, 6 Jun 2015 01:20 pm, Rustom Mody wrote: > > > On Saturday, June 6, 2015 at 3:30:23 AM UTC+5:30, Chris Angelico wrote: > > >> Congrats! You just proved that an object can itself be immutable, but > >> can contain r

Re: Lawful != Mutable (was Can Python function return multiple data?)

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 1:49 AM, Rustom Mody wrote: > On Saturday, June 6, 2015 at 11:13:52 AM UTC+5:30, Chris Angelico wrote: >> On Sat, Jun 6, 2015 at 3:28 PM, Rustom Mody wrote: >> > You just repeated what Chris said, replacing 'immutable' with 'same' >> > There was a list: [1,2,3] >> > At some

Re: Is it a newsgroup or a list?

2015-06-07 Thread Larry Martell
On Sun, Jun 7, 2015 at 11:49 AM, Gene Heskett wrote: > You mentioned GoogleGroups, now go warsh yur mouth out with some of > Grandma's Lye soap. This list is 500% easier to read when they are > filtered out. I still see the responses but they are at least formatted > for readability. Gene is ver

Re: Testing random

2015-06-07 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > On Sun, Jun 7, 2015 at 8:40 PM, Thomas 'PointedEars' Lahn > wrote: >> Cecil Westerhof wrote: >>> I wrote a very simple function to test random: >>> def test_random(length, multiplier = 1): >>> number_list = length * [0] >>> for i in range(length * m

Re: Is it a newsgroup or a list?

2015-06-07 Thread Gene Heskett
On Sunday 07 June 2015 09:57:55 Tim Golden wrote: > On 07/06/2015 12:20, random...@fastmail.us wrote: > > On Sun, Jun 7, 2015, at 05:06, Luca Menegotto wrote: > >> Il 07/06/2015 10:22, Cecil Westerhof ha scritto: > >> > That only times the function. I explicitly mentioned I want > >> > both t

Lawful != Mutable (was Can Python function return multiple data?)

2015-06-07 Thread Rustom Mody
On Saturday, June 6, 2015 at 11:13:52 AM UTC+5:30, Chris Angelico wrote: > On Sat, Jun 6, 2015 at 3:28 PM, Rustom Mody wrote: > > You just repeated what Chris said, replacing 'immutable' with 'same' > > There was a list: [1,2,3] > > At some point that list is found to be(come) [1,2,3,4] > > They d

Re: Ah Python, you have spoiled me for all other languages

2015-06-07 Thread Chris Angelico
On Mon, Jun 8, 2015 at 12:58 AM, wrote: > On Sun, Jun 7, 2015, at 07:42, Steven D'Aprano wrote: >> The question of graphemes (what "ordinary people" consider letters and >> characters, e.g. "ch" is two letters to an English speaker but one letter >> to a Czech speaker) should be left to libraries

Re: Ah Python, you have spoiled me for all other languages

2015-06-07 Thread random832
On Sun, Jun 7, 2015, at 07:42, Steven D'Aprano wrote: > The question of graphemes (what "ordinary people" consider letters and > characters, e.g. "ch" is two letters to an English speaker but one letter > to a Czech speaker) should be left to libraries. Do Czech speakers expect to be able to selec

Re: Ah Python, you have spoiled me for all other languages

2015-06-07 Thread Chris Angelico
On Sun, Jun 7, 2015 at 11:24 PM, Steven D'Aprano wrote: >> (Unless you want to say that all strings are guaranteed to >> be NFC/NFD normalized, such that s1 and s2 would actually be >> identical, which I suppose is plausible. I'm not sure what the >> advantage would be, though. And certainly you w

Detect if specific Python.app instance is already running

2015-06-07 Thread Andrei
Hello, I am experimenting with OS X apps written in Python and need to detect if there is already an instance of Python.app running with certain script. My script modifies CFBundleName on-the-fly from "Python" to "MyApp" to change the app title in the menubar. If I start another instance and ch

Re: Is it a newsgroup or a list?

2015-06-07 Thread Luca Menegotto
Il 07/06/2015 13:45, Steven D'Aprano ha scritto: As far as I know, python-list a.k.a. comp.lang.python is the only one of the Python mailing lists with an official newsgroup mirror. OK. So let me rephrase: Thank God the list is mirrired to a newsgroup... -- Ciao! Luca -- https://mail.python

Re: Is it a newsgroup or a list?

2015-06-07 Thread Tim Golden
On 07/06/2015 12:20, random...@fastmail.us wrote: On Sun, Jun 7, 2015, at 05:06, Luca Menegotto wrote: Il 07/06/2015 10:22, Cecil Westerhof ha scritto: > That only times the function. I explicitly mentioned I want both the > needed time AND the output. > > Sadly the quality of the answer

Re: Find in ipython3

2015-06-07 Thread Chris Angelico
On Sun, Jun 7, 2015 at 8:27 PM, Peter Otten <__pete...@web.de> wrote: > Just wait for Python 3.5. The switch from os.listdir() to the (new) > os.scandir() in the implementation of os.walk() is likely to improve the > situation Why wait? I've been using 3.5 for ages (and actually, my /usr/local/bin

Re: Testing random

2015-06-07 Thread Peter Otten
Steven D'Aprano wrote: >> I wrote a very simple function to test random: >> def test_random(length, multiplier = 1): >> number_list = length * [0] >> for i in range(length * multiplier): >> number_list[random.randint(0, length - 1)] += 1 >> minimum = mi

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 11:28 CEST, Steven D'Aprano wrote: > Here is a simple example: > > http://code.activestate.com/recipes/577896-benchmark-code-with-the-with-statement/ I use that now in my function: #--- def time_test(function

Re: Ah Python, you have spoiled me for all other languages

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 10:08 pm, Chris Angelico wrote: > On Sun, Jun 7, 2015 at 9:42 PM, Steven D'Aprano > wrote: >> My opinion is that a programming language like Python or ECMAScript >> should operate on *code points*. If we want to call them "characters" >> informally, that should be allowed, but

Re: Find in ipython3

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 07:33 pm, Laura Creighton wrote: > In a message of Sun, 07 Jun 2015 08:20:46 +0200, Cecil Westerhof writes: >>> You may get faster results if you use Matthew Barnett's replacement >>> for re here: https://pypi.python.org/pypi/regex >>> >>> You will get faster results if you buil

Re: Is it a newsgroup or a list?

2015-06-07 Thread Chris Warrick
On Sun, Jun 7, 2015 at 1:45 PM, Steven D'Aprano wrote: > As far as I know, python-list a.k.a. comp.lang.python is the only one of the > Python mailing lists with an official newsgroup mirror. comp.lang.python.announce also exists. Sent via mailing list. -- Chris Warrick

Re: Testing random

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 10:52 pm, Steven D'Aprano wrote: > The median is unchanged, the mean shifts slightly higher, and the standard > deviation increases. But as you can see, these are not particularly > powerful tests of randomness: only the mode shows an obvious deviation > from uniformity. Oh, I

Re: Function to show time to execute another function

2015-06-07 Thread Laura Creighton
In a message of Sun, 07 Jun 2015 11:16:30 +0100, Mark Lawrence writes: >I suggest that you stop asking so many question here. Get your cheque >book and go for paid support. Knock this off, please. Some of us dearly like to teach people who want to explore and learn things. Laura -- https://m

Re: Find in ipython3

2015-06-07 Thread Laura Creighton
In a message of Sun, 07 Jun 2015 12:27:05 +0200, Peter Otten writes: >> There is no gain to get in standard Python? By switching from fnmatch >> to re I got almost a speed gain of two. So I was wondering if I could >> do more. > >Just wait for Python 3.5. The switch from os.listdir() to the (new)

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 13:05 CEST, Tim Golden wrote: > On 07/06/2015 11:16, Mark Lawrence wrote: >> On 07/06/2015 09:22, Cecil Westerhof wrote: >>> That only times the function. I explicitly mentioned I want both >>> the needed time AND the output. >>> >>> Sadly the quality of the answers on this l

Re: Testing random

2015-06-07 Thread Christian Gollwitzer
Am 07.06.15 um 08:27 schrieb Cecil Westerhof: I wrote a very simple function to test random: def test_random(length, multiplier = 1): number_list = length * [0] for i in range(length * multiplier): number_list[random.randint(0, length - 1)] += 1 mi

Re: Testing random

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 04:27 pm, Cecil Westerhof wrote: > I wrote a very simple function to test random: > def test_random(length, multiplier = 1): > number_list = length * [0] > for i in range(length * multiplier): > number_list[random.randint(0, length - 1)] += 1

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 12:16 CEST, Mark Lawrence wrote: > I suggest that you stop asking so many question here. Get your > cheque book and go for paid support. First of all: it was not a question: I shared something I thought was useful. You can disagree about it being useful, but there is in my o

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 11:51 CEST, Steven D'Aprano wrote: > On Sun, 7 Jun 2015 04:39 pm, Cecil Westerhof wrote: > >> Sometimes I just want to know how much time a function takes, but >> at the same time I also want the result of the function. For this I >> wrote the following function: def time_tes

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 11:28 CEST, Steven D'Aprano wrote: > On Sun, 7 Jun 2015 04:39 pm, Cecil Westerhof wrote: > >> Sometimes I just want to know how much time a function takes, but >> at the same time I also want the result of the function. For this I >> wrote the following function: def time_tes

Re: Function to show time to execute another function

2015-06-07 Thread Cecil Westerhof
On Sunday 7 Jun 2015 11:06 CEST, Luca Menegotto wrote: > Il 07/06/2015 10:22, Cecil Westerhof ha scritto: >> That only times the function. I explicitly mentioned I want both >> the needed time AND the output. >> >> Sadly the quality of the answers on this list is going down > > First of all,

Re: Ah Python, you have spoiled me for all other languages

2015-06-07 Thread Chris Angelico
On Sun, Jun 7, 2015 at 9:42 PM, Steven D'Aprano wrote: > My opinion is that a programming language like Python or ECMAScript should > operate on *code points*. If we want to call them "characters" informally, > that should be allowed, but whenever there is ambiguity we should remember > we're deal

Re: Testing random

2015-06-07 Thread Chris Angelico
On Sun, Jun 7, 2015 at 8:40 PM, Thomas 'PointedEars' Lahn wrote: > Cecil Westerhof wrote: > >> I wrote a very simple function to test random: >> def test_random(length, multiplier = 1): >> number_list = length * [0] >> for i in range(length * multiplier): >> num

Re: Is it a newsgroup or a list?

2015-06-07 Thread Zachary Ware
On Sunday, June 7, 2015, wrote: > On Sun, Jun 7, 2015, at 05:06, Luca Menegotto wrote: > > Il 07/06/2015 10:22, Cecil Westerhof ha scritto: > > > That only times the function. I explicitly mentioned I want both the > > > needed time AND the output. > > > > > > Sadly the quality of the answers

Re: Is it a newsgroup or a list?

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 09:20 pm, random...@fastmail.us wrote: > On Sun, Jun 7, 2015, at 05:06, Luca Menegotto wrote: >> Il 07/06/2015 10:22, Cecil Westerhof ha scritto: >> > That only times the function. I explicitly mentioned I want both the >> > needed time AND the output. >> > >> > Sadly the qu

Re: Ah Python, you have spoiled me for all other languages

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 06:21 pm, Thomas 'PointedEars' Lahn wrote: > Ned Batchelder wrote: > >> On Saturday, May 23, 2015 at 9:01:29 AM UTC-4, Steven D'Aprano wrote: >>> On Sat, 23 May 2015 10:33 pm, Thomas 'PointedEars' Lahn wrote: >>> > If only characters were represented as sequences UTF-16 code un

Re: Function to show time to execute another function

2015-06-07 Thread Steven D'Aprano
On Sun, 7 Jun 2015 08:16 pm, Mark Lawrence wrote: > I suggest that you stop asking so many question here. Get your cheque > book and go for paid support. Mark, that remark is uncalled for and completely out of line. Cecil is perfectly entitled to ask questions here, and you are entitled to igno

Is it a newsgroup or a list?

2015-06-07 Thread random832
On Sun, Jun 7, 2015, at 05:06, Luca Menegotto wrote: > Il 07/06/2015 10:22, Cecil Westerhof ha scritto: > > That only times the function. I explicitly mentioned I want both the > > needed time AND the output. > > > > Sadly the quality of the answers on this list is going down > > First of

Re: [OT] Re: Function to show time to execute another function

2015-06-07 Thread Mark Lawrence
On 07/06/2015 12:02, Marko Rauhamaa wrote: Mark Lawrence : Get your cheque book and go for paid support. Are checks still in use in Britain? I thought only Americans still did that. Marko Cheques are still in use in Britain. There was a move a year or so ago to get rid of them but too m

[OT] Re: Function to show time to execute another function

2015-06-07 Thread Marko Rauhamaa
Mark Lawrence : > Get your cheque book and go for paid support. Are checks still in use in Britain? I thought only Americans still did that. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Function to show time to execute another function

2015-06-07 Thread Tim Golden
On 07/06/2015 11:16, Mark Lawrence wrote: On 07/06/2015 09:22, Cecil Westerhof wrote: That only times the function. I explicitly mentioned I want both the needed time AND the output. Sadly the quality of the answers on this list is going down. Here I get an alternative that does only half what

Re: Testing random

2015-06-07 Thread Jonas Wielicki
On 07.06.2015 08:27, Cecil Westerhof wrote: > I wrote a very simple function to test random: > def test_random(length, multiplier = 1): > number_list = length * [0] > for i in range(length * multiplier): > number_list[random.randint(0, length - 1)] += 1 >

  1   2   >