Re: ConnectionError handling problem

2015-09-29 Thread shiva upreti
On Friday, September 25, 2015 at 12:55:01 PM UTC+5:30, Cameron Simpson wrote: > On 24Sep2015 22:46, shiva upreti wrote: > >On Friday, September 25, 2015 at 10:55:45 AM UTC+5:30, Cameron Simpson wrote: > >> On 24Sep2015 20:57, shiva upreti wrote: > >> >Thank you Cameron. > >> >I think the problem

Re: pypy - Gurobi solver library

2015-09-29 Thread Laura Creighton
In a message of Tue, 29 Sep 2015 18:58:19 -0700, LJ writes: >Hi All, > >I use gurobipy to model a large scale optimization problem. Is there a way to >use pypy with the gurobipy library? Has anyone done this? > >Thanks. I don't think so. I think that gurobipy depends on having all of numpy worki

Re: Check if a given value is out of certain range

2015-09-29 Thread Luca Menegotto
Il 29/09/2015 23:04, Random832 ha scritto: How about x not in range(11)? Remember: simpler is better. -- Ciao! Luca -- https://mail.python.org/mailman/listinfo/python-list

Re: Check if a given value is out of certain range

2015-09-29 Thread Ian Kelly
On Tue, Sep 29, 2015 at 9:14 PM, Steven D'Aprano wrote: > On Wed, 30 Sep 2015 01:08 pm, Random832 wrote: > >> Steven D'Aprano writes: >>> It's not fine. In Python 2, >>>... >>> Testing a numeric value within a certain range of values should be >>> constant time and constant memory. It should be *

Re: Linux Mint installation of Python 3.5

2015-09-29 Thread Chris Angelico
On Wed, Sep 30, 2015 at 1:23 PM, Steven D'Aprano wrote: > I think that it is generally a good idea to keep your development Python > separate from the system Python, even if they use the same version. That > way, even if you accidentally break your development Python, the system > Python will cont

Re: Linux Mint installation of Python 3.5

2015-09-29 Thread Steven D'Aprano
On Wed, 30 Sep 2015 01:00 pm, Mario Figueiredo wrote: > So the solution is to just maintain 3 different versions > of python my machine. Ridiculous. Not at all. It's not like a Python install is that big -- Python 3.3 is only about 150MB. It's a little sad that Ubuntu isn't able to transition be

Re: Linux Mint installation of Python 3.5

2015-09-29 Thread Chris Angelico
On Wed, Sep 30, 2015 at 1:00 PM, Mario Figueiredo wrote: >> Personally, I use the regular 'make install', but that's because I'm >> on Debian - the system Python is 2.7. > > Unfortunately Ubuntu based distros are going through a 2.x to 3.x > transition period. Both Pythons are installed and are sy

Re: Check if a given value is out of certain range

2015-09-29 Thread Steven D'Aprano
On Wed, 30 Sep 2015 01:08 pm, Random832 wrote: > Steven D'Aprano writes: >> It's not fine. In Python 2, >>... >> Testing a numeric value within a certain range of values should be >> constant time and constant memory. It should be *fast*. Using range in >> Python 2 is none of those things. > > I

Re: Linux Mint installation of Python 3.5

2015-09-29 Thread Zachary Ware
On Tue, Sep 29, 2015 at 10:00 PM, Mario Figueiredo wrote: > On 09/30/2015 03:44 AM, Chris Angelico wrote: >> >> The easiest way to install something from source is to use 'make >> altinstall' for the final step. That should install you a 'python3.5' >> binary without touching the 'python3' binary.

Re: Check if a given value is out of certain range

2015-09-29 Thread Random832
Steven D'Aprano writes: > It's not fine. In Python 2, >... > Testing a numeric value within a certain range of values should be constant > time and constant memory. It should be *fast*. Using range in Python 2 is > none of those things. I wasn't aware we were discussing Python 2. -- https://mai

Re: Linux Mint installation of Python 3.5

2015-09-29 Thread Mario Figueiredo
On 09/30/2015 03:44 AM, Chris Angelico wrote: > > The easiest way to install something from source is to use 'make > altinstall' for the final step. That should install you a 'python3.5' > binary without touching the 'python3' binary. That said, though, it's > entirely possible that upgrading 'pyt

Re: Linux Mint installation of Python 3.5

2015-09-29 Thread Chris Angelico
On Wed, Sep 30, 2015 at 12:37 PM, Mario Figueiredo wrote: > Under Linux Mint it is not a good idea to just go ahead and replace the > system installed Python versions and their packages. And yet I wish to > both update the 3.4 modules and install Python 3.5. I understand that > for the first I jus

Linux Mint installation of Python 3.5

2015-09-29 Thread Mario Figueiredo
Hello everyone, Under Linux Mint it is not a good idea to just go ahead and replace the system installed Python versions and their packages. And yet I wish to both update the 3.4 modules and install Python 3.5. I understand that for the first I just need to use virtualenv. But how can I safely in

Re: Check if a given value is out of certain range

2015-09-29 Thread Tim Chase
On 2015-09-29 21:32, Mark Lawrence wrote: > On 29/09/2015 17:48, Rob Gaddi wrote: > >> Is there any similar elegant way to check if a value is out of > >> certain range? > >> Example - To check if x is either less than zero or greater than > >> ten? Right now I am using x < 0 or x > 10. > > > > not

pypy - Gurobi solver library

2015-09-29 Thread LJ
Hi All, I use gurobipy to model a large scale optimization problem. Is there a way to use pypy with the gurobipy library? Has anyone done this? Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: Check if a given value is out of certain range

2015-09-29 Thread Steven D'Aprano
On Wed, 30 Sep 2015 07:07 am, Ian Kelly wrote: > On Tue, Sep 29, 2015 at 3:04 PM, Random832 wrote: >> How about x not in range(11)? > > That's fine as long as x is known to only take integral values. It's not fine. In Python 2, it's painfully slow and inefficient, both memory-wise and algorithm

Re: multiprocessing speedup

2015-09-29 Thread Rita
Thanks for the responses. I will create another thread to supply a more realistic example. On Tue, Sep 29, 2015 at 10:12 AM, Oscar Benjamin wrote: > On Tue, 29 Sep 2015 at 02:22 Rita wrote: > >> I am using the multiprocessing with apply_async to do some work. Each >> task takes a few seconds

Re: Check if a given value is out of certain range

2015-09-29 Thread Denis McMahon
On Tue, 29 Sep 2015 10:16:04 +0530, Laxmikant Chitare wrote: > Is there any similar elegant way to check if a value is out of certain > range? What about: if not (0 < x < 10): -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Check if a given value is out of certain range

2015-09-29 Thread Emile van Sebille
On 9/29/2015 2:04 PM, Random832 wrote: On Tue, Sep 29, 2015, at 16:32, Mark Lawrence wrote: not (0 <= x <= 10) Yuck. How about x not in range(11)? x = 5.5 Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: Check if a given value is out of certain range

2015-09-29 Thread Ian Kelly
On Tue, Sep 29, 2015 at 3:04 PM, Random832 wrote: > How about x not in range(11)? That's fine as long as x is known to only take integral values. -- https://mail.python.org/mailman/listinfo/python-list

Re: Check if a given value is out of certain range

2015-09-29 Thread Random832
On Tue, Sep 29, 2015, at 16:32, Mark Lawrence wrote: > On 29/09/2015 17:48, Rob Gaddi wrote: > > On Tue, 29 Sep 2015 10:16:04 +0530, Laxmikant Chitare wrote: > > > >> Hi, > >> > >> I know there is an elegant way to check if a given value is within > >> certain range. > >> Example - To check if x is

Re: Check if a given value is out of certain range

2015-09-29 Thread Mark Lawrence
On 29/09/2015 17:48, Rob Gaddi wrote: On Tue, 29 Sep 2015 10:16:04 +0530, Laxmikant Chitare wrote: Hi, I know there is an elegant way to check if a given value is within certain range. Example - To check if x is between zero and ten, I can do 0 < x 10. Is there any similar elegant way to chec

Re: [ANN] pythenv

2015-09-29 Thread Facundo Batista
On Tue, Sep 29, 2015 at 10:14 AM, wrote: > Pythenv runs a Python script creating a virtualenv on the fly. Requirements > may be passed as a requirements file or embedded in the Python script in a > dedicated comment: > > # requirements: foo==1.2.3, bar > > This project is on Github: > >

Re: Create a .lua fle from Python

2015-09-29 Thread Peter Otten
jmp wrote: > On 09/28/2015 11:41 PM, Ariel Argañaraz wrote: >> Hi, >> This is my first post, I would like to know if a library that can help >> me with this. >> >> >> I want to parse a XML fle with Python and save the data into a Lua table >> called for example "newTable", then I want to create a

Re: Check if a given value is out of certain range

2015-09-29 Thread Rob Gaddi
On Tue, 29 Sep 2015 10:16:04 +0530, Laxmikant Chitare wrote: > Hi, > > I know there is an elegant way to check if a given value is within > certain range. > Example - To check if x is between zero and ten, I can do 0 < x 10. > > Is there any similar elegant way to check if a value is out of cert

Re: Create a .lua fle from Python

2015-09-29 Thread jmp
On 09/28/2015 11:41 PM, Ariel Argañaraz wrote: Hi, This is my first post, I would like to know if a library that can help me with this. I want to parse a XML fle with Python and save the data into a Lua table called for example "newTable", then I want to create a "table.lua" fle with the "newTa

Re: Question re class variable

2015-09-29 Thread John Gordon
In alister writes: > why not simply use pythons builtin id function? > each new instance of an object is automatically assigned a unique ID It's only guaranteed to be unique for objects that exist at the same time. If an object is created and destroyed and then another new object is created,

Re: Issue: cannot successfully install Python 3 on Windows 7

2015-09-29 Thread Oscar Benjamin
On Tue, 29 Sep 2015 at 10:22 Gilad Mayani wrote: > Dear Python staff, > > I am trying to install the latest version of Python 3 on my machine, in > which I already have Python 2.7.3 installed. > I did this by downloading the installer from the 'Download Python 3.5.0' > button from https://www.pyt

Re: multiprocessing speedup

2015-09-29 Thread Oscar Benjamin
On Tue, 29 Sep 2015 at 02:22 Rita wrote: > I am using the multiprocessing with apply_async to do some work. Each task > takes a few seconds but I have several thousand tasks. I was wondering if > there is a more efficient method and especially when I plan to operate on a > large memory arrays (n

[ANN] pythenv

2015-09-29 Thread casa
Pythenv runs a Python script creating a virtualenv on the fly. Requirements may be passed as a requirements file or embedded in the Python script in a dedicated comment: # requirements: foo==1.2.3, bar This project is on Github: https://github.com/c4s4/pythenv Enjoy! -- https://mail.

Re: Issue: cannot successfully install Python 3 on Windows 7

2015-09-29 Thread Gisle Vanem
Gilad Mayani wrote: I always get this message: the program can't start because api-ms-win-crt-runtime-I1-1-0.dll is missing from your computer. Is that really an 'I' in there? The .dll should really be named: %SystemRoot%\system32\api-ms-win-crt-runtime-l1-1-0.dll with an lower-case '

Re: Question re class variable

2015-09-29 Thread Steven D'Aprano
On Tue, 29 Sep 2015 09:17 pm, Anssi Saari wrote: [...] >> The problem is that in python you can't change a class variable through >> an instance. The moment you try, you create an instance attribute. > > That much is clear but why does his other version of __gen_id() work > (after a fashion)? It

Re: Question re class variable

2015-09-29 Thread Antoon Pardon
Op 29-09-15 om 13:17 schreef Anssi Saari: > Antoon Pardon writes: > >> Op 29-09-15 om 11:27 schreef ple...@gmail.com: >>> I have a perplexing problem with Python 3 class variables. I wish to >>> generate an unique ID each time an instance of GameClass is >>> created. There are two versions of the

Re: Create a .lua fle from Python

2015-09-29 Thread Laura Creighton
In a message of Mon, 28 Sep 2015 18:41:09 -0300, Ariel Argañaraz writes: >Hi, >This is my first post, I would like to know if a library that can help me >with this. > > >I want to parse a XML fle with Python and save the data into a Lua table >called for example "newTable", then I want to create a

Re: Question re class variable

2015-09-29 Thread Anssi Saari
Antoon Pardon writes: > Op 29-09-15 om 11:27 schreef ple...@gmail.com: >> I have a perplexing problem with Python 3 class variables. I wish to >> generate an unique ID each time an instance of GameClass is >> created. There are two versions of the __gen_id method with test run >> results for each

Re: Question re class variable

2015-09-29 Thread jmp
On 09/29/2015 01:02 PM, jmp wrote: class GameObject: @property def id(self): return id(self) #use the builtin id function print GameObject().id Cheers, JM I should add that until you don't serialize your object you're fine. If you need to serialize it, you may want to look at h

Re: Question re class variable

2015-09-29 Thread jmp
On 09/29/2015 11:27 AM, ple...@gmail.com wrote: I have a perplexing problem with Python 3 class variables. Your problem is that when assigning values to your class attribute, you are actually creating a instance attribute. class Foo: bar = "I'm a class attribute" def __init__(self):

Re: Question re class variable

2015-09-29 Thread Antoon Pardon
Op 29-09-15 om 11:27 schreef ple...@gmail.com: > I have a perplexing problem with Python 3 class variables. I wish to generate > an unique ID each time an instance of GameClass is created. There are two > versions of the __gen_id method with test run results for each listed below > the code. Th

Re: Question re class variable

2015-09-29 Thread alister
On Tue, 29 Sep 2015 02:27:23 -0700, plewto wrote: > I have a perplexing problem with Python 3 class variables. I wish to > generate an unique ID each time an instance of GameClass is created. > There are two versions of the __gen_id method with test run results for > each listed below the code. >

Question re class variable

2015-09-29 Thread plewto
I have a perplexing problem with Python 3 class variables. I wish to generate an unique ID each time an instance of GameClass is created. There are two versions of the __gen_id method with test run results for each listed below the code. Originally I used the version which is now commented out

Issue: cannot successfully install Python 3 on Windows 7

2015-09-29 Thread Gilad Mayani
Dear Python staff, I am trying to install the latest version of Python 3 on my machine, in which I already have Python 2.7.3 installed. I did this by downloading the installer from the 'Download Python 3.5.0' button from https://www.python.org/downloads/. BTW, the installer installs the 32-bit Pyt

Re: Check if a given value is out of certain range

2015-09-29 Thread Chris Angelico
On Tue, Sep 29, 2015 at 2:46 PM, Laxmikant Chitare wrote: > Hi, > > I know there is an elegant way to check if a given value is within certain > range. > Example - To check if x is between zero and ten, I can do 0 < x 10. > > Is there any similar elegant way to check if a value is out of certain >

PY3.5 and nnumpy and scipy installation problem

2015-09-29 Thread Ek Esawi
Hi All again— Thanks to all who have provided excellent tips for installing Python, Numpy, Scipy, etc. Paul suggested the use Anaconda which proved to be the best and easiest way for me. If I may add I stumbled on an academic site that spells out in great details how to install Python, numpy, s

Check if a given value is out of certain range

2015-09-29 Thread Laxmikant Chitare
Hi, I know there is an elegant way to check if a given value is within certain range. Example - To check if x is between zero and ten, I can do 0 < x 10. Is there any similar elegant way to check if a value is out of certain range? Example - To check if x is either less than zero or greater than

Create a .lua fle from Python

2015-09-29 Thread Ariel Argañaraz
Hi, This is my first post, I would like to know if a library that can help me with this. I want to parse a XML fle with Python and save the data into a Lua table called for example "newTable", then I want to create a "table.lua" fle with the "newTable" write on it. for example: the XML fle: ci

Re: multiprocessing speedup

2015-09-29 Thread Peter Otten
Rita wrote: > I am using the multiprocessing with apply_async to do some work. Each task > takes a few seconds but I have several thousand tasks. I was wondering if > there is a more efficient method and especially when I plan to operate on > a > large memory arrays (numpy) > > Here is what I ha

Re: Dummy Decoder Example (was Re: Parallel decoding lesson for you.)

2015-09-29 Thread Skybuck Flying
Hello, (It is now 29 september 2015) As promised here is Skybuck's Parallel Universal Code demonstration program. This posting contains a Delphi and C/C++ version for you to learn from. (I was kinda thinking of adding some kind of case statement/array and out of order execution/randomization