Passing back the ERRORLEVEL

2018-12-28 Thread Gisle Vanem
I have trouble understanding why a 'sys.exit(2)' is *not* passed back to the CMD shell in this little example: - c:\py_cmd_test.cmd -- @%WinDir%\py.exe -2 -x %~dp0py_cmd_test.cmd & exit /b %ERRORLEVEL% # The '-x' is for Python to skip the 1st line of this file. import sys print ("Hello,

Re: Ask for help about class variable scope (Re: Why doesn't a dictionary work in classes?)

2018-12-28 Thread jfong
jf...@ms4.hinet.net於 2018年12月28日星期五 UTC+8下午4時04分07秒寫道: > eryk sun at 2018/12/27 UTC+8 PM 6:58:33 wrote: > > On 12/27/18, jf...@ms4.hinet.net wrote: > > > > > > I still don't get it. When I change it to using list comprehension, the > > > problem is still there. (it now has no late-binding variable

Re: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Cameron Simpson
On 28Dec2018 20:21, Daniel Ojalvo wrote: I agree that previous behavior shouldn't be changed, but I would suggest updating the documentation to point it out as a footnote. The current behavior is correct just unclear. Most people just learning about the open command wouldn't have this expectat

RE: graded randomness

2018-12-28 Thread Avi Gross
Abdur-Rahman I am sure various modules available have ready-made solutions and I see others have replied to your question. The usual disclaimers apply. This is an academic discussion and not a statement of the right or only way to do an abstract task. So just a thought. You seem interested in a G

Re: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Chris Angelico
On Sat, Dec 29, 2018 at 7:21 AM Daniel Ojalvo wrote: > > Thank you for the advice! > > I haven't used the opener argument before, but I'll keep it for future > reference. I think it's still a little kludge-y, but it works. It has a very similar effect to what you were proposing, but still works

RE: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Daniel Ojalvo via Python-list
Thank you for the advice! I haven't used the opener argument before, but I'll keep it for future reference. I think it's still a little kludge-y, but it works. I agree that previous behavior shouldn't be changed, but I would suggest updating the documentation to point it out as a footnote. The

Re: graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
well i wanted that to improve the following code: https://www.pythonmembers.club/2018/12/28/reviving-bertrand-russell-through-python/ that one i used the random list technique Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius > -- https://mail

RE: dangerous class neighborhood

2018-12-28 Thread Avi Gross
[REAL SUBJECT: an assortment of nothings] Python tricks? Speaking from a tutorial forum, tricks can catch people trying to learn. I am not sure of the history of the ellipsis object. >>> dir(...) ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__',

Re: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Chris Angelico
On Sat, Dec 29, 2018 at 4:24 AM Grant Edwards wrote: > > On 2018-12-27, Daniel Ojalvo via Python-list wrote: > > open("this_is_a_pipe") > > > > Opening a tty device can also block[1]. However, if somebody is using > the open() builtin on tty devices that's probably the least of their > prob

Re: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Grant Edwards
On 2018-12-27, Daniel Ojalvo via Python-list wrote: open("this_is_a_pipe") > Opening a tty device can also block[1]. However, if somebody is using the open() builtin on tty devices that's probably the least of their problems. [1] Technically, opening any character-mode device could block

Re: ANNOUNCE: TIB/Rendezvous module for python

2018-12-28 Thread zhen . zhong
Hi, There, I am an engineer in Taiwan and I was trying to install rvpython-2.1final.tar.gz but it's built up in python 2.x which cannot be installed in python 3 or above. Is there any officially released version of rvpython compatible with python 3 or above? Thank yo

Re: graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
woops @ben me too i got that solution but i'm searching for a neater answer. let us say i'm using it over new data, 1 million data of red blue green can be saved by just dealing with the probabilities ^^_ Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ M

Re: graded randomness

2018-12-28 Thread Tim Chase
On 2018-12-28 17:31, Abdur-Rahmaan Janhangeer wrote: > do you have something like > > choice(balls) > > >>> red Don't specify the "k=" (which defaults to 1 if you omit it) and use the first element of the results: >>> from random import choices >>> distribution = {"green":2, "red": 2, "blue":

Re: graded randomness

2018-12-28 Thread Tim Chase
On 2018-12-28 16:15, Abdur-Rahmaan Janhangeer wrote: > greetings, > > let us say that i have a box of 5 balls, > > green balls - 2 with probability 2/5 > red balls 2 - with probability 2/5 > blue balls 1 - with probability 1/5 > > how to program the selection so that the random choices reflect t

Re: graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
ah yes, powerful enough for further customisations * scratches head thanks everybody ! Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list

Re: graded randomness

2018-12-28 Thread Chris Angelico
On Sat, Dec 29, 2018 at 12:28 AM Abdur-Rahmaan Janhangeer wrote: > > woops @ben me too i got that solution but i'm searching for a neater answer. > > let us say i'm using it over new data, 1 million data of red blue green can > be saved by just dealing with the probabilities ^^_ Assuming you're o

Re: graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
@Tim do you have something like choice(balls) >>> red and subsequent repetitions for long enough yield approximately 2/5 times r 2/5 times g and 1/5 b like one without random choice over list/tuples Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mau

Re: graded randomness

2018-12-28 Thread Ben Bacarisse
Abdur-Rahmaan Janhangeer writes: > let us say that i have a box of 5 balls, > > green balls - 2 with probability 2/5 > red balls 2 - with probability 2/5 > blue balls 1 - with probability 1/5 > > how to program the selection so that the random choices reflect the > probabilities? >>> import rand

Re: Facing an Error after migrating from python 3.4.1 to python 3.6.6 ( Failed to import the site module )

2018-12-28 Thread Piet van Oostrum
sandeep.ba...@gmail.com writes: > ``` > Error code: > -- > > > Traceback (most recent call last): > File > "C:\Users\sandeep\AppData\Local\Programs

graded randomness

2018-12-28 Thread Abdur-Rahmaan Janhangeer
greetings, let us say that i have a box of 5 balls, green balls - 2 with probability 2/5 red balls 2 - with probability 2/5 blue balls 1 - with probability 1/5 how to program the selection so that the random choices reflect the probabilities? -- Abdur-Rahmaan Janhangeer http://www.pythonmember

Re: dangerous class neighborhood

2018-12-28 Thread Abdur-Rahmaan Janhangeer
thanks, the 3 dots are more explicit, thought was another py trick yours, Abdur-Rahmaan Janhangeer http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list

Re: Ask for help about class variable scope (Re: Why doesn't a dictionary work in classes?)

2018-12-28 Thread jfong
eryk sun at 2018/12/27 UTC+8 PM 6:58:33 wrote: > On 12/27/18, jf...@ms4.hinet.net wrote: > > > > I still don't get it. When I change it to using list comprehension, the > > problem is still there. (it now has no late-binding variable, right? :-) > > > class Too: > > ... XS = [15, 15, 15,