numpy array operation

2013-01-29 Thread C. Ng
Is there a numpy operation that does the following to the array? 1 2 ==> 4 3 3 4 2 1 Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: numpy array operation

2013-01-29 Thread Peter Otten
C. Ng wrote: > Is there a numpy operation that does the following to the array? > > 1 2 ==> 4 3 > 3 4 2 1 How about >>> a array([[1, 2], [3, 4]]) >>> a[::-1].transpose()[::-1].transpose() array([[4, 3], [2, 1]]) Or did you mean >>> a.reshape((4,))[::-1].reshape((2,2)) ar

Re: Further evidence that Python may be the best language forever

2013-01-29 Thread Michael Poeltl
hi Stefan, * Stefan Behnel [2013-01-29 08:00]: > Michael Torrie, 29.01.2013 02:15: > > On 01/28/2013 03:46 PM, Malcolm McCrimmon wrote: > >> My company recently hosted a programming competition for schools > >> across the country. One team made it to the finals using the Python > >> client, one

Re: numpy array operation

2013-01-29 Thread Tim Williams
On Tuesday, January 29, 2013 3:41:54 AM UTC-5, C. Ng wrote: > Is there a numpy operation that does the following to the array? > > > > 1 2 ==> 4 3 > > 3 4 2 1 > > > > Thanks in advance. >>> import numpy as np >>> a=np.array([[1,2],[3,4]]) >>> a array([[1, 2], [3, 4]]) >>> np.

[os.path.join(r'E:\Python', name) for name in []] returns []

2013-01-29 Thread iMath
why [os.path.join(r'E:\Python', name) for name in []] returns [] ? please explain it in detail ! -- http://mail.python.org/mailman/listinfo/python-list

Re: [os.path.join(r'E:\Python', name) for name in []] returns []

2013-01-29 Thread Chris Angelico
On Wed, Jan 30, 2013 at 12:21 AM, iMath wrote: > why [os.path.join(r'E:\Python', name) for name in []] returns [] ? > please explain it in detail ! That's a list comprehension. If you're familiar with functional programming, it's like a map operation. Since the input list (near the end of the com

Re: [os.path.join(r'E:\Python', name) for name in []] returns []

2013-01-29 Thread Jean-Michel Pichavant
- Original Message - > why [os.path.join(r'E:\Python', name) for name in []] returns [] ? > please explain it in detail ! > -- > http://mail.python.org/mailman/listinfo/python-list > You're mapping an empty list. "for name in []" JM -- IMPORTANT NOTICE: The contents of this email an

Re: [os.path.join(r'E:\Python', name) for name in []] returns []

2013-01-29 Thread Steven D'Aprano
iMath wrote: > why [os.path.join(r'E:\Python', name) for name in []] returns [] ? Because you are iterating over an empty list, []. That list comprehension is the equivalent of: result = [] for name in []: result.append( os.path.join(r'E:\Python', name) ) Since you iterate over an empty

Re: [os.path.join(r'E:\Python', name) for name in []] returns []

2013-01-29 Thread Dave Angel
On 01/29/2013 08:21 AM, iMath wrote: why [os.path.join(r'E:\Python', name) for name in []] returns [] ? please explain it in detail ! [ os.path.join(r'E:\Python', name) for name in [] ] It'd be nice if you would explain what part of it bothers you. Do you know what a list comprehension is?

Re: environment fingerprint

2013-01-29 Thread Andrew Berg
On 2013.01.29 07:18, Jabba Laci wrote: > Hi, > > I have a script that I want to run in different environments: on > Linux, on Windows, on my home machine, at my workplace, in virtualbox, > etc. In each environment I want to use different configurations. For > instance the temp. directory on Linux

Re: Mixxx DJ app and Python

2013-01-29 Thread David Hutto
On Mon, Jan 28, 2013 at 10:10 AM, wrote: > > Hi guys, > > I am thinking of driving a DJ application from Python. > I am running Linux and I found the Mixxx app. > Does anyone know if there are python bindings, or if this is possible at all? > or does anyone have experience with another software t

Re: Mixxx DJ app and Python

2013-01-29 Thread David Hutto
On Tue, Jan 29, 2013 at 11:06 AM, David Hutto wrote: > On Mon, Jan 28, 2013 at 10:10 AM, wrote: >> >> Hi guys, >> >> I am thinking of driving a DJ application from Python. >> I am running Linux and I found the Mixxx app. >> Does anyone know if there are python bindings, or if this is possible at

Re: Mixxx DJ app and Python

2013-01-29 Thread David Hutto
>>> Does anyone know if there are python bindings, or if this is possible at >>> all? >>> or does anyone have experience with another software that does the same DJ >>> thing? >>> > >Hydrogen, and audacity work perfectly together. What I was about to do is take the mic, get the soundtrack/beat

Re: Mixxx DJ app and Python

2013-01-29 Thread David Hutto
On Tue, Jan 29, 2013 at 11:16 AM, David Hutto wrote: Does anyone know if there are python bindings, or if this is possible at all? or does anyone have experience with another software that does the same DJ thing? >> >>Hydrogen, and audacity work perfectly together. > >

Re: I have issues installing pycrypto (and thus fabric) with pip

2013-01-29 Thread Nicholas Kolatsis
Thanks. I've gotten everything working now. For anyone else who comes along, 'sudo apt-get install python-dev' did the job. > > Note that Fabric is useful for much, MUCH more than this. > I look forward to finding out :) > > Off-topic: why is your virtualenv/project name so weird? > Noted.

Re: Mixxx DJ app and Python

2013-01-29 Thread mikprog
On Tuesday, January 29, 2013 4:13:09 PM UTC, David Hutto wrote: [..] > > >> or does anyone have experience with another software that does the same DJ > >> thing? > > > > > Hydrogen, and audacity work perfectly together. Hi David, thanks for your reply. I am not sure though that this is goi

Re: Mixxx DJ app and Python

2013-01-29 Thread David Hutto
On Tue, Jan 29, 2013 at 11:18 AM, wrote: > On Tuesday, January 29, 2013 4:13:09 PM UTC, David Hutto wrote: > [..] >> >> >> or does anyone have experience with another software that does the same >> >> DJ thing? >> >> >> >> >> Hydrogen, and audacity work perfectly together. > > > Hi David, > than

Re: Mixxx DJ app and Python

2013-01-29 Thread Ben
This may not be too helpful, but I built a TCP server into the Mixxx application (in C++). I placed the server in ratecontroller (as I needed to vary the rate remotely). I then could send and receive TCP packets with a single board computer that ran a python client. It wasn't too bad. If you wa

Re: Mixxx DJ app and Python

2013-01-29 Thread David Hutto
On Tue, Jan 29, 2013 at 11:45 AM, Ben wrote: > This may not be too helpful, but I built a TCP server into the Mixxx > application (in C++). I placed the server in ratecontroller (as I needed to > vary the rate remotely). I then could send and receive TCP packets with a > single board computer t

Split string data have ","

2013-01-29 Thread moonhkt
Hi All Python 2.6.2 on AIX 5.3 How to using split o >>> y = '"abc.p,zip.p",a,b' >>> print y "abc.p,zip.p",a,b >>> >>> k= y.split(",") >>> print k[0] "abc.p >>> Need Result, First element is abc.p,zip.p -- http://mail.python.org/mailman/listinfo/python-list

Re: Mixxx DJ app and Python

2013-01-29 Thread mikprog
On Tuesday, January 29, 2013 4:45:18 PM UTC, Ben wrote: > This may not be too helpful, but I built a TCP server into the Mixxx > application (in C++). I placed the server in ratecontroller (as I needed to > vary the rate remotely). I then could send and receive TCP packets with a > single board

RE: Split string first data have ",

2013-01-29 Thread Nick Cash
> >>> y = '"abc.p,zip.p",a,b' > >>> print y > "abc.p,zip.p",a,b > >>> >>> x = "what is your question??" >>> print x I'm guessing that you want to split on ",", but want the quoted section to be a single token? Have you looked at the CSV module (http://docs.python.org/3/library/csv.html)? If my

Re: Mixxx DJ app and Python

2013-01-29 Thread mikprog
On Tuesday, January 29, 2013 4:42:07 PM UTC, David Hutto wrote: [..] > > Well you can just use their(Mixx's) source code that they used from > > another wav form manipulation library(more than likely), after the > > trigger from the bluetooth. If you're talking voice, and music to > > sync, the

Re: Split string data have ","

2013-01-29 Thread Tim Chase
On Tue, 29 moonhkt wrote: > >>> y = '"abc.p,zip.p",a,b' > >>> print y > "abc.p,zip.p",a,b > >>> > > >>> k= y.split(",") > >>> print k[0] > "abc.p > >>> > > Need Result, First element is > abc.p,zip.p The csv module should handle this nicely: >>> import csv >>> y = '"abc.p,zip.p",a,b' >>>

Re: Mixxx DJ app and Python

2013-01-29 Thread David Hutto
> Thanks David. > It seems that the code is in C++ so I should write Python wrappers myself, Or ctypes. which could be interesting, but given the time frame I have is just not possible, Pity :-( > However I was not going to transmit sounds, but just commands to mix the > sounds that are already i

Re: Split string data have ","

2013-01-29 Thread Chris Rebert
On Jan 29, 2013 9:05 AM, "moonhkt" wrote: > > Hi All > > Python 2.6.2 on AIX 5.3 > How to using split o > > >>> y = '"abc.p,zip.p",a,b' > >>> print y > "abc.p,zip.p",a,b > >>> > > >>> k= y.split(",") > >>> print k[0] > "abc.p > >>> > > Need Result, First element is > abc.p,zip.p Try the csv modul

Re: ] returns []

2013-01-29 Thread rusi
On Jan 29, 6:22 pm, iMath wrote: > 在 2013年1月29日星期二UTC+8下午9时21分16秒,iMath写道: > > > why [os.path.join(r'E:\Python', name) for name in []] returns [] ? please > > explain it in detail ! > >>> [os.path.join(r'E:\Python', name) for name in []] > > [] [Small algebra lesson] In algebra there is the conc

Re: Further evidence that Python may be the best language forever

2013-01-29 Thread Malcolm McCrimmon
Sure! I don't think we've publicly posted the teams' implementations, but the original client code is all up here--http://www.windward.net/codewar/2013_01/windwardopolis.php The issue with the original link may be if you're running Firefox--it's a Vimeo video, and I know they have some ongoing

Re: The best, friendly and easy use Python Editor.

2013-01-29 Thread rusi
On Jan 25, 10:35 pm, "Leonard, Arah" wrote: > >> It's just a text file after all. > > > True indeed, let's not worry about trivial issues like indentation, mixing > > tabs and spaces or whatever.  Notepad anybody? :) > > Hey, I didn't say Notepad was the *best* tool for the job, just that Python

Galry, a high-performance interactive visualization package in Python

2013-01-29 Thread Cyrille Rossant
Dear all, I'm making available today a first pre-release of Galry < http://rossant.github.com/galry/>, a BSD-licensed high performance interactive visualization toolbox in Python based on OpenGL. Its matplotlib-like high-level interface allows to interactively visualize plots with tens of millions

Re: numpy array operation

2013-01-29 Thread Alok Singhal
On Tue, 29 Jan 2013 00:41:54 -0800, C. Ng wrote: > Is there a numpy operation that does the following to the array? > > 1 2 ==> 4 3 > 3 4 2 1 > > Thanks in advance. How about: >>> import numpy as np >>> a = np.array([[1,2],[3,4]]) >>> a array([[1, 2], [3, 4]]) >>> a[::-1, ::-1]

Re: Galry, a high-performance interactive visualization package in Python

2013-01-29 Thread Terry Reedy
On 1/29/2013 1:23 PM, Cyrille Rossant wrote: The goal of this beta pre-release is to ensure that Galry can work on the widest possible range of systems and graphics cards (OpenGL v2+ is required). > From that site: "Mandatory dependencies include Python 2.7,"

Re: numpy array operation

2013-01-29 Thread Terry Reedy
On 1/29/2013 1:49 PM, Alok Singhal wrote: On Tue, 29 Jan 2013 00:41:54 -0800, C. Ng wrote: Is there a numpy operation that does the following to the array? 1 2 ==> 4 3 3 4 2 1 Thanks in advance. How about: import numpy as np a = np.array([[1,2],[3,4]]) a array([[1, 2], [3, 4]])

Quepy, transform questions in natural language into queries in a DB language using python

2013-01-29 Thread Elias Andrawos
We are sharing an open source framework that we made here at Machinalis: Quepy https://github.com/machinalis/quepy Quepy is a Python framework to transform questions in natural language into queries in a database language. It can be easily adapted to different types of questions in natural languag

GeoBases: data services and visualization

2013-01-29 Thread Alex
This new project provides tools to play with geographical data. It also works with non-geographical data, except for map visualizations :). There are embedded data sources in the project, but you can easily play with your own data in addition to the available ones. Files containing data about a

Ways to apply while learning....

2013-01-29 Thread agamal100
Hello, I am learning programming as a spare time hobby and learning python through codecademy. Today I have downloaded and installed aptana, and found out that although I have been progressing for some time now but I do not remember how to code and I have to look everything up. I want to know

Re: Ways to apply while learning....

2013-01-29 Thread David Hutto
On Tue, Jan 29, 2013 at 5:57 PM, wrote: > Hello, > I am learning programming as a spare time hobby and learning python through > codecademy. > > Today I have downloaded and installed aptana, and found out that although I > have been progressing for some time now but I do not remember how to cod

Re: environment fingerprint

2013-01-29 Thread Jabba Laci
Hi, Thanks for the tip. I came up with the solution below. For my purposes the short fingerprint is enough. Laszlo == import platform as p import uuid import hashlib def get_fingerprint(md5=False): """ Fingerprint of the current operating system/platform. If md5 is True, a digital fin

Re: environment fingerprint

2013-01-29 Thread Chris Angelico
On Wed, Jan 30, 2013 at 10:33 AM, Jabba Laci wrote: > if md5: > md5 = hashlib.md5() > md5.update(text) > return md5.hexdigest() Simpler: if md5: return hashlib.md5(text).hexdigest() ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: ] returns []

2013-01-29 Thread marty . musatov
MUSATOV -- http://mail.python.org/mailman/listinfo/python-list

Re: [os.path.join(r'E:\Python', name) for name in []] returns []

2013-01-29 Thread iMath
在 2013年1月29日星期二UTC+8下午9时33分26秒,Steven D'Aprano写道: > iMath wrote: > why [os.path.join(r'E:\Python', name) for name in []] returns > [] ? Because you are iterating over an empty list, []. That list > comprehension is the equivalent of: result = [] for name in []: > result.append( os.path.join(r'E:

Re: [os.path.join(r'E:\Python', name) for name in []] returns []

2013-01-29 Thread Chris Angelico
On Wed, Jan 30, 2013 at 12:56 PM, iMath wrote: > 在 2013年1月29日星期二UTC+8下午9时33分26秒,Steven D'Aprano写道: >> iMath wrote: > why [os.path.join(r'E:\Python', name) for name in []] returns >> [] ? Because you are iterating over an empty list, []. That list >> comprehension is the equivalent of: result = [

Re: Split string data have ","

2013-01-29 Thread moonhkt
On Jan 30, 1:08 am, Chris Rebert wrote: > On Jan 29, 2013 9:05 AM, "moonhkt" wrote: > > > > > > > > > > > > > Hi All > > > Python 2.6.2 on AIX 5.3 > > How to using split o > > > >>> y = '"abc.p,zip.p",a,b' > > >>> print y > > "abc.p,zip.p",a,b > > > >>> k= y.split(",") > > >>> print k[0] > > "abc

Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread Daniel W. Rouse Jr.
Hi all, I have recently started learning Python (2.7.3) but need a better explanation of how to use tuples and dictionaries. I am currently using "Learning Python" by Mark Lutz and David Ascher, published by O'Reilly (ISBN 1-56592-464-9)--but I find the explanations insufficient and the numb

Re: simple tkinter battery monitor

2013-01-29 Thread leonix . power
Thank you very much! fixed with w.after Here is the code, works under Linux for those who have acpi. My output of "acpi -V" is the following, the code is parsing the first line of the output. Any improvements are appreciated. > $ acpi -V > Battery 0: Discharging, 12%, 00:10:59 remaining > Battery

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread Chris Angelico
On Wed, Jan 30, 2013 at 1:55 PM, Daniel W. Rouse Jr. wrote: > I am currently using "Learning Python" by Mark Lutz and David Ascher, > published by O'Reilly (ISBN 1-56592-464-9)--but I find the explanations > insufficient and the number of examples to be sparse. I do understand some > ANSI C progra

struggling with these problems

2013-01-29 Thread su29090
1.Given that worst_offenders has been defined as a list with at least 6 elements, write a statement that defines lesser_offenders to be a new list that contains all the elements from index 5 of worst_offenders and beyond. Do not modify worst_offenders . I tried this but it didn't work: le

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread Daniel W. Rouse Jr.
"Chris Angelico" wrote in message news:mailman.1197.1359515470.2939.python-l...@python.org... On Wed, Jan 30, 2013 at 1:55 PM, Daniel W. Rouse Jr. wrote: I am currently using "Learning Python" by Mark Lutz and David Ascher, published by O'Reilly (ISBN 1-56592-464-9)--but I find the explanation

Re: Mixxx DJ app and Python

2013-01-29 Thread alex23
On Jan 29, 1:10 am, mikp...@gmail.com wrote: > I am thinking of driving a DJ application from Python. > I am running Linux and I found the Mixxx app. > Does anyone know if there are python bindings, or if this is possible at all? > or does anyone have experience with another software that does the

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread Chris Angelico
On Wed, Jan 30, 2013 at 2:42 PM, Daniel W. Rouse Jr. wrote: > "Chris Angelico" wrote in message > news:mailman.1197.1359515470.2939.python-l...@python.org... >> Have you checked out the online documentation at >> http://docs.python.org/ ? That might have what you're looking for. >> > I'll check t

Re: struggling with these problems

2013-01-29 Thread MRAB
On 2013-01-30 03:26, su29090 wrote: 1.Given that worst_offenders has been defined as a list with at least 6 elements, write a statement that defines lesser_offenders to be a new list that contains all the elements from index 5 of worst_offenders and beyond. Do not modify worst_offenders .

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread Mitya Sirenef
On 01/29/2013 09:55 PM, Daniel W. Rouse Jr. wrote: Hi all, > > I have recently started learning Python (2.7.3) but need a better explanation of how to use tuples and dictionaries. > > I am currently using "Learning Python" by Mark Lutz and David Ascher, published by O'Reilly (ISBN 1-56592-464

Re: struggling with these problems

2013-01-29 Thread Steven D'Aprano
On Wed, 30 Jan 2013 03:59:32 +, MRAB wrote: > Python uses half-open ranges (and counts from 0), which means that the > start index is included and the end index is excluded. > > Therefore, worst_offenders[5:6] means the slice from index 5 up to, but > excluding, index 6; in other words, an em

security quirk

2013-01-29 Thread RichD
I read Wall Street Journal, and occasionally check articles on their Web site. It's mostly free, with some items available to subscribers only. It seems random, which ones they block, about 20%. Anywho, sometimes I use their search utility, the usual author or title search, and it blocks, then I

Signal versus noise (was: security quirk)

2013-01-29 Thread Ben Finney
RichD writes: > Anywho, sometimes I use their search utility, the usual author > or title search, and it blocks, then I look it up on Google, and > link from there, and it loads! ok, Web gurus, what's going on? That evidently has nothing in particular to do with the topic of this forum: the Pyt

Re: security quirk

2013-01-29 Thread Rodrick Brown
On Tue, Jan 29, 2013 at 11:55 PM, RichD wrote: > I read Wall Street Journal, and occasionally check > articles on their Web site. It's mostly free, with some items > available to subscribers only. It seems random, which ones > they block, about 20%. > > Anywho, sometimes I use their search util

Re: security quirk

2013-01-29 Thread Chris Rebert
On Tue, Jan 29, 2013 at 8:55 PM, RichD wrote: > I read Wall Street Journal, and occasionally check > articles on their Web site. It's mostly free, with some items > available to subscribers only. It seems random, which ones > they block, about 20%. > > Anywho, sometimes I use their search utilit

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread John Gordon
In "Daniel W. Rouse Jr." writes: > I have recently started learning Python (2.7.3) but need a better > explanation of how to use tuples and dictionaries. A tuple is a linear sequence of items, accessed via subscripts that start at zero. Tuples are read-only; items cannot be added, removed, n

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread Daniel W. Rouse Jr.
"John Gordon" wrote in message news:keaa9v$1ru$1...@reader1.panix.com... In "Daniel W. Rouse Jr." writes: I have recently started learning Python (2.7.3) but need a better explanation of how to use tuples and dictionaries. A tuple is a linear sequence of items, accessed via subscripts tha

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread Chris Angelico
On Wed, Jan 30, 2013 at 5:14 PM, Daniel W. Rouse Jr. wrote: > To me, this looks like an array. Is tuple just the Python name for an array? Not quite. An array is closer to a Python list - a tuple can be thought of as a "frozen list", if you like. Lists can be added to, removed from, and changed i

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread Steven D'Aprano
On Tue, 29 Jan 2013 22:14:42 -0800, Daniel W. Rouse Jr. wrote: > "John Gordon" wrote in message > news:keaa9v$1ru$1...@reader1.panix.com... >> A tuple is a linear sequence of items, accessed via subscripts that >> start at zero. >> >> Tuples are read-only; items cannot be added, removed, nor rep