Re: Future of Pypy?

2015-02-23 Thread Chris Angelico
On Tue, Feb 24, 2015 at 5:56 PM, Steven D'Aprano wrote: > Most people are not using the bleeding edge version of Python, and even > those who do, aren't usually using it in production. There are still plenty > of people using Python 2.3 in production, and even a few using 1.5. > > But as you say,

Re: Future of Pypy?

2015-02-23 Thread Steven D'Aprano
Paul Rubin wrote: >> With threads in a single process, this isn't a problem. They all >> access the same memory space, so they can all share state. As soon as >> you go to separate processes, these considerations become serious. > > Right, that's a limitation of processes compared to threads. >

Re: Future of Pypy?

2015-02-23 Thread Steven D'Aprano
Chris Angelico wrote: > On Mon, Feb 23, 2015 at 6:41 PM, Steven D'Aprano > wrote: - and you must be using libraries and tools which prevent you moving to Jython or IronPython or some other alternative. >>> >>> I don't get this at all. Why should I not want Python to have the same >>> c

Re: Python shell: Arrow keys not working in PuTTY

2015-02-23 Thread Steven D'Aprano
Ned Deily wrote: > In article <54ebdcfa$0$11100$c3e8...@news.astraweb.com>, > Steven D'Aprano wrote: >> Almost right! >> >> You can install Python from source. Unzip the source tar ball, cd into >> the source directory, and run: >> >> ./configure >> make >> >> BUT do *not* run `make install`

Re: Are threads bad? - was: Future of Pypy?

2015-02-23 Thread Chris Angelico
On Tue, Feb 24, 2015 at 4:27 PM, Paul Rubin wrote: >> Sure, your code might not be making any mutations (that you know of), >> but malloc definitely is [1], and that's just the tip of the iceberg. >> Other things like buffers for stdin and stdout, DNS resolution etc. >> all have the same issue. >

Re: Are threads bad? - was: Future of Pypy?

2015-02-23 Thread Paul Rubin
Ryan Stuart writes: > I'm not sure what else to say really. It's just a fact of life that > Threads by definition run in the same memory space and hence always > have the possibility of nasty unforeseen problems. They are unforeseen > because it is extremely difficult (maybe impossible?) to try an

Re: Design thought for callbacks

2015-02-23 Thread Gregory Ewing
Cem Karan wrote: I tend to structure my code as a tree or DAG of objects. The owner refers to the owned object, but the owned object has no reference to its owner. With callbacks, you get cycles, where the owned owns the owner. This is why I suggested registering a listener object plus a meth

Re: Future of Pypy?

2015-02-23 Thread Paul Rubin
Chris Angelico writes: > So, you would have to pass code to the other process, probably. What > about this: > y = 4 > other_thread_queue.put(lambda x: x*y) the y in the lambda is a free variable that's a reference to the surrounding mutable context, so that's at best dubious. You could use:

Re: list storing variables

2015-02-23 Thread Steven D'Aprano
Ben Finney wrote: >> In C language, there is &A for address of A > > There is no “address of a value” concept in Python. You access a value > by some reference, either a name or an item in a collection. When a > reference changes to reference some different value, other references > are not affec

Re: Future of Pypy?

2015-02-23 Thread Steven D'Aprano
Ethan Furman wrote: > On 02/22/2015 11:41 PM, Steven D'Aprano wrote: > >> If you want *CPython* to work without a GIL, well, are you volunteering >> to do the work? It is a massive job, and the core devs aren't terribly >> interested. Probably because they understand that the GIL is not often an

Re: Python shell: Arrow keys not working in PuTTY

2015-02-23 Thread Steven D'Aprano
Laura Creighton wrote: > DO NOT REBUILD PYTHON ON CENTOS! > > It can break the whole package management system > which depends on having a particular version of python installed. > > If you are running Centos you need to use virtualenv to be safe. > > Laura Almost right! You can install Pyth

Re: new.py and having '.' in PYTHONPATH

2015-02-23 Thread Ian Kelly
On Mon, Feb 23, 2015 at 3:14 PM, Ethan Furman wrote: > On 02/23/2015 01:00 PM, Tobiah wrote: > >> Anyway, it raises the question as to whether having '.' in the >> PYTHONPATH is at all a sane thing to do. > > The current directory is added to sys.path /only/ for the interactive > interpreter. Wh

Re: Best practice: Sharing object between different objects

2015-02-23 Thread Ian Kelly
On Mon, Feb 23, 2015 at 1:02 PM, wrote: > What's REALLY interesting is that this happens: > import myModule myModule.myInt > 1 myModule.myInt = 2 myModule.myInt > 2 del myModule import myModule myModule.myInt > 2 > > I would REALLY expect that deleting the modul

Re: list storing variables

2015-02-23 Thread Marko Rauhamaa
Ian Kelly : > Obviously one can use any Turing-complete language to emulate features > of any other Turing-complete language, but I think the point is that > there is no syntactic support for it. While my "contribution" was made tongue-in-cheek, there's a grain of truth in every joke. First of a

Re: list storing variables

2015-02-23 Thread Chris Angelico
On Tue, Feb 24, 2015 at 6:06 AM, Marko Rauhamaa wrote: > What I'm saying is that there's nothing special about Python's object > model or variables. Guido could decide tomorrow to add a C-esque "&" > operator to Python without breaking a single existing Python program. > The Python compiler would

Re: list storing variables

2015-02-23 Thread Marko Rauhamaa
Peter Otten <__pete...@web.de>: > The OP explicitly mentions the & operator. There's no python analog to > that and the behavior shown below: > > $ cat pointers.c > #include > > int main() > { > int a = 2, b = 5; > int * Li[2] = { &a, &b }; > printf("%d %d\n", *Li[0], *Li[1]); > a = 3; >

Re: Best practice: Sharing object between different objects

2015-02-23 Thread Rob Gaddi
On Sat, 21 Feb 2015 04:15:50 -0800, pfranken85 wrote: > Hello! > > I have a best-practice question: Imagine I have several hardware devices > that I work with on the same I2C bus and I am using the python smbus > module for that purpose. The individual devices are sensors, ADC, DAC > components.

Well, that was a head scratcher...

2015-02-23 Thread Skip Montanaro
I've been reworking some of the code in the platform I use at work. I'm the sole developer/maintainer/hard-core user left, so I can pretty much do what I want with it (convert modules to Cython, delete no longer used modules, etc). The platform uses PyGtk, so we use signals and other features of t

Re: Concatenate list values

2015-02-23 Thread Andrew Berg
On 2015.02.23 09:58, loial wrote: > Is there a quick way to concatenate all the values in a list into a string, > except the first value? > > I want this to work with variable length lists. > > All values in list will be strings. > > Any help appreciated > The tutorial covers strings and lists

Re: Python Silent Install

2015-02-23 Thread Tim Golden
On 23/02/2015 15:29, Tim Golden wrote: > On 23/02/2015 13:57, Colin Atkinson wrote: >> I am deploying Python to hundreds of machines using SCCM 2012. I am >> using the below command to install: >> >> Msiexec /i “python.msi” TARGETDIR=”C:\Program Files\Python” >> ALLUSERS=1 /qn >> >> Even though I

Re: Future of Pypy?

2015-02-23 Thread Laura Creighton
Arrgh! I forgot to warn you that you need a very recent version of virtualenv to work with PyPy. I am very sorry about that. Glad to see that things are working now. Laura -- https://mail.python.org/mailman/listinfo/python-list

Re: Concatenate list values

2015-02-23 Thread John Gordon
In <12821378-62af-4954-8b61-aa0738c5f...@googlegroups.com> loial writes: > Is there a quick way to concatenate all the values in a list into a string, > except the first value? > I want this to work with variable length lists. > All values in list will be strings. > Any help appreciated big

Re: Concatenate list values

2015-02-23 Thread Tim Chase
On 2015-02-23 07:58, loial wrote: > Is there a quick way to concatenate all the values in a list into a > string, except the first value? > > I want this to work with variable length lists. > > All values in list will be strings. Using "".join(my_list[1:]) should work. If it is an arbitrary

Re: Concatenate list values

2015-02-23 Thread alister
On Mon, 23 Feb 2015 07:58:39 -0800, loial wrote: > Is there a quick way to concatenate all the values in a list into a > string, except the first value? > > I want this to work with variable length lists. > > All values in list will be strings. > > Any help appreciated ''.join(mylist[1:]) all

Re: Concatenate list values

2015-02-23 Thread Peter Otten
loial wrote: > Is there a quick way to concatenate all the values in a list into a > string, except the first value? > > I want this to work with variable length lists. > > All values in list will be strings. > > Any help appreciated >>> strings ['All', 'values', 'in', 'list', 'will', 'be', 's

Concatenate list values

2015-02-23 Thread loial
Is there a quick way to concatenate all the values in a list into a string, except the first value? I want this to work with variable length lists. All values in list will be strings. Any help appreciated -- https://mail.python.org/mailman/listinfo/python-list

Cython - was: Future of Pypy?

2015-02-23 Thread Stefan Behnel
Dave Farrance schrieb am 23.02.2015 um 15:13: > Dave Cook wrote: >> On 2015-02-22, Dave Farrance wrote: >> >>> It's still quicker to do a re-write in the more cumbersome C >> >> You should try Cython. > > I did try Cython when I was trying to figure out what to do about the slow > speed. My initi

Re: Python Silent Install

2015-02-23 Thread Tim Golden
On 23/02/2015 13:57, Colin Atkinson wrote: > I am deploying Python to hundreds of machines using SCCM 2012. I am > using the below command to install: > > Msiexec /i “python.msi” TARGETDIR=”C:\Program Files\Python” > ALLUSERS=1 /qn > > Even though I am using /qn, a command prompt still appears

RE: Python shell: Arrow keys not working in PuTTY

2015-02-23 Thread David Aldrich
Thanks for your replies, I will give readline a try. > PS: and you mention being on CentOS but running apt-get. I believe CentOS > and other Red-Hat based distros use "yum" instead of "apt-get" Yes, I think I need to use: yum install readline-devel Best regards David -- https://mail.python.o

Re: Question on asyncio

2015-02-23 Thread Jonas Wielicki
On 23.02.2015 14:27, Marko Rauhamaa wrote: > pfranke...@gmail.com: >> The corresponding call is a call to the python smbus library. It >> includes several sleeps (even though they are only about 50ms). >> Therefore I think it is worthwhile to encapsulate it into a coroutine. > > Maybe. Then you'll

Re: Python shell: Arrow keys not working in PuTTY

2015-02-23 Thread Tim Chase
On 2015-02-23 13:44, David Aldrich wrote: > I want to use the Python 3.4 interpreter interactively, via a PuTTY > ssh session. Python is running on Centos 5. > > Currently, the arrow keys do not work: [snip] > sudo apt-get install libreadline-dev > > followed by a rebuild of Python > > or > >

Re: Python shell: Arrow keys not working in PuTTY

2015-02-23 Thread Chris Angelico
On Tue, Feb 24, 2015 at 12:44 AM, David Aldrich wrote: > I want to use the Python 3.4 interpreter interactively, via a PuTTY ssh > session. Python is running on Centos 5. > > This stackoverflow thread: > > http://stackoverflow.com/questions/893053/python-shell-arrow-keys-do-not-work-on-remote-mac

Re: Future of Pypy?

2015-02-23 Thread Dave Farrance
Dave Cook wrote: >On 2015-02-22, Dave Farrance wrote: > >> It's still quicker to do a re-write in the more cumbersome C > >You should try Cython. I did try Cython when I was trying to figure out what to do about the slow speed. My initial attempt showed no speedup at all. The documentation to

Re: Future of Pypy?

2015-02-23 Thread Dave Farrance
Laura Creighton wrote: >Good news -- it seems to be working fine with PyPy. >https://travis-ci.org/hugovk/Pillow/builds > >for me, not extensively tested, it just seems to be working. > >I have several pypy's floating around here, each within its own >virtualenv. If you aren't familiar with vir

Python Silent Install

2015-02-23 Thread Colin Atkinson
Hi, I am deploying Python to hundreds of machines using SCCM 2012. I am using the below command to install: Msiexec /i "python.msi" TARGETDIR="C:\Program Files\Python" ALLUSERS=1 /qn Even though I am using /qn, a command prompt still appears at the end of the install for about 5-6 seconds. I

Re: list storing variables

2015-02-23 Thread Marko Rauhamaa
"ast" : > Is there a way to define a container object able to store some > variables so that a change of a variable make a change in this object > content ? > > I dont need this feature. It is just something I am thinking about. > > In C language, there is &A for address of A In Python, you can a

Python shell: Arrow keys not working in PuTTY

2015-02-23 Thread David Aldrich
Hi I want to use the Python 3.4 interpreter interactively, via a PuTTY ssh session. Python is running on Centos 5. Currently, the arrow keys do not work: $ /usr/local/bin/python3.4 Python 3.4.2 (default, Feb 11 2015, 15:06:33) [GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux Type "help", "copy

Re: Standard

2015-02-23 Thread jkn
On Sunday, 22 February 2015 14:11:54 UTC, Mark Lawrence wrote: > On 19/02/2015 16:27, Phillip Fleming wrote: > > In my opinion, Python will not take off like C/C++ if there is no ANSI > > standard. > > > > Python has already taken off because it doesn't have a standard as such. > Bjarne Stroust

Re: Design thought for callbacks

2015-02-23 Thread Steven D'Aprano
Cem Karan wrote: > > On Feb 21, 2015, at 12:27 PM, Steven D'Aprano > wrote: >> The simplest possible identity-based scheme would be something like this: >> >> >> # don't hate me for using a global variable >> CALLBACKS = [] >> >> def register(func): >>if func not in CALLBACKS: >>

Re: Question on asyncio

2015-02-23 Thread Marko Rauhamaa
pfranke...@gmail.com: > Hello Marko! > > Am Sonntag, 22. Februar 2015 22:21:55 UTC+1 schrieb Marko Rauhamaa: >> In asyncio, you typically ignore the value returned by yield. While >> generators use yield to communicate results to the calling program, >> coroutines use yield only as a "trick" to im

Re: list storing variables

2015-02-23 Thread Dave Angel
On 02/23/2015 07:55 AM, ast wrote: hi a = 2; b = 5 Li = [a, b] Li [2, 5] a=3 Li [2, 5] Ok, a change in a or b doesn't impact Li. This works as expected Is there a way to define a container object able to store some variables so that a change of a variable make a change in this object c

list storing variables

2015-02-23 Thread ast
hi a = 2; b = 5 Li = [a, b] Li [2, 5] a=3 Li [2, 5] Ok, a change in a or b doesn't impact Li. This works as expected Is there a way to define a container object able to store some variables so that a change of a variable make a change in this object content ? I dont need this feature

Re: bufsize must be an integer in subprocess.Popen

2015-02-23 Thread Chris Angelico
On Mon, Feb 23, 2015 at 11:13 PM, Robert Clove wrote: > proc1=subprocess.Popen("/root/Desktop/abc.py","64","abc",shell=True,stdout=subprocess.PIPE, > stderr=subprocess.PIPE) As others have said, you need to use either a single command or a list of strings. But why are you using shell=True here? Y

Re: bufsize must be an integer in subprocess.Popen

2015-02-23 Thread INADA Naoki
> Hi, the parameter list should be a list of strings, not several unpacked > strings : > > command = ["/root/Desktop/abc.py","64","abc"] > proc1 = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, > stderr=subprocess.PIPE) > The first argument is list of string only when `shell

Re: bufsize must be an integer in subprocess.Popen

2015-02-23 Thread Shgck
On 23/02/2015 13:13, Robert Clove wrote: Hi All, I am using the Linux system with python, i am running the following script #!/usr/bin/python import threading import time import sys import subprocess import datetime import os import time import logging proc1=subprocess.Popen("/root/Des

Re: Design thought for callbacks

2015-02-23 Thread Frank Millman
"Cem Karan" wrote in message news:a3c11a70-5846-4915-bb26-b23793b65...@gmail.com... > > > Good questions! That was why I was asking about 'gotchas' with WeakSets > originally. Honestly, the only way to know for sure would be to write two > APIs for doing similar things, and then see how peop

Re: bufsize must be an integer in subprocess.Popen

2015-02-23 Thread INADA Naoki
When `shell=True`, the first argument should be string passed to shell. So you should: proc1=subprocess.Popen("/root/Desktop/abc.py 64 abc", shell=True,stdout=subprocess.PIPE, stderr=subprocess.PIPE) On Mon, Feb 23, 2015 at 9:13 PM, Robert Clove wrote: > Hi All, > > I am using the Linux sys

bufsize must be an integer in subprocess.Popen

2015-02-23 Thread Robert Clove
Hi All, I am using the Linux system with python, i am running the following script #!/usr/bin/python import threading import time import sys import subprocess import datetime import os import time import logging proc1=subprocess.Popen("/root/Desktop/abc.py","64","abc",shell=True,stdout=su

Re: Design thought for callbacks

2015-02-23 Thread Cem Karan
On Feb 22, 2015, at 5:29 PM, Laura Creighton wrote: > In a message of Sun, 22 Feb 2015 17:09:01 -0500, Cem Karan writes: > >> Documentation is a given; it MUST be there. That said, documenting >> something, but still making it surprising, is a bad idea. For >> example, several people have bee

Re: Future of Pypy?

2015-02-23 Thread Dave Cook
On 2015-02-22, Dave Farrance wrote: > It's still quicker to do a re-write in the more cumbersome C You should try Cython. Dave -- https://mail.python.org/mailman/listinfo/python-list

Re: Unrecognized backslash escapes in string literals

2015-02-23 Thread Serhiy Storchaka
On 23.02.15 04:55, Chris Angelico wrote: I agree, the fault is primarily with Windows. But I've seen similar issues when people use /-\| for box drawing and framing and such; Windows paths are by far the most common case of this, but not the sole. There is also issues with regular expressions.

Re: Question on asyncio

2015-02-23 Thread pfranken85
Hello Marko! Am Sonntag, 22. Februar 2015 22:21:55 UTC+1 schrieb Marko Rauhamaa: > In asyncio, you typically ignore the value returned by yield. While > generators use yield to communicate results to the calling program, > coroutines use yield only as a "trick" to implement cooperative > multitask

Re: Future of Pypy?

2015-02-23 Thread Chris Angelico
On Mon, Feb 23, 2015 at 6:41 PM, Steven D'Aprano wrote: >>> - and you must be using libraries and tools which prevent you moving to >>> Jython or IronPython or some other alternative. >> >> I don't get this at all. Why should I not want Python to have the same >> capabilities? > > Python does hav

Re: Unrecognized backslash escapes in string literals

2015-02-23 Thread Peter Otten
Ben Finney wrote: > Chris Angelico writes: > >> That said, though, there's probably a lot of code out there that >> depends on backslashes being non-special, so it's quite probably >> something that can't be changed. But it'd be nice to be able to turn >> on a warning for it. > > If you're moti

Re: Future of Pypy?

2015-02-23 Thread Marko Rauhamaa
Steven D'Aprano : > Yes, but my point is that if some other way solves the problem, then > you should *use that other technique* rather than complain about the > GIL. The GIL is not a bottleneck if you can bypass it. > > I can sympathize with somebody who says "I have this problem that can > only