From xahlee at gmail.com Tue Mar 1 00:04:57 2011 From: xahlee at gmail.com (Xah Lee) Date: Mon, 28 Feb 2011 21:04:57 -0800 (PST) Subject: Problems of Symbol Congestion in Computer Languages References: <0124dbef-4362-4051-a987-40ae3e123de6@b15g2000pra.googlegroups.com> <1e2ab1db-e19d-40bf-9561-20d59a6e33e5@18g2000prd.googlegroups.com> Message-ID: <89d2429f-b00b-4d34-bea3-d908d697bea4@y36g2000pra.googlegroups.com> On Feb 28, 7:30?pm, rusi wrote: > On Feb 28, 11:39?pm, Dotan Cohen wrote: > > > You miss the canonical bad character reuse case: = vs ==. > > > Had there been more meta keys, it might be nice to have a symbol for > > each key on the keyboard. I personally have experimented with putting > > the symbols as regular keys and the numbers as the Shifted versions. > > It's great for programming. > > Hmmm... Clever! > Is it X or Windows? > Can I have your setup? hi Russ, there's a programer's dvorak layout i think is bundled with linux. or you can do it with xmodmap on X-11 or AutoHotKey on Windows, or within emacs... On the mac, you can use keyboardMaestro, Quickeys, or just write a os wide config file yourself. You can see tutorials and sample files for all these here http://xahlee.org/Periodic_dosage_dir/keyboarding.html i'd be interested to know what Dotan Cohen use too. i tried the swapping number row with symbols a few years back. didn't like it so much because numbers are frequently used as well, especially when you need to enter a series of numbers. e.g. heavy math, or dates 2010-02-28. One can use the number pad but i use that as extra programable buttons. Xah > One problem we programmers face is that keyboards were made for > typists not programmers. > Another is that when we move from 'hi-level' questions eg code reuse > -- to lower and lower -- eg ergonomics of reading and writing code -- > the focus goes from the center of consciousness to the periphery and > we miss how many inefficiencies there are in our semi-automatic > actions. From stefan_ml at behnel.de Tue Mar 1 01:37:39 2011 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 01 Mar 2011 07:37:39 +0100 Subject: Idea for removing the GIL... In-Reply-To: References: <7d3a67ba-b5ff-4b11-95b5-71f041dfc63a@o7g2000prn.googlegroups.com> <4d519e64$0$10557$742ec2ed@news.sonic.net> Message-ID: Aahz, 01.03.2011 03:02: > Carl Banks wrote: >> >> The real reason they never replaced the GIL is that fine-grained >> locking is expensive with reference counting. The only way the cost >> of finer-grained locking would be acceptable, then, is if they got rid >> of the reference counting altogether, and that was considered too >> drastic a change. > > ...especially given CPython's goal of easy integration with C libraries. +1, the GIL is much more rarely a problem than some people want to make it appear. Especially those who don't understand why it's there, or who fail to notice that threading is not the only way to do parallel processing (and certainly not the easiest either). Stefan From roberto.inzerillo at gmail.com Tue Mar 1 02:57:10 2011 From: roberto.inzerillo at gmail.com (Robi) Date: Mon, 28 Feb 2011 23:57:10 -0800 (PST) Subject: Problems with read_eager and Telnet References: <7eddab85-af16-4994-9d63-aba2bb59b8ce@z31g2000vbs.googlegroups.com> Message-ID: <72687d0d-c0a3-41bb-a617-2e091062c465@p11g2000vbq.googlegroups.com> > > My conclusion being, fgfs cannot answer back quicker than this: 20Hz. > > I suspect that is by design, so as to not interfere with the simulation > itself. Actually it's not quite like that. I talked about it in flightgear-devel mailing list; I was told FGFS default telnet polling frequency is 5Hz (but it's nowhere documented than in the source code). I had extremely low interaction at first, slower than what I get now. Increasing this frequency to 120Hz gave me those results I was talking about in the previous posts; I got increasing speed but with my (quite crude) benchmark it never goes over a real 20Hz as stated, it doesn't reach those 120Hz set at hand by me. But there is no cap at 20Hz set by design in FlightGear, not that I'm aware of. I'm going to dig into some other communication media to talk to FlightGear and leave Telnet for those cases where such a lag is acceptable. From erikd at mega-nerd.com Tue Mar 1 03:43:43 2011 From: erikd at mega-nerd.com (Erik de Castro Lopo) Date: Tue, 1 Mar 2011 19:43:43 +1100 Subject: OT: Code Examples References: Message-ID: <20110301194343.bc0a72e7.erikd@mega-nerd.com> Fred Marshall wrote: > I'm interested in developing Python-based programs, including an > engineering app. ... re-writing from Fortran and C versions. One of the > objectives would to be make reasonable use of the available structure > (objects, etc.). So, I'd like to read a couple of good, simple > scientific-oriented programs that do that kind of thing. Why Python? I really can't understand the rush of every man and his dog to Python. Its not that I'm a stick in the mud stuck with C and C++, rather that I used Python for a number of years from 1998 to 2004 and rejected it in favour of strict statically typed functional langauges like Ocaml and Haskell. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ From dotancohen at gmail.com Tue Mar 1 04:13:39 2011 From: dotancohen at gmail.com (Dotan Cohen) Date: Tue, 1 Mar 2011 11:13:39 +0200 Subject: Problems of Symbol Congestion in Computer Languages In-Reply-To: <1e2ab1db-e19d-40bf-9561-20d59a6e33e5@18g2000prd.googlegroups.com> References: <0124dbef-4362-4051-a987-40ae3e123de6@b15g2000pra.googlegroups.com> <1e2ab1db-e19d-40bf-9561-20d59a6e33e5@18g2000prd.googlegroups.com> Message-ID: On Tue, Mar 1, 2011 at 05:30, rusi wrote: >> Had there been more meta keys, it might be nice to have a symbol for >> each key on the keyboard. I personally have experimented with putting >> the symbols as regular keys and the numbers as the Shifted versions. >> It's great for programming. > > Hmmm... Clever! > Is it X or Windows? > Can I have your setup? > It's X, on Kubuntu. I've since "destroyed" that layout, but you can easily play around in /usr/share/X11/xkb/symbols/us or whichever layout you prefer. I am working on another one, though, actually I just stared working on it yesterday. It's currently broken (I'm in the middle of troubleshooting it) but you can see what I currently have here: http://dotancohen.com/eng/keyboard_layout.html > One problem we programmers face is that keyboards were made for > typists not programmers. Yes, I'm trying to solve that! Ideally in the end all the brackets including {} won't need modifier keys. Give me some feedback, please, on that layout. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com From dotancohen at gmail.com Tue Mar 1 04:19:42 2011 From: dotancohen at gmail.com (Dotan Cohen) Date: Tue, 1 Mar 2011 11:19:42 +0200 Subject: Problems of Symbol Congestion in Computer Languages In-Reply-To: <89d2429f-b00b-4d34-bea3-d908d697bea4@y36g2000pra.googlegroups.com> References: <0124dbef-4362-4051-a987-40ae3e123de6@b15g2000pra.googlegroups.com> <1e2ab1db-e19d-40bf-9561-20d59a6e33e5@18g2000prd.googlegroups.com> <89d2429f-b00b-4d34-bea3-d908d697bea4@y36g2000pra.googlegroups.com> Message-ID: On Tue, Mar 1, 2011 at 07:04, Xah Lee wrote: > hi Russ, > > there's a programer's dvorak layout i think is bundled with linux. > > or you can do it with xmodmap on X-11 or AutoHotKey on Windows, or > within emacs... On the mac, you can use keyboardMaestro, Quickeys, or > just write a os wide config file yourself. You can see tutorials and > sample files for all these here http://xahlee.org/Periodic_dosage_dir/keyboarding.html > > i'd be interested to know what Dotan Cohen use too. > You can see what I started working on yesterday, but it's far from finished: http://dotancohen.com/eng/keyboard_layout.html I tried reaching you on Skype yesterday, Xah, but I think that you blocked me suspecting that I may be a bot. Try to Skype-chat with me at user "dotancohen", I think that we can help each other. > i tried the swapping number row with symbols a few years back. didn't > like it so much because numbers are frequently used as well, > especially when you need to enter a series of numbers. e.g. heavy > math, or dates 2010-02-28. One can use the number pad but i use that > as extra programable buttons. > I don't like the number pad so I'm looking for another solution. I wired up a spring-off lightswitch to the Shift key and I operate it with my foot. It's great but it only works when I'm home: it is too ridiculous to take with me. I'm wiring up two more for Ctrl an Alt, too bad it's too cumbersome to have ESC, Enter, and Backspace there as well. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com From richarddobson at blueyonder.co.uk Tue Mar 1 04:24:53 2011 From: richarddobson at blueyonder.co.uk (Richard Dobson) Date: Tue, 01 Mar 2011 09:24:53 +0000 Subject: OT: Code Examples In-Reply-To: <20110301194343.bc0a72e7.erikd@mega-nerd.com> References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> Message-ID: <5W2bp.38551$5X6.37953@newsfe20.ams2> On 01/03/2011 08:43, Erik de Castro Lopo wrote: > Fred Marshall wrote: > >> I'm interested in developing Python-based programs, including an >> engineering app. ... re-writing from Fortran and C versions. One of the >> objectives would to be make reasonable use of the available structure >> (objects, etc.). So, I'd like to read a couple of good, simple >> scientific-oriented programs that do that kind of thing. > > Why Python? I really can't understand the rush of every man and > his dog to Python. > > Its not that I'm a stick in the mud stuck with C and C++, rather > that I used Python for a number of years from 1998 to 2004 and > rejected it in favour of strict statically typed functional > langauges like Ocaml and Haskell. > My understanding is/was that Guido originally proposed Python as the replacement for BASIC; i.e. to be the new first language students at school would be exposed to. So rather than compare it to C and C++, I suppose one should, strategically speaking, compare it to Visual Basic and/or Java. The other aspect is purely pragmatic - it has bindings for tk, MIDI and audio (and of course Csound as you know), which adds up to a fairly hefty scripting package complete with GUI design options - great for "knocking up stuff quickly". But - I am ~still~ caught out by the semantic significance of indenting. Looks OK enough on paper, but doing it interactively is another matter. Richard Dobson From fpfeifer at hs.uni-hamburg.de Tue Mar 1 04:57:17 2011 From: fpfeifer at hs.uni-hamburg.de (sirvival) Date: Tue, 1 Mar 2011 01:57:17 -0800 (PST) Subject: question about numpy.polyval References: Message-ID: On 28 Feb., 17:15, Robert Kern wrote: > On 2/28/11 9:34 AM, sirvival wrote: > > > Hi, > > I have some simulated data of stellar absorption lines. > > You will want to ask numpy questions on the numpy mailing list: > > ? ?http://www.scipy.org/Mailing_Lists > > It would be best if you could make a minimal, self-contained, runnable script > that demonstrates your problem. I.e. provide x and y arrays that show the > problem; all the details about chunking and such are just getting in the way. > Please state what results you expect in addition to the results you got; you > show plots but don't show exactly what you plotted. I have no idea what you were > expecting to get. Make sure you use variable names consistently. For example, > you refer to a "plot of fita", but nothing in your code assigns to "fita". > > Thanks. > > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, a harmless enigma > ? that is made terrible by our own mad attempt to interpret it as though it had > ? an underlying truth." > ? ?-- Umberto Eco Hi, ok I will ask my question (modified with your sugestions) on the numpy mailing list. I just started using python last week, so I am sure my code looks confusion. Sorry about that. Thanks From no.email at nospam.invalid Tue Mar 1 05:01:30 2011 From: no.email at nospam.invalid (Paul Rubin) Date: Tue, 01 Mar 2011 02:01:30 -0800 Subject: OT: Code Examples References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> Message-ID: <7xei6rqhvp.fsf@ruckus.brouhaha.com> Erik de Castro Lopo writes: > Why Python? I really can't understand the rush of every man and > his dog to Python. Are you trolling? Anyway, try googling "evil mangler" and ask why it wasn't done in Haskell. Same idea. From freethinker at pobox.com Tue Mar 1 05:14:18 2011 From: freethinker at pobox.com (Tom Zych) Date: Tue, 01 Mar 2011 05:14:18 -0500 Subject: OT: Code Examples In-Reply-To: <20110301194343.bc0a72e7.erikd@mega-nerd.com> References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> Message-ID: <4D6CC6FA.30505@pobox.com> Erik de Castro Lopo wrote: > Why Python? I really can't understand the rush of every man and > his dog to Python. > Its not that I'm a stick in the mud stuck with C and C++, rather > that I used Python for a number of years from 1998 to 2004 and > rejected it in favour of strict statically typed functional > langauges like Ocaml and Haskell. Hmm, if we abused this guy enough for his heresy, do you think he'd say he didn't expect the Spanish Inquisition? Then we could riff on that theme for days :-D -- Tom Zych / freethinker at pobox.com Quidquid latine dictum sit, altum viditur. From jeanmichel at sequans.com Tue Mar 1 05:19:00 2011 From: jeanmichel at sequans.com (Jean-Michel Pichavant) Date: Tue, 01 Mar 2011 11:19:00 +0100 Subject: subclass urllib2 In-Reply-To: References: Message-ID: <4D6CC814.3090700@sequans.com> monkeys paw wrote: > I'm trying to subclass urllib2 in order to mask the > version attribute. Here's what i'm using: > > import urllib2 > > class myURL(urllib2): > def __init__(self): > urllib2.__init__(self) > self.version = 'firefox' > > I get this> > Traceback (most recent call last): > File "", line 1, in > TypeError: Error when calling the metaclass bases > module.__init__() takes at most 2 arguments (3 given) > > I don't see where i am supplying 3 arguments. What am i > missing? > Don't steal firefox's idendity to screen-scrap Wikipedia :p JM From mdekauwe at gmail.com Tue Mar 1 05:35:09 2011 From: mdekauwe at gmail.com (Martin De Kauwe) Date: Tue, 1 Mar 2011 02:35:09 -0800 (PST) Subject: OT: Code Examples References: Message-ID: <5ab78afa-b86a-4c39-a153-e7ff52c88d24@o21g2000prn.googlegroups.com> On Mar 1, 3:03?am, Fred Marshall wrote: > I'm interested in developing Python-based programs, including an > engineering app. ... re-writing from Fortran and C versions. ?One of the > objectives would to be make reasonable use of the available structure > (objects, etc.). ?So, I'd like to read a couple of good, simple > scientific-oriented programs that do that kind of thing. > > Looking for links, etc. > > Fred you could try searching here http://pypi.python.org/pypi. I had a look for models, but didn't find anything in particular. But would be really useful if anyone does know of some good examples From jeanmichel at sequans.com Tue Mar 1 05:36:29 2011 From: jeanmichel at sequans.com (Jean-Michel Pichavant) Date: Tue, 01 Mar 2011 11:36:29 +0100 Subject: how to properly pass literal strings python code to be executed using python -c In-Reply-To: <47cdd15f-85a7-4b27-a3ea-31ffba020e05@18g2000prd.googlegroups.com> References: <47cdd15f-85a7-4b27-a3ea-31ffba020e05@18g2000prd.googlegroups.com> Message-ID: <4D6CCC2D.20900@sequans.com> jmoons wrote: > I need some help figuring out how to execute this python code from > python -c > I am have trouble formatting python so that it will execute for > another app in cmd I understand there maybe other ways to do what I am > doing but I am limited by the final execution using cmd python -c so > please keep this in mind. > I'm limited by the final delivery of code. The python is being called > by a server that does not have access to any python script file > Why ? You are about to delete a whole directory tree on that ser ver and cannot write a simple python file ? > So I have some python code ie, > > import os > import shutil > > myPath =r"C:\dingdongz" > for root, dirs, files in os.walk(myPath): > for file in files: > os.remove(os.path(root, file)) > for dir in dirs: > shutil.rmtree(os.path.join(root,dir)) > > But I am trying to excute it using the following method, python -c > "print 'hotdogs'" > > So this what i have but no worky > > cmdline = "\" import os, shutil \n for root, dirs, files in > os.walk("+myPath+"):\n \t for file in files: \n \t \t > os.remove(os.path.join(root, file)) \n \t for dir in dirs: \n \t\t > shutil.rmtree(os.path.join(root, dir))" > > > I have also tried the following > python -c "import os; import shutil; for root, dirs, files in > os.walk('+myPath+'): for file in files: os.remove(os.path.join(root, > file)); for dir in dirs: shutil.rmtree(os.path.join(root, dir))" > > I am still getting error tree(os.path.join(root, dir)) ^ SyntaxError: > invalid syntax > I don't understand exactly what you want to do... Anyway ... 1/ Your 'application' is running on the server, it has then access to the file system and can write python file => problem solved. 2/ Your 'application' is local and sends python code to the server => write a local python file, that uses the module 'execnet' to execute remote python code on the server. See http://codespeak.net/execnet/ JM From wxjmfauth at gmail.com Tue Mar 1 05:40:02 2011 From: wxjmfauth at gmail.com (jmfauth) Date: Tue, 1 Mar 2011 02:40:02 -0800 (PST) Subject: Python 3.2 is excellent, but Message-ID: <80e44539-c015-491c-9189-62503e6ef15a@k18g2000vbq.googlegroups.com> Well, Python (as 3.2) has never reached this level of excellence, but __pycache__, no, not for me. (I feel better now, after I wrote it.) From romap at libero.it Tue Mar 1 05:57:13 2011 From: romap at libero.it (romap at libero.it) Date: Tue, 1 Mar 2011 02:57:13 -0800 (PST) Subject: psycopg2 insertion and reading binary data to PostgreSQL database (bytea datatype) Message-ID: Hello. This is the full work version. Do yuo have: - Pyton, PostgreSQL, Psycopg2 - PostgreSQL dababase named "MyDATABASE" with table named "phonebook" - Table "phonebook" have this columns: "lastname" [TEXT datatype] and "c2image" [BYTEA datatype] - Do you have an jpeg file named "sun.jpg" on c:/ Open db connection >>> import psycopg2 >>> conn_string = "host='localhost' dbname='MyDATABASE' user='MyUSER' password='MyPASSWORD'" >>> conn = psycopg2.connect(conn_string) Write image on database (binary data on bytea column) >>> mypic=open('c:/sun.jpg','rb').read() >>> cursor = conn.cursor() >>> cursor.execute("INSERT INTO phonebook(lastname,c2image) VALUES (%s,%s);", ('MyPICTURENAME', psycopg2.Binary(mypic))) >>> conn.commit() Read image from database and write to a file >>> cursor = conn.cursor() >>> cursor.execute("SELECT (c2image) FROM phonebook WHERE lastname='MyPICTURENAME';") >>> mypic2 = cursor.fetchone() >>> open('c:/copyofsun.jpg', 'wb').write(str(mypic2[0])) Close db connection >>> cursor.close() >>> conn.close() From stefan_ml at behnel.de Tue Mar 1 06:10:36 2011 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 01 Mar 2011 12:10:36 +0100 Subject: Python 3.2 is excellent, but In-Reply-To: <80e44539-c015-491c-9189-62503e6ef15a@k18g2000vbq.googlegroups.com> References: <80e44539-c015-491c-9189-62503e6ef15a@k18g2000vbq.googlegroups.com> Message-ID: jmfauth, 01.03.2011 11:40: > __pycache__, no, not for me. This has been discussed before. The 'argument' you presented is usually due to a misunderstanding of how __pycache__ works. Consider reading the PEP. Stefan From freethinker at pobox.com Tue Mar 1 06:15:04 2011 From: freethinker at pobox.com (Tom Zych) Date: Tue, 01 Mar 2011 06:15:04 -0500 Subject: Python 3.2 is excellent, but In-Reply-To: <80e44539-c015-491c-9189-62503e6ef15a@k18g2000vbq.googlegroups.com> References: <80e44539-c015-491c-9189-62503e6ef15a@k18g2000vbq.googlegroups.com> Message-ID: <4D6CD538.20206@pobox.com> jmfauth wrote: > Well, Python (as 3.2) has never reached this level of excellence, but > __pycache__, no, not for me. > > (I feel better now, after I wrote it.) Could you be more specific? :) -- Tom Zych / freethinker at pobox.com Quidquid latine dictum sit, altum viditur. From sansal.birbas at alarko-carrier.com.tr Tue Mar 1 07:05:54 2011 From: sansal.birbas at alarko-carrier.com.tr (=?iso-8859-9?Q?=DEansal_Birba=FE?=) Date: Tue, 1 Mar 2011 14:05:54 +0200 Subject: I cant import my function from compiled cython module. Message-ID: <037E8A8F0CEE0C4F9EC98037D9A9AE031FE4BDD8E8@acsmrexc01.ac.st> Hi All, I needed to improve the computation speed of my numpy algorithm which works correctly with cython. So I created a .pyx file like belows and then compiled to a .pyd file successfully: ***************************************************************************?*************************************** import numpy cimport cython cimport numpy as np DTYPE = np.int ctypedef np.int_t DTYPE_t @cython.boundscheck(False) @cython.wraparound(False) def CombiHesapla4(np.ndarray[DTYPE_t, ndim=1] X, np.ndarray[DTYPE_t, ndim=1] Y, np.ndarray[DTYPE_t, ndim=1] Z, np.ndarray[DTYPE_t, ndim=1] T, np.ndarray[DTYPE_t, ndim=1] W, np.ndarray[DTYPE_t, ndim=1] istenen, unsigned int max_expander): cdef int kalanUO=0 cdef int m_UI cdef int m_UO cdef int m_AO cdef int m_BO cdef int i_AI cdef int i_AO cdef int i_BI cdef int i_BO cdef long fiyat cdef int possible_max_exp_number cdef int possible_max_exp combo=[] row=[] combinations=[] cdef long min_price=999999 cheapest_combi=[] cdef np.ndarray toplamIO=numpy.zeros([1, 5], dtype=DTYPE) cdef np.ndarray mevcut=numpy.zeros([1, 5], dtype=DTYPE) cdef Py_ssize_t i, j, k, l, m for i in range(1,5): possible_max_exp_number=i*range(max_expander+1) possible_max_exp=i*max_expander for j in possible_max_exp_number: for k in possible_max_exp_number: for l in possible_max_exp_number: for m in possible_max_exp_number: if (j+k+l+m)<=(possible_max_exp): mevcut=0 mevcut+=X*i mevcut+=Y*j mevcut+=Z*k mevcut+=T*l mevcut+=W*m m_UI=mevcut[0][0] m_UO=mevcut[0][1] m_AO=mevcut[0][2] m_BO=mevcut[0][3] i_AI=istenen[0] i_AO=istenen[1] i_BI=istenen[2] i_BO=istenen[3] if (m_UI>=(i_AI+i_BI)): if ((m_UO+m_BO)>=i_BO): kalanUO=(m_UO+m_BO)-i_BO if ((m_BO>=i_BO)): kalanUO=m_UO if ((kalanUO+m_AO)>=i_AO): fiyat=i*X[4]+j*Y[4]+k*Z[4]+l*T[4]+m*W[4] combo = [i, j, k, l, m, fiyat] combinations.append(combo) if len(combinations)>0: for row in combinations: if (row[5] From misnomer at gmail.com Tue Mar 1 07:09:35 2011 From: misnomer at gmail.com (Nicholas Devenish) Date: Tue, 01 Mar 2011 12:09:35 +0000 Subject: OT: Code Examples In-Reply-To: <5W2bp.38551$5X6.37953@newsfe20.ams2> References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> <5W2bp.38551$5X6.37953@newsfe20.ams2> Message-ID: <4m5bp.25$tu4.23@unlimited.newshosting.com> On 01/03/2011 09:24, Richard Dobson wrote: > But - I am ~still~ caught out by the > semantic significance of indenting. Looks OK enough on paper, but doing > it interactively is another matter. I still don't fully understand this argument. With Python, I am still doing indentation almost exactly the same way I was in any other language (and should be - I haven't ever seen any arguments for not indenting logical blocks). The only difference is, I don't need to put a block-end-identifier. I suppose I see how one could argue that this could potentially cause *mildly* confusing code, but only in extreme examples, and mainly only for multi-screen functions, that should rarely exist (and these are confusing even with bracketed blocks). From stefan_ml at behnel.de Tue Mar 1 07:14:47 2011 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 01 Mar 2011 13:14:47 +0100 Subject: I cant import my function from compiled cython module. In-Reply-To: <037E8A8F0CEE0C4F9EC98037D9A9AE031FE4BDD8E8@acsmrexc01.ac.st> References: <037E8A8F0CEE0C4F9EC98037D9A9AE031FE4BDD8E8@acsmrexc01.ac.st> Message-ID: Hi, note that the cython-users mailing list, where you cross-posted this, is the right place to ask. Stefan From mark at thomaszone.com Tue Mar 1 08:01:22 2011 From: mark at thomaszone.com (Mark Thomas) Date: Tue, 1 Mar 2011 05:01:22 -0800 (PST) Subject: Problems of Symbol Congestion in Computer Languages References: <0124dbef-4362-4051-a987-40ae3e123de6@b15g2000pra.googlegroups.com> <1e2ab1db-e19d-40bf-9561-20d59a6e33e5@18g2000prd.googlegroups.com> <89d2429f-b00b-4d34-bea3-d908d697bea4@y36g2000pra.googlegroups.com> Message-ID: <6ec9a76c-4f58-40bc-9562-e9e64adf14a4@y36g2000pra.googlegroups.com> I know someone who was involved in creating a language called A+. It was invented at Morgan Stanley where they used Sun keyboards and had access to many symbols, so the language did have set symbols, math symbols, logic symbols etc. Here's a keyboard map including the language's symbols (the red characters). http://www.aplusdev.org/keyboard.html I have no idea if this language is still in use. From jason.swails at gmail.com Tue Mar 1 08:47:59 2011 From: jason.swails at gmail.com (Jason Swails) Date: Tue, 1 Mar 2011 08:47:59 -0500 Subject: backwards-compatibility In-Reply-To: References: Message-ID: > subpackage1 imports the exceptions module from package1, and I do that > like > > this: > > > > from ..exceptions import MyException > > > > You'll have to import that using the absolute import. It would be > "from package1.exceptions import MyException". > Ah; I didn't quite see how something in subpackage1 would know to look up a directory to see if it was in another package (I thought I would have to play games with PYTHONPATH). Works like a charm though. Thanks! > > > Which is perfectly fine by python2.5, 2.6, and 2.7; but unacceptable in > > python2.4. Any thoughts? > > > > Another python2.6 feature I'm using is > > > > except Exception as err: > > print err > > > > except Exception, err : > Ah, great. And it also works for python2.6 and 2.7. > > Is there any way of rewriting this so I can still print the error message > in > > python2.5/2.4? > > > Many Unix OSes (especially on supercomputers) have painfully out-of-date system python versions, so unfortunately I have to maintain compatibility with these super old versions. Thanks again! Jason -- Jason M. Swails Quantum Theory Project, University of Florida Ph.D. Candidate 352-392-4032 -------------- next part -------------- An HTML attachment was scrubbed... URL: From fpfeifer at hs.uni-hamburg.de Tue Mar 1 08:59:18 2011 From: fpfeifer at hs.uni-hamburg.de (sirvival) Date: Tue, 1 Mar 2011 05:59:18 -0800 (PST) Subject: question about numpy.polyval References: Message-ID: Hi, found the error I had x for coeff wrong definded. Instead of x = np.arange(num_chunk) it should be x = data_fin[::,0] Now it works. From swapnil.st at gmail.com Tue Mar 1 09:03:29 2011 From: swapnil.st at gmail.com (swapnil) Date: Tue, 1 Mar 2011 06:03:29 -0800 (PST) Subject: Embedding python : can't find encoding error References: Message-ID: <308a6dba-092f-49f0-a0c7-13f8c270534f@k10g2000prh.googlegroups.com> On Feb 28, 4:57?pm, Mathieu CLERICI wrote: > Hi, > > I'm trying to embed python in a c++ program. > I have compiled python32.lib with msvc 2010 targetting 32bits, i link > it with my program wich is also 32bit. > I get an error when calling Py_Initialize() : "no codec search > functions registered: ?can't find encoding" > > Py_FileSystemDefaultEncoding value is "mbcs". > > _PyCodec_Lookup raise an eror because ?len = PyList_Size(interp- > > >codec_search_path); returns 0 in codecs.c > > Does someone already had this problem ? I have no idea how to solve > that. > > Sorry for my bad english. While initializing python import site.py module and I think subsequently several other modules. Probably its in this process that Python is trying to register the codes from the encoding package of standard library. You must provide the path to the standard library to the exe that you generate. You can do this by setting the environment variables PYTHONPATH, PYTHONHOME (Refer http://docs.python.org/using/cmdline.html#environment-variables ) in your program before calling Py_Initialize() From jentzen.mooney at gmail.com Tue Mar 1 09:45:52 2011 From: jentzen.mooney at gmail.com (jmoons) Date: Tue, 1 Mar 2011 06:45:52 -0800 (PST) Subject: how to properly pass literal strings python code to be executed using python -c References: <47cdd15f-85a7-4b27-a3ea-31ffba020e05@18g2000prd.googlegroups.com> <4d6c2c4f$0$29972$c3e8da3$5496439d@news.astraweb.com> Message-ID: <2ae294fa-3a9c-4bb5-a835-0507481e1720@o18g2000prh.googlegroups.com> On Feb 28, 3:14?pm, Steven D'Aprano wrote: > On Mon, 28 Feb 2011 10:59:01 -0800, jmoons wrote: > > I need some help figuring out how to execute this python code from > > python -c > > I am have trouble formatting python so that it will execute for another > > app in cmd I understand there maybe other ways to do what I am doing but > > I am limited by the final execution using cmd python -c so please keep > > this in mind. > > I'm limited by the final delivery of code. The python is being called by > > a server that does not have access to any python script file > > Let me translate that... > > "I'm having trouble hammering this nail with a screwdriver. Keep in mind > that I am limited by the requirement that I use a screwdriver, not a > hammer, to hammer the nail. The nail is being hammered by somebody who > doesn't have a hammer." > > So give them a hammer. Put the code in a text file, call it "main.py" or > something, and execute "python -m main", or "python -c 'import main'" if > you prefer. > > I don't understand the requirement to avoid storing your code in a file > -- surely you won't be typing the script into cmd every single time you > want to run it, so surely it will be stored in a batch file or similar? > As far as I can tell, the *only* legitimate reason for the requirement is > to win a bet :) Otherwise, you're just making your life much much harder > than it needs to be. > > [...] > > > So this what i have but no worky > > > cmdline = "\" import os, shutil \n for root, dirs, files in > > os.walk("+myPath+"):\n \t for file in files: \n \t \t > > os.remove(os.path.join(root, file)) \n \t for dir in dirs: \n \t\t > > shutil.rmtree(os.path.join(root, dir))" > > I have no idea what the string handling rules for cmd are, and I'm not > going to try to guess. This doesn't appear to be a Python problem, it's a > cmd problem. You need to work out how to correctly quote your string. > Perhaps try on some Windows forums. > > > I have also tried the following > > python -c "import os; import shutil; for root, dirs, files in > > os.walk('+myPath+'): for file in files: os.remove(os.path.join(root, > > file)); for dir in dirs: shutil.rmtree(os.path.join(root, dir))" > > > I am still getting error tree(os.path.join(root, dir)) ^ SyntaxError: > > invalid syntax > > No you don't. You don't call a function "tree", so you can't be getting > that error. The actual function you call is shutil.rmtree. Please don't > retype, summarize, simplify or paraphrase error messages. Copy and paste > them *exactly* as they are shown, complete with any traceback which is > printed. > > -- > Steven Thank you steven for trying to help, I appreciate trying to understand my questions it was hard to articulate through writing I can see know with out writing a page regarding the envorment in which I need to complete my task, there is no way for you to help. I will hit the windows forums on the cmd formatting. Thank you -Jentzen From rustompmody at gmail.com Tue Mar 1 09:46:19 2011 From: rustompmody at gmail.com (rusi) Date: Tue, 1 Mar 2011 06:46:19 -0800 (PST) Subject: Problems of Symbol Congestion in Computer Languages References: <0124dbef-4362-4051-a987-40ae3e123de6@b15g2000pra.googlegroups.com> <1e2ab1db-e19d-40bf-9561-20d59a6e33e5@18g2000prd.googlegroups.com> <89d2429f-b00b-4d34-bea3-d908d697bea4@y36g2000pra.googlegroups.com> <6ec9a76c-4f58-40bc-9562-e9e64adf14a4@y36g2000pra.googlegroups.com> Message-ID: <0a90c41e-bf9e-4d94-85d5-b6edca6ab5cf@o39g2000prb.googlegroups.com> On Mar 1, 6:01?pm, Mark Thomas wrote: > I know someone who was involved in creating a language called A+. It > was invented at Morgan Stanley where they used Sun keyboards and had > access to many symbols, so the language did have set symbols, math > symbols, logic symbols etc. Here's a keyboard map including the > language's symbols (the red characters).http://www.aplusdev.org/keyboard.html > > I have no idea if this language is still in use. Runs (ok limps) under debian/ubuntu -- see http://packages.debian.org/squeeze/aplus-fsf My own attempts at improving the scene http://www.emacswiki.org/emacs/AplInDebian If anyone has any further findings on this, I'd be happy to know. From eaglebalti at gmail.com Tue Mar 1 11:05:47 2011 From: eaglebalti at gmail.com (Ashraf Ali) Date: Tue, 1 Mar 2011 08:05:47 -0800 (PST) Subject: Hello Friends Message-ID: It's a suprise.Do you know what the following blog is about.Just visit to know www.hotpics00.blogspot.com From eaglebalti at gmail.com Tue Mar 1 11:06:52 2011 From: eaglebalti at gmail.com (Ashraf Ali) Date: Tue, 1 Mar 2011 08:06:52 -0800 (PST) Subject: Hello Friends Message-ID: <7180ac2a-f118-4823-9cc0-6232c0428293@z3g2000prz.googlegroups.com> It's a suprise.Do you know what the following blog is about.Just visit to know www.hotpics00.blogspot.com From jayneil.dalal at gmail.com Tue Mar 1 11:12:14 2011 From: jayneil.dalal at gmail.com (Jayneil Dalal) Date: Tue, 1 Mar 2011 08:12:14 -0800 (PST) Subject: I am not able to open IDLE in python on Vista. Message-ID: <9d66782a-ae17-4ca6-ae0d-7cd546b8a051@f36g2000pri.googlegroups.com> This is the error message I get when I try to run Pyhon on Vista: unable to create user config directory C:\Users\Jayneil\.idlerc Check path and permissions. Exiting! So please help me out!. Thank you. From robert.kern at gmail.com Tue Mar 1 11:30:14 2011 From: robert.kern at gmail.com (Robert Kern) Date: Tue, 01 Mar 2011 10:30:14 -0600 Subject: OT: Code Examples In-Reply-To: References: Message-ID: On 2/28/11 10:03 AM, Fred Marshall wrote: > I'm interested in developing Python-based programs, including an engineering > app. ... re-writing from Fortran and C versions. One of the objectives would to > be make reasonable use of the available structure (objects, etc.). So, I'd like > to read a couple of good, simple scientific-oriented programs that do that kind > of thing. You may want to take a look at Clear Climate Code. It is a rewrite of an old, hairy FORTRAN climate analysis program with the goal of making it clearer and easier to understand. That's somewhat different from having an example of what you would write de novo, but it might help give you strategies for the process of translating your own FORTRAN and C engineering codes. http://clearclimatecode.org/ -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco From erikd at mega-nerd.com Tue Mar 1 11:51:25 2011 From: erikd at mega-nerd.com (Erik de Castro Lopo) Date: Wed, 2 Mar 2011 03:51:25 +1100 Subject: OT: Code Examples References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> <7xei6rqhvp.fsf@ruckus.brouhaha.com> Message-ID: <20110302035125.66474735.erikd@mega-nerd.com> Paul Rubin wrote: > Erik de Castro Lopo writes: > > Why Python? I really can't understand the rush of every man and > > his dog to Python. > > Are you trolling? Definitely not. As I said I used Python for a number of years and ditched it in favour of Ocaml and Haskell. The ease of development and high level language features of Python look really good if all you know is C, C++ and Java. The big difference Python and those three languages is that there are a huge number of classes of bugs which are run time errors in Python but compile time errors in C/C++/Java. I will always chose compile time errors over run time errors. > Anyway, try googling "evil mangler" I know what the "evil mangler" is. It was called that because it threw away all the principles of good software design in favour of expediency. GHC now has a new LLVM backend which does not depend on the evil mangler and I strongly suspect that the backend which uses the evil mangler will be dumped in the next year or two. > and ask why it wasn't done in Haskell. Same idea. Expediency over common sense? Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ From emile at fenx.com Tue Mar 1 12:03:02 2011 From: emile at fenx.com (Emile van Sebille) Date: Tue, 01 Mar 2011 09:03:02 -0800 Subject: OT: Code Examples In-Reply-To: <20110301194343.bc0a72e7.erikd@mega-nerd.com> References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> Message-ID: On 3/1/2011 12:43 AM Erik de Castro Lopo said... > Why Python? For me? Because it's executable pseudocode Emile From andrea.crotti.0 at gmail.com Tue Mar 1 12:07:00 2011 From: andrea.crotti.0 at gmail.com (Andrea Crotti) Date: Tue, 01 Mar 2011 18:07:00 +0100 Subject: I am not able to open IDLE in python on Vista. In-Reply-To: <9d66782a-ae17-4ca6-ae0d-7cd546b8a051@f36g2000pri.googlegroups.com> References: <9d66782a-ae17-4ca6-ae0d-7cd546b8a051@f36g2000pri.googlegroups.com> Message-ID: Jayneil Dalal writes: > This is the error message I get when I try to run Pyhon on Vista: > > unable to create user config directory > C:\Users\Jayneil\.idlerc > Check path and permissions. > Exiting! > > So please help me out!. > > Thank you. Best solution would be to avoid Windows Vista. If that is not possible than you probably need to be administrator of your machine. Or at least who installed the program should have installed it for everyone. If you installed that I don't know how that thing could happen, but I'm windows-free since the last century... From erikd at mega-nerd.com Tue Mar 1 12:11:59 2011 From: erikd at mega-nerd.com (Erik de Castro Lopo) Date: Wed, 2 Mar 2011 04:11:59 +1100 Subject: OT: Code Examples References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> <7xei6rqhvp.fsf@ruckus.brouhaha.com> Message-ID: <20110302041159.da01c998.erikd@mega-nerd.com> Paul Rubin wrote: > Erik de Castro Lopo writes: > > Why Python? I really can't understand the rush of every man and > > his dog to Python. > > Are you trolling? All my responses to this thread are really mean for comp.dsp, not for comp.lang.python. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ From werner at thieprojects.ch Tue Mar 1 12:36:22 2011 From: werner at thieprojects.ch (Werner Thie) Date: Tue, 01 Mar 2011 18:36:22 +0100 Subject: I am not able to open IDLE in python on Vista. In-Reply-To: <9d66782a-ae17-4ca6-ae0d-7cd546b8a051@f36g2000pri.googlegroups.com> References: <9d66782a-ae17-4ca6-ae0d-7cd546b8a051@f36g2000pri.googlegroups.com> Message-ID: <4D6D2E96.7000606@thieprojects.ch> Ever tried to run it as Administrator (right click, Run as Administrator...) Werner Am 01.03.2011 17:12, schrieb Jayneil Dalal: > This is the error message I get when I try to run Pyhon on Vista: > > unable to create user config directory > C:\Users\Jayneil\.idlerc > Check path and permissions. > Exiting! > > So please help me out!. > > Thank you. -------------- next part -------------- A non-text attachment was scrubbed... Name: werner.vcf Type: text/x-vcard Size: 297 bytes Desc: not available URL: From tavares at fe.up.pt Tue Mar 1 13:14:51 2011 From: tavares at fe.up.pt (tavares at fe.up.pt) Date: Tue, 1 Mar 2011 10:14:51 -0800 (PST) Subject: =?windows-1252?Q?VipIMAGE_2011_=96_ECCOMAS_Thematic_Conference_=2D_FIRS?= =?windows-1252?Q?T_ANNOUNCE?= Message-ID: <48b6656f-9dbe-4183-b71a-93b7c3030676@o10g2000vbg.googlegroups.com> ----------------------------------------------------------------------------------------------------------------------------------- International ECCOMAS Thematic Conference VipIMAGE 2011 - III ECCOMAS THEMATIC CONFERENCE ON COMPUTATIONAL VISION AND MEDICAL IMAGE PROCESSING 12-14th October 2011, Olh?o, Algarve, Portugal www.fe.up.pt/~vipimage CALL for PAPERS AND THEMATIC SESSIONS We would appreciate if you could distribute this information by your colleagues and co-workers. ----------------------------------------------------------------------------------------------------------------------------------- Dear Colleague, We would like to call your attention to the International Conference VipIMAGE 2011 - III ECCOMAS THEMATIC CONFERENCE ON COMPUTATIONAL VISION AND MEDICAL IMAGE PROCESSING that will be held in Real Marina Hotel & Spa, Olh?o, Algarve, Portugal, on October 12-14, 2011. Possible Topics (not limited to) - Signal and Image Processing - Computational Vision - Medical Imaging - Physics of Medical Imaging - Tracking and Analysis of Movement - Simulation and Modeling - Image Acquisition - Shape Reconstruction - Objects Segmentation, Matching, Simulation - Data Interpolation, Registration, Acquisition and Compression - 3D Vision - Virtual Reality - Software Development for Image Processing and Analysis - Computer Aided Diagnosis, Surgery, Therapy, and Treatment - Computational Bioimaging and Visualization - Telemedicine Systems and their Applications Invited Lecturers - Armando J. Pinho - University of Aveiro, Portugal - Irene M. Gamba - The University of Texas at Austin, USA - Marc Pollefeys - ETH Zurich, Switzerland - Marc Thiriet - Universite Pierre et Marie Curie (Paris VI), France - Xavier Roca Marv? - Autonomous University of Barcelona, Spain - Stan Sclaroff - Boston University, USA Thematic Sessions Proposals to organize Thematic Session within VipIMAGE 2011 are mostly welcome. Proposals for Thematic Sessions should be submitted by email to the conference co-chairs (tavares at fe.up.pt, rnatal at fe.up.pt) Thematic Sessions Confirmed - Simultaneous MR-PET imaging - Satellite image analysis for environmental risk assessment - Dental Imaging and Processing Techniques - Digital Mammography - Imaging of Biological Flows: trends and challenges - Imaging techniques applied to soft tissue Biomechanics Publications The proceedings book will be published by the Taylor & Francis Group and indexed by Thomson Reuters Conference Proceedings Citation Index, IET Inspect and Elsevier Scopus. A book with 20 invited works from the best ones presented in VipIMAGE2011 (extended versions) will be published by Springer Verlag. The organizers will encourage the submission of extended versions of the accepted papers to related International Journals; in particular, for special issues dedicated to the conference. Important dates - Deadline for Thematic Sessions proposals: 10th March 2011 - Deadline for Extended Abstracts: 15th March 2011 - Authors Notification: 15th April 2011 - Deadline for Full Papers: 15th June 2011 Awards "best paper award" and "best student paper award" are going to be given to the author(s) of two papers presented at the conference, selected by the Organizing Committee based on the best combined marks from the Scientific Committee and Session Chairs. We are looking forward to see you in Algarve next October. Kind regards, Jo?o Manuel R. S. Tavares Renato Natal Jorge (conference co-chairs) PS. For further details please see the conference website at: www.fe.up.pt/~vipimage From debatem1 at gmail.com Tue Mar 1 13:29:35 2011 From: debatem1 at gmail.com (geremy condra) Date: Tue, 1 Mar 2011 10:29:35 -0800 Subject: OT: Code Examples In-Reply-To: <20110302041159.da01c998.erikd@mega-nerd.com> References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> <7xei6rqhvp.fsf@ruckus.brouhaha.com> <20110302041159.da01c998.erikd@mega-nerd.com> Message-ID: On Tue, Mar 1, 2011 at 9:11 AM, Erik de Castro Lopo wrote: > Paul Rubin wrote: > >> Erik de Castro Lopo writes: >> > Why Python? I really can't understand the rush of every man and >> > his dog to Python. >> >> Are you trolling? > > All my responses to this thread are really mean for comp.dsp, > not for comp.lang.python. Ah, so you're looking for an argument. This is abuse, you want room 12A just down the hall. Geremy Condra From stacy at sensorswitch.com Tue Mar 1 14:38:27 2011 From: stacy at sensorswitch.com (Meszaros, Stacy) Date: Tue, 1 Mar 2011 14:38:27 -0500 Subject: AES Encryption of byte array Message-ID: <492F55640C06B048AC0873810D50F76902883E53CA@EXCHANGE-MBX1.AcuityLightingGroup.com> Hello all, I am very new to python, using it to write a test application. I need to be able to encrypt part of a byte array (up to 256 bytes where the first 7 bytes remain plain text) using AES 128 bit CBC encryption. I am using Python 2.6, can anyone recommend a toolkit or module? Thanks, Stacy From freethinker at pobox.com Tue Mar 1 14:50:55 2011 From: freethinker at pobox.com (Tom Zych) Date: Tue, 01 Mar 2011 14:50:55 -0500 Subject: I am not able to open IDLE in python on Vista. In-Reply-To: References: <9d66782a-ae17-4ca6-ae0d-7cd546b8a051@f36g2000pri.googlegroups.com> Message-ID: <1299009055.8979.1425120981@webmail.messagingengine.com> Andrea Crotti wrote: > Best solution would be to avoid Windows Vista. s/Vista// There, fixed that for ya. -- Tom Zych / freethinker at pobox.com Quidquid latine dictum sit, altum viditur. From freethinker at pobox.com Tue Mar 1 14:52:39 2011 From: freethinker at pobox.com (Tom Zych) Date: Tue, 01 Mar 2011 14:52:39 -0500 Subject: OT: Code Examples In-Reply-To: References: <20110301194343.bc0a72e7.erikd@mega-nerd.com><7xei6rqhvp.fsf@ruckus.brouhaha.com><20110302041159.da01c998.erikd@mega-nerd.com> Message-ID: <1299009159.9453.1425121769@webmail.messagingengine.com> geremy condra wrote: > Ah, so you're looking for an argument. This is abuse, you want room > 12A just down the hall. They have comfy chairs there. No one expects it. -- Tom Zych / freethinker at pobox.com Quidquid latine dictum sit, altum viditur. From freethinker at pobox.com Tue Mar 1 15:23:30 2011 From: freethinker at pobox.com (Tom Zych) Date: Tue, 01 Mar 2011 15:23:30 -0500 Subject: AES Encryption of byte array In-Reply-To: <492F55640C06B048AC0873810D50F76902883E53CA@EXCHANGE-MBX1.AcuityLightingGroup.com> References: <492F55640C06B048AC0873810D50F76902883E53CA@EXCHANGE-MBX1.AcuityLightingGroup.com> Message-ID: <1299011010.21765.1425133017@webmail.messagingengine.com> On Tue, 01 Mar 2011 14:38 -0500, "Meszaros, Stacy" wrote: > I am very new to python, using it to write a test application. I need > to be able to encrypt part of a byte array (up to 256 bytes where the > first 7 bytes remain plain text) using AES 128 bit CBC encryption. I am > using Python 2.6, can anyone recommend a toolkit or module? I haven't used it, but it looks like this does what you want: http://www.dlitz.net/software/pycrypto/ -- Tom Zych / freethinker at pobox.com Quidquid latine dictum sit, altum viditur. From mblume at socha.net Tue Mar 1 15:29:11 2011 From: mblume at socha.net (mblume) Date: 01 Mar 2011 20:29:11 GMT Subject: OT: Code Examples References: Message-ID: <4d6d5717$0$4020$5402220f@news.sunrise.ch> Am Mon, 28 Feb 2011 08:03:01 -0800 schrieb Fred Marshall: > I'm interested in developing Python-based programs, including an > engineering app. ... re-writing from Fortran and C versions. One of the > objectives would to be make reasonable use of the available structure > (objects, etc.). So, I'd like to read a couple of good, simple > scientific-oriented programs that do that kind of thing. > > Looking for links, etc. > > Fred An execellent book in this domain is "Python Scripting for Computational Science" by Hans Petter Langtangen Springer, ISBN 3-450-43508-5 HTH. Martin From nagle at animats.com Tue Mar 1 17:19:15 2011 From: nagle at animats.com (John Nagle) Date: Tue, 01 Mar 2011 14:19:15 -0800 Subject: Did MySQL support ever make it to Python 3.x? Message-ID: <4d6d70e1$0$10547$742ec2ed@news.sonic.net> Is there Python 3.x support for MySQL yet? MySQLdb's page still says "Python versions 2.3-2.6 are supported.": https://sourceforge.net/projects/mysql-python/ There's PyMySQL, which is pure Python, but it's at version 0.4. There's good progress there, but it's not being used heavily yet, and users are reporting bugs like "broken pipe" errors. John Nagle From cjns1989 at gmail.com Tue Mar 1 18:40:17 2011 From: cjns1989 at gmail.com (Chris Jones) Date: Tue, 01 Mar 2011 18:40:17 -0500 Subject: Problems of Symbol Congestion in Computer Languages In-Reply-To: <0a90c41e-bf9e-4d94-85d5-b6edca6ab5cf@o39g2000prb.googlegroups.com> References: <0124dbef-4362-4051-a987-40ae3e123de6@b15g2000pra.googlegroups.com> <1e2ab1db-e19d-40bf-9561-20d59a6e33e5@18g2000prd.googlegroups.com> <89d2429f-b00b-4d34-bea3-d908d697bea4@y36g2000pra.googlegroups.com> <6ec9a76c-4f58-40bc-9562-e9e64adf14a4@y36g2000pra.googlegroups.com> <0a90c41e-bf9e-4d94-85d5-b6edca6ab5cf@o39g2000prb.googlegroups.com> Message-ID: <20110301234017.GG4119@pavo.local> On Tue, Mar 01, 2011 at 09:46:19AM EST, rusi wrote: > On Mar 1, 6:01?pm, Mark Thomas wrote: > > I know someone who was involved in creating a language called A+. It > > was invented at Morgan Stanley where they used Sun keyboards and had > > access to many symbols, so the language did have set symbols, math > > symbols, logic symbols etc. Here's a keyboard map including the > > language's symbols (the red characters). > > http://www.aplusdev.org/keyboard.html > > I have no idea if this language is still in use. > > Runs (ok limps) under debian/ubuntu -- see http://packages.debian.org/squeeze/aplus-fsf > My own attempts at improving the scene http://www.emacswiki.org/emacs/AplInDebian > If anyone has any further findings on this, I'd be happy to know. Well.. a couple months back I got to the point where I'd really had it with the anglo-centric verbosity of common programming languages (there are days when even python makes me think of COBOL.. ugh..) and I took a look at A+. At first it looks like something MS (Morgan Stanley..) dumped into the OSS lap fifteen years ago and nobody ever used it or maintained it.. so it takes a bit of digging to make it.. sort of work in current GNU/linux distributions.. especially since it knows nothing about Unicode. Here's the X/A+ map I came up with: // A+ keyboard layout: /usr/share/X11/xkb/symbols/apl // Chris Jones - 18/12/2010 // Enable via: // $ setxkbmap -v 10 apl default partial alphanumeric_keys modifier_keys xkb_symbols "APL" { name[Group1]= "APL"; // Alphanumeric section key { [ grave, asciitilde, 0x010000fe, 0x0100007e ] }; key { [ 1, exclam, 0x010000a1, 0x010000e0 ] }; key { [ 2, at, 0x010000a2, 0x010000e6 ] }; key { [ 3, numbersign, 0x0100003c, 0x010000e7 ] }; key { [ 4, dollar, 0x010000a4, 0x010000e8 ] }; key { [ 5, percent, 0x0100003d, 0x010000f7 ] }; key { [ 6, asciicircum, 0x010000a6, 0x010000f4 ] }; key { [ 7, ampersand, 0x0100003e, 0x010000e1 ] }; key { [ 8, asterisk, 0x010000a8, 0x010000f0 ] }; key { [ 9, parenleft, 0x010000a9, 0x010000b9 ] }; key { [ 0, parenright, 0x0100005e, 0x010000b0 ] }; key { [ minus, underscore, 0x010000ab, 0x01000021 ] }; key { [ equal, plus, 0x010000df, 0x010000ad ] }; key { [ q, Q, 0x0100003f, 0x010000bf ] }; key { [ w, W, 0x010000d7, Nosymbol ] }; key { [ e, E, 0x010000c5, 0x010000e5 ] }; key { [ r, R, 0x010000d2, Nosymbol ] }; key { [ t, T, 0x0100007e, Nosymbol ] }; key { [ y, Y, 0x010000d9, 0x010000b4 ] }; key { [ u, U, 0x010000d5, Nosymbol ] }; key { [ i, I, 0x010000c9, 0x010000e9 ] }; key { [ o, O, 0x010000cf, 0x010000ef ] }; key { [ p, P, 0x0100002a, 0x010000b3 ] }; key { [ bracketleft, braceleft, 0x010000fb, 0x010000dd ] }; key { [ bracketright, braceright, 0x010000fd, 0x010000db ] }; key { [ a, A, 0x010000c1, Nosymbol ] }; key { [ s, S, 0x010000d3, 0x010000be ] }; key { [ d, D, 0x010000c4, Nosymbol ] }; key { [ f, F, 0x0100005f, 0x010000bd ] }; key { [ g, G, 0x010000c7, 0x010000e7 ] }; key { [ h, H, 0x010000c8, 0x010000e8 ] }; key { [ j, J, 0x010000ca, 0x010000ea ] }; key { [ k, K, 0x01000027, Nosymbol ] }; key { [ l, L, 0x010000cc, 0x010000ec ] }; key { [ semicolon, colon, 0x010000db, 0x010000bc ] }; key { [ apostrophe, quotedbl, 0x010000dd, 0x010000bb ] }; key { [ z, Z, 0x010000da, 0x010000fa ] }; key { [ x, X, 0x010000d8, Nosymbol ] }; key { [ c, C, 0x010000c3, 0x010000e3 ] }; key { [ v, V, 0x010000d6, Nosymbol ] }; key { [ b, B, 0x010000c2, 0x010000e2 ] }; key { [ n, N, 0x010000ce, 0x010000ee ] }; key { [ m, M, 0x0100007c, 0x010000cd ] }; key { [ comma, less, 0x010000ac, 0x0100003c ] }; key { [ period, greater, 0x010000dc, 0x010000ae ] }; key { [ slash, question, 0x010000af, 0x0100003f ] }; key { [ backslash, bar, 0x010000dc, 0x010000fc ] }; key { [ Caps_Lock ] }; // End alphanumeric section include "level3(win_switch)" include "level3(menu_switch)" }; In fine.. you fire up an xterm.. issue a ?setxkbmap apl? command from the shell prompt and you're in business. I used it daily for about a month before I switched to APLX - aka micro APL.. and as I had zero problems.. So, I suspect it is 100% A+ compatible. Initially, I thought of writing a python wrapper that would handle conversion from Unicode to A+'s peculiar brand of latin1 and back (among other things) but never had the time. cj From cjns1989 at gmail.com Tue Mar 1 18:59:30 2011 From: cjns1989 at gmail.com (Chris Jones) Date: Tue, 01 Mar 2011 18:59:30 -0500 Subject: OT: Code Examples In-Reply-To: References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> Message-ID: <20110301235930.GH4119@pavo.local> On Tue, Mar 01, 2011 at 12:03:02PM EST, Emile van Sebille wrote: > On 3/1/2011 12:43 AM Erik de Castro Lopo said... >> Why Python? > > For me? Because it's executable pseudocode Not for nothing, Emile.. hey.. you could end up with pseudo bugs and pseudo headaches .. cj From greg.ewing at canterbury.ac.nz Tue Mar 1 19:33:34 2011 From: greg.ewing at canterbury.ac.nz (Gregory Ewing) Date: Wed, 02 Mar 2011 13:33:34 +1300 Subject: WxPython versus Tkinter. In-Reply-To: <9649b12c-46b3-475a-8c33-2790d13f5a46@j19g2000prh.googlegroups.com> References: <920686a4-d157-46af-9e9d-1600a064bcc2@q12g2000yqi.googlegroups.com> <8q7sgiF5tpU1@mid.individual.net> <19891784-d6a3-41ac-a097-5902a6323bc0@o21g2000prn.googlegroups.com><0b12cdb1-45b4-41e4-9bdb-074ee669d76b@k14g2000pre.googlegroups.com> <048FB74272D440A0915ABC7D76AE262B@teddy> <5782E9AD8A8342D691EB3549E5E0ED7B@octavian> <9649b12c-46b3-475a-8c33-2790d13f5a46@j19g2000prh.googlegroups.com> Message-ID: <8t5hj1FtdrU1@mid.individual.net> rantingrick wrote: > All we have to do is create an abstraction API that > calls wxPython until we can create OUR OWN wxPython from WxWidgets. There seems to be at least one other project around like that: http://dabodev.com/ -- Greg From greg.ewing at canterbury.ac.nz Tue Mar 1 23:38:44 2011 From: greg.ewing at canterbury.ac.nz (Gregory Ewing) Date: Wed, 02 Mar 2011 17:38:44 +1300 Subject: Problem compiling Python 3.2 in 32bit on Snow Leopard Message-ID: <8t5vunFcasU1@mid.individual.net> Attempting to compile Python 3.2 in 32-bit mode on MacOSX 10.6.4 I get: Undefined symbols: "___moddi3", referenced from: _PyThread_acquire_lock_timed in libpython3.2m.a(thread.o) _acquire_timed in libpython3.2m.a(_threadmodule.o) "___divdi3", referenced from: _PyThread_acquire_lock_timed in libpython3.2m.a(thread.o) _acquire_timed in libpython3.2m.a(_threadmodule.o) ld: symbol(s) not found /usr/bin/libtool: internal link edit command failed Any suggestions? -- Greg From drsalists at gmail.com Tue Mar 1 23:50:27 2011 From: drsalists at gmail.com (Dan Stromberg) Date: Tue, 1 Mar 2011 20:50:27 -0800 Subject: OT: Code Examples In-Reply-To: <20110302035125.66474735.erikd@mega-nerd.com> References: <20110301194343.bc0a72e7.erikd@mega-nerd.com> <7xei6rqhvp.fsf@ruckus.brouhaha.com> <20110302035125.66474735.erikd@mega-nerd.com> Message-ID: On Tue, Mar 1, 2011 at 8:51 AM, Erik de Castro Lopo wrote: > Definitely not. As I said I used Python for a number of years > and ditched it in favour of Ocaml and Haskell. > These are all 3 intriguing languages. I wish I had time to learn OCaML and Haskell, and I wish one or both of them were near gaining critical mass. I suspect it'll take one of them becoming implicitly parallel for that to happen. The ease of development and high level language features of > Python look really good if all you know is C, C++ and Java. > The big difference Python and those three languages is that > there are a huge number of classes of bugs which are run time > errors in Python but compile time errors in C/C++/Java. > > I will always chose compile time errors over run time errors. > Yes, me too. But of course, python has pylint, pyflakes and pychecker, which make short work of what would be compile-time errors in statically typed languages. For any serious python programming, I use pylint - often even on my unit tests, which of course themselves also catch many blunders. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Wed Mar 2 01:05:51 2011 From: nad at acm.org (Ned Deily) Date: Tue, 01 Mar 2011 22:05:51 -0800 Subject: Problem compiling Python 3.2 in 32bit on Snow Leopard References: <8t5vunFcasU1@mid.individual.net> Message-ID: In article <8t5vunFcasU1 at mid.individual.net>, Gregory Ewing wrote: > Attempting to compile Python 3.2 in 32-bit mode > on MacOSX 10.6.4 I get: > > Undefined symbols: > "___moddi3", referenced from: > _PyThread_acquire_lock_timed in libpython3.2m.a(thread.o) > _acquire_timed in libpython3.2m.a(_threadmodule.o) > "___divdi3", referenced from: > _PyThread_acquire_lock_timed in libpython3.2m.a(thread.o) > _acquire_timed in libpython3.2m.a(_threadmodule.o) > ld: symbol(s) not found > /usr/bin/libtool: internal link edit command failed > > Any suggestions? http://article.gmane.org/gmane.comp.python.general/685151 -- Ned Deily, nad at acm.org From vgnulinux at gmail.com Wed Mar 2 02:47:08 2011 From: vgnulinux at gmail.com (VGNU Linux) Date: Wed, 2 Mar 2011 13:17:08 +0530 Subject: Playing WAV file with Python Message-ID: Hi All, How can I play WAV file in python without OS(like Linux/Windows/MAC) on a device ? On Google I found lot of different solution but related to OS's like winsound, ossaudiodev etc which are not useful. Thanks in advance. Regards, VGNU -------------- next part -------------- An HTML attachment was scrubbed... URL: From santoso.wijaya at gmail.com Wed Mar 2 03:41:41 2011 From: santoso.wijaya at gmail.com (Santoso Wijaya) Date: Wed, 2 Mar 2011 00:41:41 -0800 Subject: Darwin build error with MacPorts Python 2.7.1 installed. Message-ID: Hi, I recently tried to play around with the latest source for Python-2.7.1, and I came across this build error while trying to build a clean checkout (after `./configure`, of course): bash-3.2$ make ./Parser/asdl_c.py -h ./Include ./Parser/Python.asdl Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 553, in main() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 535, in main known_paths = addusersitepackages(known_paths) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 268, in addusersitepackages user_site = getusersitepackages() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243, in getusersitepackages user_base = getuserbase() # this will also set USER_BASE File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 233, in getuserbase USER_BASE = get_config_var('userbase') File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 535, in get_config_var return get_config_vars().get(name) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 434, in get_config_vars _init_posix(_CONFIG_VARS) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 313, in _init_posix raise IOError(msg) IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.4" but "10.6" during configure make: *** [Include/Python-ast.h] Error 1 I am using MacPorts with the latest updates. Any thoughts? Thanks, ~/santa -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Wed Mar 2 04:49:44 2011 From: nad at acm.org (Ned Deily) Date: Wed, 02 Mar 2011 01:49:44 -0800 Subject: Darwin build error with MacPorts Python 2.7.1 installed. References: Message-ID: In article , Santoso Wijaya wrote: > I recently tried to play around with the latest source for Python-2.7.1, and > I came across this build error while trying to build a clean checkout (after > `./configure`, of course): > > bash-3.2$ make > ./Parser/asdl_c.py -h ./Include ./Parser/Python.asdl [...] > IOError(msg) IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.4" but > "10.6" during configure > make: *** [Include/Python-ast.h] Error 1 > > I am using MacPorts with the latest updates. Any thoughts? In this case, the simplest and best workaround should be to explicitly specify the deployment target when running ./configure: ./configure [...] MACOSX_DEPLOYMENT_TARGET=10.6 If you actually do need to build for an earlier version, you should be able to pre-build or possibly just touch the Parser targets which need a working Python of some sort early in the build process. The problem is the working Python is being affected by the MACOSX_DEPLOYMENT_TARGET value, which configure currently defaults to 10.4 in the absence of other parameters. I don't think there is a issue open on this; I will open one and see that it gets fixed. -- Ned Deily, nad at acm.org From mdekauwe at gmail.com Wed Mar 2 05:49:51 2011 From: mdekauwe at gmail.com (Martin De Kauwe) Date: Wed, 2 Mar 2011 02:49:51 -0800 (PST) Subject: OT: Code Examples References: Message-ID: On Mar 2, 3:30?am, Robert Kern wrote: > On 2/28/11 10:03 AM, Fred Marshall wrote: > > > I'm interested in developing Python-based programs, including an engineering > > app. ... re-writing from Fortran and C versions. One of the objectives would to > > be make reasonable use of the available structure (objects, etc.). So, I'd like > > to read a couple of good, simple scientific-oriented programs that do that kind > > of thing. > > You may want to take a look at Clear Climate Code. It is a rewrite of an old, > hairy FORTRAN climate analysis program with the goal of making it clearer and > easier to understand. That's somewhat different from having an example of what > you would write de novo, but it might help give you strategies for the process > of translating your own FORTRAN and C engineering codes. > > ? ?http://clearclimatecode.org/ > > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, a harmless enigma > ? that is made terrible by our own mad attempt to interpret it as though it had > ? an underlying truth." > ? ?-- Umberto Eco that link is really useful helps that it is the same field! Does anyone have any more like that? From eaglebalti at gmail.com Wed Mar 2 06:30:26 2011 From: eaglebalti at gmail.com (Ashraf Ali) Date: Wed, 2 Mar 2011 03:30:26 -0800 (PST) Subject: Hello Friends Message-ID: <61a24a9f-627a-458e-aaaa-ce3a0590414b@o7g2000prn.googlegroups.com> It?s good to be informed of the world.For lattest news just visit www.newsbeam.blogspot.com From flo at chaoflow.net Wed Mar 2 07:02:48 2011 From: flo at chaoflow.net (Florian Friesdorf) Date: Wed, 02 Mar 2011 13:02:48 +0100 Subject: Plumber, an alternative to mixin-based subclassing In-Reply-To: References: Message-ID: <87fwr5buhj.fsf@eve.chaoflow.net> On 28 Feb 2011 17:54:21 -0800, aahz at pythoncraft.com (Aahz) wrote: > [posted & e-mailed] > > In article , > Florian Friesdorf wrote: > > > >An alternative to mixin-based subclassing: > > > >http://pypi.python.org/pypi/plumber > > You'll probably get more interest if you provide a summary. thx, good point! will do when there are feature updates. -- Florian Friesdorf GPG FPR: 7A13 5EEE 1421 9FC2 108D BAAF 38F8 99A3 0C45 F083 Jabber/XMPP: flo at chaoflow.net IRC: chaoflow on freenode,ircnet,blafasel,OFTC -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: not available URL: From johann.spies at gmail.com Wed Mar 2 07:38:28 2011 From: johann.spies at gmail.com (Johann Spies) Date: Wed, 2 Mar 2011 14:38:28 +0200 Subject: xml -> dict: lxml faq solution inadequate Message-ID: In the lxml-faq I read: How can I map an XML tree into a dict of dicts? I'm glad you asked. def recursive_dict(element): return element.tag, \ dict(map(recursive_dict, element)) or element.text However this does not work where you have xml-elements where there are more than one child on the same level. For example: Bayesian nonparametric statistics Frailty modeling Poly urn sampling Proportional hazards model results in >>> alys[100]['item']['keywords'] {'keyword': 'Proportional hazards model'} How do I get it to give me the following result? {'keywords': [ {'keyword': 'Bayesian nonparametric statistics'}, {'keyword': 'Frailty modeling'}, {'keyword': 'Poly urn sampling'}, {'keyword': 'Proportional hazards model'} ]} Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a -------------- next part -------------- An HTML attachment was scrubbed... URL: From 1984docmccoy at gmail.com Wed Mar 2 08:13:25 2011 From: 1984docmccoy at gmail.com (Arthur Mc Coy) Date: Wed, 2 Mar 2011 05:13:25 -0800 (PST) Subject: python simplejson decoding Message-ID: <1f783a20-6381-49b9-b366-0e28e7474d9f@g11g2000vbq.googlegroups.com> Hi all, I'm trying an example (in attached file, I mean the bottom of this message). First, I create a list of 3 objects. Then I do: PutJSONObjects(objects) objects = GetJSONObjects() PutJSONObjects(objects, "objects2.json") 1) PutJSONObjects(objects) method creates objects.json file (by default). It works fine. 2) Then objects = GetJSONObjects() method get the file contents and return. 3) Finally the script fails on the third method PutJSONObjects(objects, "objects2.json") saying: AttributeError: 'dict' object has no attribute '__dict__' That is true, because objects returned by GetJSONObjects() is not a list of objects, but simple string.... So here is the question, please, how should I DECODE .json file into list of python objects so that I will be able to put the copy of these objects into a new file called objects2.json ? simplejson docs are hard to follow - without examples. Please, help me. Be happy! Arthur -------- # Python-JSON method for caching my objects. import simplejson as json import os.path from datetime import datetime def GetJSONObjects(): # determine the json data file path filename = "objects.json" filepath = "/home/docmccoy/Documents/" + filename if os.path.isfile(filepath): filename = filepath f = open(filename, 'r') objects = json.load( f ) print objects else: objects = list() return objects def PutJSONObjects(objects, filename = "objects.json"): # determine the json data file path filepath = "/home/docmccoy/Documents/" + filename if os.path.isfile(filepath): filename = filepath f = open(filename, 'w') json.dump([o.__dict__ for o in objects], f, indent = 4 * ' ' ) class MyObject: def __init__(self, ID, url, category, osfamily, createDate): self.id = ID self.url = url self.category = category self.osfamily = osfamily self.createDate = createDate o1 = MyObject(1, "http://google.com", "search", "linux", unicode(datetime.now())) o2 = MyObject(2, "http://localhost", "mycomp", None, unicode(datetime.now())) o3 = MyObject(3, "http://milan.com", "football", "windows", unicode(datetime.now())) objects = list() objects.append(o1) objects.append(o2) objects.append(o3) PutJSONObjects(objects) objects = GetJSONObjects() PutJSONObjects(objects, "objects2.json") From cpopa at bitdefender.com Wed Mar 2 08:51:30 2011 From: cpopa at bitdefender.com (Claudiu Popa) Date: Wed, 2 Mar 2011 15:51:30 +0200 Subject: Checking against NULL will be eliminated? Message-ID: <1605654964.20110302155130@bitdefender.com> Hello Python-list, I don't know how to call it, but the following Python 3.2 code seems to raise a FutureWarning. def func(root=None): nonlocal arg if root: arg += 1 The warning is "FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead." Why is the reason for this idiom to be changed? -- -- Claudiu Popa From stefan_ml at behnel.de Wed Mar 2 09:21:13 2011 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 02 Mar 2011 15:21:13 +0100 Subject: Checking against NULL will be eliminated? In-Reply-To: <1605654964.20110302155130@bitdefender.com> References: <1605654964.20110302155130@bitdefender.com> Message-ID: Claudiu Popa, 02.03.2011 14:51: > Hello Python-list, > > > I don't know how to call it, but the following Python 3.2 code seems to raise a > FutureWarning. > > def func(root=None): > nonlocal arg > if root: > arg += 1 > The warning is "FutureWarning: The behavior of this method will change > in future versions. Use specific 'len(elem)' or 'elem is not None' test instead." > Why is the reason for this idiom to be changed? Let me guess - this is using ElementTree, right? It's not the idiom itself that changes, it's the Element class in ElementTree that will likely change its behaviour in later versions. Fix: do as it says. Stefan From __peter__ at web.de Wed Mar 2 09:24:46 2011 From: __peter__ at web.de (Peter Otten) Date: Wed, 02 Mar 2011 15:24:46 +0100 Subject: python simplejson decoding References: <1f783a20-6381-49b9-b366-0e28e7474d9f@g11g2000vbq.googlegroups.com> Message-ID: Arthur Mc Coy wrote: > Hi all, > > > > I'm trying an example (in attached file, I mean the bottom of this > message). > > First, I create a list of 3 objects. Then I do: > > > PutJSONObjects(objects) > objects = GetJSONObjects() > PutJSONObjects(objects, "objects2.json") > > > 1) PutJSONObjects(objects) method creates objects.json file (by > default). It works fine. > 2) Then objects = GetJSONObjects() method get the file contents and > return. > > 3) Finally the script fails on the third method > PutJSONObjects(objects, "objects2.json") > saying: AttributeError: 'dict' object has no attribute '__dict__' > > > That is true, because objects returned by GetJSONObjects() is not a > list of objects, but simple string.... > > So here is the question, please, how should I DECODE .json file into > list of python objects so that I will be able to put the copy of these > objects into a new file called objects2.json ? > > simplejson docs are hard to follow - without examples. I suggest that you use json instead which is part of the standard library since Python 2.6. The documentation is here: http://docs.python.org/library/json.html If you know that there are only MyObject instances you need a function to construct such a MyObject instance from a dictionary. You can then recreate the objects with objects = [object_from_dict(d) for d in json.load(f)] or, if all dictionaries correspond to MyObject instances objects = json.load(f, object_hook=object_from_dict) A general implementation for old-style objects (objects that don't derive from object) is a bit messy: # idea copied from pickle.py class Empty: pass def object_from_dict(d): obj = Empty() obj.__class__ = MyObject obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # * return obj If you are willing to make MyClass a newstyle class with class MyObject(object): # ... the function can be simplified to def object_from_dict(d): obj = object.__new__(MyObject) obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # * return obj (*) I don't know if unicode attribute names can do any harm, obj.__dict__.update(d) might work as well. From philip at semanchuk.com Wed Mar 2 09:33:17 2011 From: philip at semanchuk.com (Philip Semanchuk) Date: Wed, 2 Mar 2011 09:33:17 -0500 Subject: Checking against NULL will be eliminated? In-Reply-To: References: <1605654964.20110302155130@bitdefender.com> Message-ID: On Mar 2, 2011, at 9:21 AM, Stefan Behnel wrote: > Claudiu Popa, 02.03.2011 14:51: >> Hello Python-list, >> >> >> I don't know how to call it, but the following Python 3.2 code seems to raise a >> FutureWarning. >> >> def func(root=None): >> nonlocal arg >> if root: >> arg += 1 >> The warning is "FutureWarning: The behavior of this method will change >> in future versions. Use specific 'len(elem)' or 'elem is not None' test instead." >> Why is the reason for this idiom to be changed? > > Let me guess - this is using ElementTree, right? > > It's not the idiom itself that changes, it's the Element class in ElementTree that will likely change its behaviour in later versions. > > Fix: do as it says. And it's documented, although you might have a hard time finding it. See the "Caution" at the end of this section of documentation: http://docs.python.org/py3k/library/xml.etree.elementtree.html#element-objects I wish this behavior had been changed for Python 3.x. That warning has been in the ElementTree doc since before it became part of the standard lib, so it's not a new idea. Python 3.x seems like it would have been an ideal time to make the change. Oh well. bye P From pavlovevidence at gmail.com Wed Mar 2 09:37:13 2011 From: pavlovevidence at gmail.com (Carl Banks) Date: Wed, 2 Mar 2011 06:37:13 -0800 (PST) Subject: Checking against NULL will be eliminated? References: Message-ID: On Mar 2, 5:51?am, Claudiu Popa wrote: > Hello Python-list, > > I ?don't ?know how to call it, but the following Python 3.2 code seems to raise a > FutureWarning. > > def func(root=None): > ? ? nonlocal arg > ? ? if root: > ? ? ? ?arg += 1 > The ?warning is "FutureWarning: The behavior of this method will change > in future versions. ?Use specific 'len(elem)' or 'elem is not None' test instead." > Why is the reason for this idiom to be changed? I'm guessing root is an ElementTree Element? The reason for this is that some element tree functions will return None if an element is not found, but an empty element will have a boolean value of false because it acts like a container. Some people who use ElementTree don't always have this behavior in mind when they are testing to see if an element was found, and will use "if element:" when they need to be using "if element is not None:". The larger reason is that boolean evaluation in Python tries to be too many things: for some types is means "not zero", for some types it means "empty", and for some types it means "this is a value of this type as opposed to None". That causes conflicts when more than one of those tests makes sense for a given type, as it does with Elements. This change is only for ElementTree as far as I know. (Incidentally, Numpy arrays are another notable type that's disabled implicit booleans, but it did it a long time ago.) Carl Banks From ben.is.located at gmail.com Wed Mar 2 09:42:22 2011 From: ben.is.located at gmail.com (Ben123) Date: Wed, 2 Mar 2011 06:42:22 -0800 (PST) Subject: arbitrary precision linear algebra Message-ID: Hello. I have a written Python program which currently uses numpy to perform linear algebra operations. Specifically, I do matrix*matrix, matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) operations. Now I am interested in allowing arbitrary precision. I have tried gmpy, bigfloat, mpmath, and decimal but I have been unable to easily implement any with my current program. I suspect I have to change some commands but I am unsure what. My question is which of the arbitrary precision implementations will most easily handle linear algebra? I don't care about speed, just ease of use. Online tutorials for arbitrary precision linear algebra operations would be useful. For example, it looks like mpmath can handle matrix operations http://fredrik-j.blogspot.com/search?q=matrix but I was unable to find a clear tutorial. The tutorials for most of the arbitrary precision implementations demonstrate simple scalar examples. Thanks in advance From ben.is.located at gmail.com Wed Mar 2 09:45:13 2011 From: ben.is.located at gmail.com (Ben123) Date: Wed, 2 Mar 2011 06:45:13 -0800 (PST) Subject: arbitrary precision linear algebra References: Message-ID: On Mar 2, 8:42?am, Ben123 wrote: > Hello. I have a written Python program which currently uses numpy to > perform linear algebra operations. Specifically, I do matrix*matrix, > matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) > operations. Now I am interested in allowing arbitrary precision. I > have tried gmpy, bigfloat, mpmath, and decimal but I have been unable > to easily implement any with my current program. I suspect I have to > change some commands but I am unsure what. > > My question is which of the arbitrary precision implementations will > most easily handle linear algebra? I don't care about speed, just ease > of use. Online tutorials for arbitrary precision linear algebra > operations would be useful. > > For example, it looks like mpmath can handle matrix operationshttp://fredrik-j.blogspot.com/search?q=matrix > but I was unable to find a clear tutorial. The tutorials for most of > the arbitrary precision implementations demonstrate simple scalar > examples. > > Thanks in advance Hello again. I forgot to mention I'm using Python 2.6.4 mpmath 0.17 bigfloat 0.2.1 gmp 5.01 gmpy2 2.0.0a1 mpfr 3.0.0 all on Ubuntu x64 From cpopa at bitdefender.com Wed Mar 2 09:54:08 2011 From: cpopa at bitdefender.com (Claudiu Popa) Date: Wed, 2 Mar 2011 16:54:08 +0200 Subject: Checking against NULL will be eliminated? In-Reply-To: <1605654964.20110302155130@bitdefender.com> References: <1605654964.20110302155130@bitdefender.com> Message-ID: <196242793.20110302165408@bitdefender.com> Hello, Yes, root is an ElementTree Element. Thank you for your answer! -- Best regards, Claudiu Popa From felipe.vinturini at gmail.com Wed Mar 2 10:00:39 2011 From: felipe.vinturini at gmail.com (Felipe Vinturini) Date: Wed, 2 Mar 2011 12:00:39 -0300 Subject: python simplejson decoding In-Reply-To: References: <1f783a20-6381-49b9-b366-0e28e7474d9f@g11g2000vbq.googlegroups.com> Message-ID: Hi Arthur, Maybe this link helps you: http://www.doughellmann.com/PyMOTW/json/ I used it to learn JSON. =o) Regards, Felipe. On Wed, Mar 2, 2011 at 11:24 AM, Peter Otten <__peter__ at web.de> wrote: > Arthur Mc Coy wrote: > > > Hi all, > > > > > > > > I'm trying an example (in attached file, I mean the bottom of this > > message). > > > > First, I create a list of 3 objects. Then I do: > > > > > > PutJSONObjects(objects) > > objects = GetJSONObjects() > > PutJSONObjects(objects, "objects2.json") > > > > > > 1) PutJSONObjects(objects) method creates objects.json file (by > > default). It works fine. > > 2) Then objects = GetJSONObjects() method get the file contents and > > return. > > > > 3) Finally the script fails on the third method > > PutJSONObjects(objects, "objects2.json") > > saying: AttributeError: 'dict' object has no attribute '__dict__' > > > > > > That is true, because objects returned by GetJSONObjects() is not a > > list of objects, but simple string.... > > > > So here is the question, please, how should I DECODE .json file into > > list of python objects so that I will be able to put the copy of these > > objects into a new file called objects2.json ? > > > > simplejson docs are hard to follow - without examples. > > I suggest that you use json instead which is part of the standard library > since Python 2.6. The documentation is here: > > http://docs.python.org/library/json.html > > If you know that there are only MyObject instances you need a function to > construct such a MyObject instance from a dictionary. You can then recreate > the objects with > > objects = [object_from_dict(d) for d in json.load(f)] > > or, if all dictionaries correspond to MyObject instances > > objects = json.load(f, object_hook=object_from_dict) > > A general implementation for old-style objects (objects that don't derive > from object) is a bit messy: > > # idea copied from pickle.py > class Empty: > pass > > def object_from_dict(d): > obj = Empty() > obj.__class__ = MyObject > obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # * > return obj > > If you are willing to make MyClass a newstyle class with > > class MyObject(object): > # ... > > the function can be simplified to > > def object_from_dict(d): > obj = object.__new__(MyObject) > obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # * > return obj > > (*) I don't know if unicode attribute names can do any harm, > obj.__dict__.update(d) might work as well. > > -- > http://mail.python.org/mailman/listinfo/python-list > -------------- next part -------------- An HTML attachment was scrubbed... URL: From grahamstratton at gmail.com Wed Mar 2 10:01:11 2011 From: grahamstratton at gmail.com (Graham Stratton) Date: Wed, 2 Mar 2011 07:01:11 -0800 (PST) Subject: Strange occasional marshal error Message-ID: <09f6f042-daee-4067-a32d-4dc5caad346f@v31g2000vbs.googlegroups.com> Hi, I'm using Python with ZeroMQ to distribute data around an HPC cluster. The results have been good apart from one issue which I am completely stuck with: We are using marshal for serialising objects before distributing them around the cluster, and extremely occasionally a corrupted marshal is produced. The current workaround is to serialise everything twice and check that the serialisations are the same. On the rare occasions that they are not, I have dumped the files for comparison. It turns out that there are a few positions within the serialisation where corruption tends to occur (these positions seem to be independent of the data of the size of the complete serialisation). These are: 4 bytes starting at 548867 (0x86003) 4 bytes starting at 4398083 (0x431c03) 4 bytes starting at 17595395 (0x10c7c03) 4 bytes starting at 19794819 (0x12e0b83) 4 bytes starting at 22269171 (0x153ccf3) 2 bytes starting at 25052819 (0x17e4693) 3 bytes starting at 28184419 (0x1ae0f63) I note that the ratio between the later positions is almost exactly 1.125. Presumably this has something to do with memory allocation somewhere? Some datapoints: - The phenomenon has been observed in a single-threaded process without ZeroMQ - I think the phenomenon has been observed in pickled as well as marshalled data - The phenomenon has been observed on different hardware Unfortunately after quite a lot of work I still haven't managed to reproduce this error on a single machine. Hopefully the above is enough information for someone to speculate as to where the problem is. Many thanks in advance for any help. Regards, Graham From 1984docmccoy at gmail.com Wed Mar 2 10:04:50 2011 From: 1984docmccoy at gmail.com (Arthur Mc Coy) Date: Wed, 2 Mar 2011 07:04:50 -0800 (PST) Subject: arbitrary precision linear algebra References: Message-ID: <174f4d79-3d4d-4857-9a64-756bb43bd7d9@t8g2000vbd.googlegroups.com> What do you mean by "arbitrary precision" ? Each method of calculating of something has its own precision... From freethinker at pobox.com Wed Mar 2 10:15:33 2011 From: freethinker at pobox.com (Tom Zych) Date: Wed, 02 Mar 2011 10:15:33 -0500 Subject: Checking against NULL will be eliminated? In-Reply-To: References: Message-ID: <1299078933.17484.1425430073@webmail.messagingengine.com> On Wed, 02 Mar 2011 06:37 -0800, "Carl Banks" wrote: > The larger reason is that boolean evaluation in Python tries to be too > many things: for some types is means "not zero", for some types it > means "empty", and for some types it means "this is a value of this > type as opposed to None". That causes conflicts when more than one of > those tests makes sense for a given type, as it does with Elements. You're right. PEP 4000: Proposing a new, backwards-incompatible version of Python in which boolean evaluation is not so overloaded. Hmm, no, I don't think that will fly. We're stuck with it :( Fortunately there are work-arounds for the cases that matter, as we've seen. Yay Python :) -- Tom Zych / freethinker at pobox.com Quidquid latine dictum sit, altum viditur. From ben.is.located at gmail.com Wed Mar 2 10:26:25 2011 From: ben.is.located at gmail.com (Ben123) Date: Wed, 2 Mar 2011 07:26:25 -0800 (PST) Subject: arbitrary precision linear algebra References: <174f4d79-3d4d-4857-9a64-756bb43bd7d9@t8g2000vbd.googlegroups.com> Message-ID: <1d615eca-c680-46c8-be86-8908b2981095@o21g2000prn.googlegroups.com> On Mar 2, 9:04?am, Arthur Mc Coy <1984docmc... at gmail.com> wrote: > What do you mean by "arbitrary precision" ? Each method of calculating > of something has its own precision... If you are unfamiliar with arbitrary precision, I'm referring to http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic Suppose I find the eigenvalues of a matrix and the eigenvalues range from 1 to 0.0001. This can be handled by numpy in Python because the smallest eigenvalue is larger than then numerical precision of 1E-19. However, if the range of eigenvalues is 1 to 1E-40, then I will need to increase the precision of all calculations leading up to finding the eigenvalues. I am working with complex valued matrices and I expect to get real eigenvalues back (based on the physics of the system). The precision of numpy is apparent from the imaginary component of the eigenvalues I find, currently 1E-19 or 1E-20. I need better precision for small eigenvalues. In case you are curious, the complex-valued matrices are 20x20. Thanks From gnarlodious at gmail.com Wed Mar 2 11:02:47 2011 From: gnarlodious at gmail.com (Gnarlodious) Date: Wed, 2 Mar 2011 08:02:47 -0800 (PST) Subject: Various behaviors of doctest References: <0a8effef-c2ea-4ba7-bbe7-9d05adbec9fd@i39g2000prd.googlegroups.com> <4d6ae483$0$29972$c3e8da3$5496439d@news.astraweb.com> <933d7084-fa41-4460-9e16-f678923198bc@o7g2000prn.googlegroups.com> Message-ID: <7f266ded-e1e2-428d-99e4-a2a86ab0e85e@o21g2000prn.googlegroups.com> On Feb 28, Peter Otten wrote: > Are you using Python 2.x? Then you cannot redefine print. Instead you have > to redirect stdout. The following example should run as a cgi script: > > #!/usr/bin/env python > import cgi > import sys > from cStringIO import StringIO ... That works! Except for Py3 I had to say: from io import StringIO Thanks. -- Gnarlie From howe.steven at gmail.com Wed Mar 2 11:20:56 2011 From: howe.steven at gmail.com (Steven Howe) Date: Wed, 02 Mar 2011 08:20:56 -0800 Subject: Checking against NULL will be eliminated? In-Reply-To: <1299078933.17484.1425430073@webmail.messagingengine.com> References: <1299078933.17484.1425430073@webmail.messagingengine.com> Message-ID: <4D6E6E68.5040504@gmail.com> Back at NCR, they stressed the axiom '90% of the time is spent fixing 10% of the code'. How true that axiom is. Never more so then when faced with a programming language fix like PEP 4000. Fortunately for me, I never trusted python's complex, or should I say 'overloaded' Boolean usage. If I want to know if a string or list dictionary is empty: if ( len(x) == 0 ). If an item is None: if ( type(x) == types.NoneType ): if truly Boolean and want to 'do' something on False, then I use 'not'. I really like 'types'. Helps error checking, helps making logic flows cleaner and less error prone. And since 'pydev/Eclipse' is so good at finding my from/imports and inserting them for me, I use types liberally. I guess being an old C programmer makes one a bit more cautious; nothing worse then compiler errors, accept runtime errors. And over course, I still use lots of parentheses to group my logic. Hell, I still do a lot of that when using bash. So PEP 4000, go ahead, break some over indulgent code and coders; I'm not bothered. Steven On 03/02/2011 07:15 AM, Tom Zych wrote: > On Wed, 02 Mar 2011 06:37 -0800, "Carl Banks" > wrote: >> The larger reason is that boolean evaluation in Python tries to be too >> many things: for some types is means "not zero", for some types it >> means "empty", and for some types it means "this is a value of this >> type as opposed to None". That causes conflicts when more than one of >> those tests makes sense for a given type, as it does with Elements. > You're right. > > PEP 4000: > Proposing a new, backwards-incompatible version of Python in which > boolean evaluation > is not so overloaded. > > Hmm, no, I don't think that will fly. We're stuck with it :( > > Fortunately there are work-arounds for the cases that matter, as we've > seen. > Yay Python :) > From 1984docmccoy at gmail.com Wed Mar 2 11:21:06 2011 From: 1984docmccoy at gmail.com (Arthur Mc Coy) Date: Wed, 2 Mar 2011 08:21:06 -0800 (PST) Subject: arbitrary precision linear algebra References: <174f4d79-3d4d-4857-9a64-756bb43bd7d9@t8g2000vbd.googlegroups.com> <1d615eca-c680-46c8-be86-8908b2981095@o21g2000prn.googlegroups.com> Message-ID: On Mar 2, 5:26?pm, Ben123 wrote: > On Mar 2, 9:04?am, Arthur Mc Coy <1984docmc... at gmail.com> wrote: > > > What do you mean by "arbitrary precision" ? Each method of calculating > > of something has its own precision... > > If you are unfamiliar with arbitrary precision, I'm referring tohttp://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic > > Suppose I find the eigenvalues of a matrix and the eigenvalues range > from 1 to 0.0001. This can be handled by numpy in Python because the > smallest eigenvalue is larger than then numerical precision of 1E-19. > However, if the range of eigenvalues is 1 to 1E-40, then I will need > to increase the precision of all calculations leading up to finding > the eigenvalues. > > I am working with complex valued matrices and I expect to get real > eigenvalues back (based on the physics of the system). The precision > of numpy is apparent from the imaginary component of the eigenvalues I > find, currently 1E-19 or 1E-20. I need better precision for small > eigenvalues. > > In case you are curious, the complex-valued matrices are 20x20. > > Thanks You probably have to change the method of finding eigenvalues. Which one do you use? Power or algebraic ? Do you use Gaussian method to simplify matrices ? Languages can't support infinitely large or small numbers, so try to multiply the inner variables by 10^n to increase their values if this will not involve on the method. For example, I did this when was calculating geometric means of computer benchmarks. In such way you will be storing the number of zeros as n. Yes, interesting what are you calculating. From ben.is.located at gmail.com Wed Mar 2 11:39:49 2011 From: ben.is.located at gmail.com (Ben123) Date: Wed, 2 Mar 2011 08:39:49 -0800 (PST) Subject: arbitrary precision linear algebra References: <174f4d79-3d4d-4857-9a64-756bb43bd7d9@t8g2000vbd.googlegroups.com> <1d615eca-c680-46c8-be86-8908b2981095@o21g2000prn.googlegroups.com> Message-ID: <6d20df3b-7d93-4277-b229-c6d02dde4813@y36g2000pra.googlegroups.com> On Mar 2, 10:21?am, Arthur Mc Coy <1984docmc... at gmail.com> wrote: > On Mar 2, 5:26?pm, Ben123 wrote: > > > > > > > > > > > On Mar 2, 9:04?am, Arthur Mc Coy <1984docmc... at gmail.com> wrote: > > > > What do you mean by "arbitrary precision" ? Each method of calculating > > > of something has its own precision... > > > If you are unfamiliar with arbitrary precision, I'm referring tohttp://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic > > > Suppose I find the eigenvalues of a matrix and the eigenvalues range > > from 1 to 0.0001. This can be handled by numpy in Python because the > > smallest eigenvalue is larger than then numerical precision of 1E-19. > > However, if the range of eigenvalues is 1 to 1E-40, then I will need > > to increase the precision of all calculations leading up to finding > > the eigenvalues. > > > I am working with complex valued matrices and I expect to get real > > eigenvalues back (based on the physics of the system). The precision > > of numpy is apparent from the imaginary component of the eigenvalues I > > find, currently 1E-19 or 1E-20. I need better precision for small > > eigenvalues. > > > In case you are curious, the complex-valued matrices are 20x20. > > > Thanks > > You probably have to change the method of finding eigenvalues. > Which one do you use? Power or algebraic ? I'm not sure what you mean by this. As I mentioned, in Python I am using linalg.eig() from numpy on complex matrices. I have not investigated how this is implemented. > Do you use Gaussian method to simplify matrices ? No > > Languages can't support infinitely large or small numbers, so try to > multiply the inner variables by 10^n to increase their values if this > will not involve on the method. For example, I did this when was > calculating geometric means of computer benchmarks. Currently I have values between 1 and 1E-300 (not infinitely small). I don't see how scaling by powers of 10 will increase precision. > In such way you will be storing the number of zeros as n. Are you saying python cares whether I express a number as 0.001 or scaled by 10^5 to read 100? If this is the case, I'm still stuck. I need the full range of eigenvalues from 1 to 1E-300, so the entire range could be scaled by 1E300 but I would still need better precision than 1E19 > > Yes, interesting what are you calculating. From 1984docmccoy at gmail.com Wed Mar 2 12:13:55 2011 From: 1984docmccoy at gmail.com (Arthur Mc Coy) Date: Wed, 2 Mar 2011 09:13:55 -0800 (PST) Subject: python simplejson decoding References: <1f783a20-6381-49b9-b366-0e28e7474d9f@g11g2000vbq.googlegroups.com> Message-ID: Hi Peter, I implemented my decoder using your approach. Very positive. But that is for simple objects. My objects have nested lists. For example MyObject has property (member) called benchmarks, which is the list of defined benchmarks. I'm not sure if obj.__dict__.update will help me to copy nested information. I will see later. Now, when the testing environment is ready, I go for real world application. Thank you! Kostia On Mar 2, 4:24?pm, Peter Otten <__pete... at web.de> wrote: > Arthur Mc Coy wrote: > > Hi all, > > > I'm trying an example (in attached file, I mean the bottom of this > > message). > > > First, I create a list of 3 objects. Then I do: > > > PutJSONObjects(objects) > > objects = GetJSONObjects() > > PutJSONObjects(objects, "objects2.json") > > > 1) PutJSONObjects(objects) method creates objects.json file (by > > default). It works fine. > > 2) Then objects = GetJSONObjects() method get the file contents and > > return. > > > 3) Finally the script fails on the third method > > PutJSONObjects(objects, "objects2.json") > > saying: AttributeError: 'dict' object has no attribute '__dict__' > > > That is true, because objects returned by GetJSONObjects() is not a > > list of objects, but simple string.... > > > So here is the question, please, how should I DECODE .json file into > > list of python objects so that I will be able to put the copy of these > > objects into a new file called objects2.json ? > > > simplejson docs are hard to follow - without examples. > > I suggest that you use json instead which is part of the standard library > since Python 2.6. The documentation is here: > > http://docs.python.org/library/json.html > > If you know that there are only MyObject instances you need a function to > construct such a MyObject instance from a dictionary. You can then recreate > the objects with > > objects = [object_from_dict(d) for d in json.load(f)] > > or, if all dictionaries correspond to MyObject instances > > objects = json.load(f, object_hook=object_from_dict) > > A general implementation for old-style objects (objects that don't derive > from object) is a bit messy: > > # idea copied from pickle.py > class Empty: > ? ? pass > > def object_from_dict(d): > ? ? obj = Empty() > ? ? obj.__class__ = MyObject > ? ? obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # * > ? ? return obj > > If you are willing to make MyClass a newstyle class with > > class MyObject(object): > ? ? # ... > > the function can be simplified to > > def object_from_dict(d): > ? ? obj = object.__new__(MyObject) > ? ? obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # * > ? ? return obj > > (*) I don't know if unicode attribute names can do any harm, > obj.__dict__.update(d) might work as well. From 1984docmccoy at gmail.com Wed Mar 2 12:26:52 2011 From: 1984docmccoy at gmail.com (Arthur Mc Coy) Date: Wed, 2 Mar 2011 09:26:52 -0800 (PST) Subject: arbitrary precision linear algebra References: <174f4d79-3d4d-4857-9a64-756bb43bd7d9@t8g2000vbd.googlegroups.com> <1d615eca-c680-46c8-be86-8908b2981095@o21g2000prn.googlegroups.com> <6d20df3b-7d93-4277-b229-c6d02dde4813@y36g2000pra.googlegroups.com> Message-ID: > Are you saying python cares whether I express a number as 0.001 or > scaled by 10^5 to read 100? If this is the case, I'm still stuck. I > need the full range of eigenvalues from 1 to 1E-300, so the entire > range could be scaled by 1E300 but I would still need better precision > than 1E19 If python package can't compute 1E-300, then you can't use it. You can try to split your task onto small subtasks, which can be handled by specific python package. Then you need to think of the way to do that. Mathematically. If no way, then you can leave your task alone. Programming is limiting, that is true. I have heard about grid computing. You may find scientists working on grid and ask how do they split their tasks. But I think they do not an answer as well. Also google uses its matrix to rank web pages. It computes the maximum eigenvalue from the matrix which contain near zero entries too. Maybe you can find how do they store those values. Sorry, can't help anymore. I also have computing problems which I can't yet solve :) From robin at reportlab.com Wed Mar 2 12:28:57 2011 From: robin at reportlab.com (Robin Becker) Date: Wed, 02 Mar 2011 17:28:57 +0000 Subject: arbitrary precision linear algebra In-Reply-To: <6d20df3b-7d93-4277-b229-c6d02dde4813@y36g2000pra.googlegroups.com> References: <174f4d79-3d4d-4857-9a64-756bb43bd7d9@t8g2000vbd.googlegroups.com> <1d615eca-c680-46c8-be86-8908b2981095@o21g2000prn.googlegroups.com> <6d20df3b-7d93-4277-b229-c6d02dde4813@y36g2000pra.googlegroups.com> Message-ID: <4D6E7E59.90105@chamonix.reportlab.co.uk> On 02/03/2011 16:39, Ben123 wrote: ........... >> Languages can't support infinitely large or small numbers, so try to >> multiply the inner variables by 10^n to increase their values if this >> will not involve on the method. For example, I did this when was >> calculating geometric means of computer benchmarks. > > Currently I have values between 1 and 1E-300 (not infinitely small). I > don't see how scaling by powers of 10 will increase precision. > >> In such way you will be storing the number of zeros as n. > > Are you saying python cares whether I express a number as 0.001 or > scaled by 10^5 to read 100? If this is the case, I'm still stuck. I > need the full range of eigenvalues from 1 to 1E-300, so the entire > range could be scaled by 1E300 but I would still need better precision > than 1E19 > ....... If you enter a number as 1e-19 then python will treat as a float; by default I think that float is IEEE double precision so you're getting a 48 bit mantissa (others may have better details). That means you've already lost any idea of arbitrary precision. When you say you have numbers like 1E-300 are those actually numerically zero or have you some valid inputs that vary over a huge range. It should be possible to compute determinants/inverses etc to arbitrary precision as those are known to be polynomial functions of the input elements. However, eigenvalues are not. eg [0 2] [1 0] has eigenvalues +/- sqrt(2) so even though you can represent the matrix in finite precision the eigenvalues require infinite precision. Eigenvalues are roots of a polynomial in the elements and root solving may require an infinite number of steps so it will be difficult with arbitrary matrices to keep arbitrary precision. -- Robin Becker From ben.is.located at gmail.com Wed Mar 2 12:53:57 2011 From: ben.is.located at gmail.com (Ben123) Date: Wed, 2 Mar 2011 09:53:57 -0800 (PST) Subject: arbitrary precision linear algebra References: <174f4d79-3d4d-4857-9a64-756bb43bd7d9@t8g2000vbd.googlegroups.com> <1d615eca-c680-46c8-be86-8908b2981095@o21g2000prn.googlegroups.com> <6d20df3b-7d93-4277-b229-c6d02dde4813@y36g2000pra.googlegroups.com> Message-ID: On Mar 2, 11:28?am, Robin Becker wrote: > On 02/03/2011 16:39, Ben123 wrote: > ........... > > > > > > > > >> Languages can't support infinitely large or small numbers, so try to > >> multiply the inner variables by 10^n to increase their values if this > >> will not involve on the method. For example, I did this when was > >> calculating geometric means of computer benchmarks. > > > Currently I have values between 1 and 1E-300 (not infinitely small). I > > don't see how scaling by powers of 10 will increase precision. > > >> In such way you will be storing the number of zeros as n. > > > Are you saying python cares whether I express a number as 0.001 or > > scaled by 10^5 to read 100? If this is the case, I'm still stuck. I > > need the full range of eigenvalues from 1 to 1E-300, so the entire > > range could be scaled by 1E300 but I would still need better precision > > than 1E19 > > ....... > > If you enter a number as 1e-19 then python will treat as a float; by default I > think that float is IEEE double precision so you're getting a 48 bit mantissa > (others may have better details). That means you've already lost any idea of > arbitrary precision. > > When you say you have numbers like 1E-300 are those actually numerically zero or > have you some valid inputs that vary over a huge range. It should be possible to > compute determinants/inverses etc to arbitrary precision as those are known to > be polynomial functions of the input elements. However, eigenvalues are not. I meant that I expect the eigenvalues to be in a range from 1 to 1E-300. The values in the matrix are from sine and cosine values and have range [-10,10] for the real and imaginary parts. Thus, I could specify the matrix elements to arbitrary precision prior to diagonalization. However, I'm looking for the resulting eigenvalues to have precision to 1E-300 > > eg > > [0 2] > [1 0] > > has eigenvalues +/- sqrt(2) so even though you can represent the matrix in > finite precision the eigenvalues require infinite precision. Here's an example of a matrix I am diagonalizing: from numpy import * exmpl=array([[ 9.39582700e-04 +1.21760986e-21j, 3.32958159e-04 -6.03359588e-04j, \ -3.71551527e-04 -1.77143102e-04j, 2.87113322e-04 -9.84374562e-04j], \ [ 3.32958159e-04 +6.03359588e-04j, 5.05441331e-04 +6.80604208e-21j, \ -1.79123354e-05 -3.01368276e-04j, 7.33866807e-04 -1.64459142e-04j], \ [ -3.71551527e-04 +1.77143102e-04j, -1.79123354e-05 +3.01368276e-04j, \ 1.80324968e-04 -2.63622461e-21j, 7.20508934e-05 +4.43394732e-04j], \ [ 2.87113322e-04 +9.84374562e-04j, 7.33866807e-04 +1.64459142e-04j, \ 7.20508934e-05 -4.43394732e-04j, 1.11903651e-03 -6.61744490e-21j]]) The eigenvalues I get back using linalg.eig(exmpl)[0] are 2.74438550e-03 +7.67536143e-20j 6.54324852e-12 +2.03438929e-20j 1.39471366e-13 +4.68335525e-20j 1.76591707e-12 +2.20243218e-20j]) Here I would want to have better precision in the eigenvalues, a smaller imaginary component. To use your example, I'd like to increase the number of digits shown in the eigenvalue: from numpy import * test=array([[0, 2],[1, 0]]) linalg.eig(test)[0] but using import mpmath from mpmath import * mp.dps = 50 from numpy import * test=array([[0, 2],[1, 0]]) linalg.eig(test)[0] does not help > > Eigenvalues are roots of a polynomial in the elements and root solving may > require an infinite number of steps so it will be difficult with arbitrary > matrices to keep arbitrary precision. > -- > Robin Becker From debatem1 at gmail.com Wed Mar 2 13:21:36 2011 From: debatem1 at gmail.com (geremy condra) Date: Wed, 2 Mar 2011 10:21:36 -0800 Subject: arbitrary precision linear algebra In-Reply-To: References: Message-ID: On Wed, Mar 2, 2011 at 6:42 AM, Ben123 wrote: > Hello. I have a written Python program which currently uses numpy to > perform linear algebra operations. Specifically, I do matrix*matrix, > matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) > operations. Now I am interested in allowing arbitrary precision. I > have tried gmpy, bigfloat, mpmath, and decimal but I have been unable > to easily implement any with my current program. I suspect I have to > change some commands but I am unsure what. > > My question is which of the arbitrary precision implementations will > most easily handle linear algebra? I don't care about speed, just ease > of use. Online tutorials for arbitrary precision linear algebra > operations would be useful. > > For example, it looks like mpmath can handle matrix operations > http://fredrik-j.blogspot.com/search?q=matrix > but I was unable to find a clear tutorial. The tutorials for most of > the arbitrary precision implementations demonstrate simple scalar > examples. > > Thanks in advance Have you looked at Sage[0]? I don't know for a fact, but you should be able to define a matrix over RealField(precision_in_bits) and then take the eigenvalue of it. I don't know if it will actually produce the precision you need though. Geremy Condra From debatem1 at gmail.com Wed Mar 2 13:22:28 2011 From: debatem1 at gmail.com (geremy condra) Date: Wed, 2 Mar 2011 10:22:28 -0800 Subject: arbitrary precision linear algebra In-Reply-To: References: Message-ID: On Wed, Mar 2, 2011 at 10:21 AM, geremy condra wrote: > On Wed, Mar 2, 2011 at 6:42 AM, Ben123 wrote: >> Hello. I have a written Python program which currently uses numpy to >> perform linear algebra operations. Specifically, I do matrix*matrix, >> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) >> operations. Now I am interested in allowing arbitrary precision. I >> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable >> to easily implement any with my current program. I suspect I have to >> change some commands but I am unsure what. >> >> My question is which of the arbitrary precision implementations will >> most easily handle linear algebra? I don't care about speed, just ease >> of use. Online tutorials for arbitrary precision linear algebra >> operations would be useful. >> >> For example, it looks like mpmath can handle matrix operations >> http://fredrik-j.blogspot.com/search?q=matrix >> but I was unable to find a clear tutorial. The tutorials for most of >> the arbitrary precision implementations demonstrate simple scalar >> examples. >> >> Thanks in advance > > Have you looked at Sage[0]? I don't know for a fact, but you should be > able to define a matrix over RealField(precision_in_bits) and then > take the eigenvalue of it. I don't know if it will actually produce > the precision you need though. > > Geremy Condra > Apologies, forgot the links: http://www.sagemath.org/doc/constructions/linear_algebra.html http://www.sagemath.org/doc/reference/sage/rings/complex_field.html Geremy Condra From ben.is.located at gmail.com Wed Mar 2 13:43:47 2011 From: ben.is.located at gmail.com (Ben123) Date: Wed, 2 Mar 2011 10:43:47 -0800 (PST) Subject: arbitrary precision linear algebra References: Message-ID: <7cb3cb1f-9e39-499d-a045-713802a2d1fc@u24g2000prn.googlegroups.com> On Mar 2, 12:22?pm, geremy condra wrote: > On Wed, Mar 2, 2011 at 10:21 AM, geremy condra wrote: > > On Wed, Mar 2, 2011 at 6:42 AM, Ben123 wrote: > >> Hello. I have a written Python program which currently uses numpy to > >> perform linear algebra operations. Specifically, I do matrix*matrix, > >> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) > >> operations. Now I am interested in allowing arbitrary precision. I > >> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable > >> to easily implement any with my current program. I suspect I have to > >> change some commands but I am unsure what. > > >> My question is which of the arbitrary precision implementations will > >> most easily handle linear algebra? I don't care about speed, just ease > >> of use. Online tutorials for arbitrary precision linear algebra > >> operations would be useful. > > >> For example, it looks like mpmath can handle matrix operations > >>http://fredrik-j.blogspot.com/search?q=matrix > >> but I was unable to find a clear tutorial. The tutorials for most of > >> the arbitrary precision implementations demonstrate simple scalar > >> examples. > > >> Thanks in advance > > > Have you looked at Sage[0]? I don't know for a fact, but you should be > > able to define a matrix over RealField(precision_in_bits) and then > > take the eigenvalue of it. I don't know if it will actually produce > > the precision you need though. > > > Geremy Condra > > Apologies, forgot the links: > > http://www.sagemath.org/doc/constructions/linear_algebra.htmlhttp://www.sagemath.org/doc/reference/sage/rings/complex_field.html > > Geremy Condra I've already implemented the algorithm in Mathematica for exactly this reason - increasing precision there is trivial. I was interested in Python because it is free and more portable. I knew of Sage but wasn't sure if it was more appropriate than Python. From ben.is.located at gmail.com Wed Mar 2 13:47:46 2011 From: ben.is.located at gmail.com (Ben123) Date: Wed, 2 Mar 2011 10:47:46 -0800 (PST) Subject: arbitrary precision linear algebra References: Message-ID: On Mar 2, 12:22?pm, geremy condra wrote: > On Wed, Mar 2, 2011 at 10:21 AM, geremy condra wrote: > > On Wed, Mar 2, 2011 at 6:42 AM, Ben123 wrote: > >> Hello. I have a written Python program which currently uses numpy to > >> perform linear algebra operations. Specifically, I do matrix*matrix, > >> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) > >> operations. Now I am interested in allowing arbitrary precision. I > >> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable > >> to easily implement any with my current program. I suspect I have to > >> change some commands but I am unsure what. > > >> My question is which of the arbitrary precision implementations will > >> most easily handle linear algebra? I don't care about speed, just ease > >> of use. Online tutorials for arbitrary precision linear algebra > >> operations would be useful. > > >> For example, it looks like mpmath can handle matrix operations > >>http://fredrik-j.blogspot.com/search?q=matrix > >> but I was unable to find a clear tutorial. The tutorials for most of > >> the arbitrary precision implementations demonstrate simple scalar > >> examples. > > >> Thanks in advance > > > Have you looked at Sage[0]? I don't know for a fact, but you should be > > able to define a matrix over RealField(precision_in_bits) and then > > take the eigenvalue of it. I don't know if it will actually produce > > the precision you need though. > > > Geremy Condra > > Apologies, forgot the links: > > http://www.sagemath.org/doc/constructions/linear_algebra.htmlhttp://www.sagemath.org/doc/reference/sage/rings/complex_field.html > > Geremy Condra I'm not sufficiently familiar with Sage, but from http://www.sagemath.org/doc/constructions/linear_algebra.html "currently Sage does not implement multiprecision numerical eigenvalues/eigenvectors" I'll ask on the Sage forums about this. In the mean time, I'm still trying to get arbitrary precision linear algebra in Python From no.email at nospam.invalid Wed Mar 2 14:32:31 2011 From: no.email at nospam.invalid (Paul Rubin) Date: Wed, 02 Mar 2011 11:32:31 -0800 Subject: arbitrary precision linear algebra References: Message-ID: <7x62s1wc6o.fsf@ruckus.brouhaha.com> Ben123 writes: > I'll ask on the Sage forums about this. In the mean time, I'm still > trying to get arbitrary precision linear algebra in Python You probably have to use something like gmpy.mpq to implement your favorite eigenvalue computation algorithm. Maxima might be able to do it out of the box, but is perhaps more hassle to use than you want to deal with. See: http://en.wikipedia.org/wiki/Maxima_(software) From debatem1 at gmail.com Wed Mar 2 14:34:38 2011 From: debatem1 at gmail.com (geremy condra) Date: Wed, 2 Mar 2011 11:34:38 -0800 Subject: arbitrary precision linear algebra In-Reply-To: References: Message-ID: On Wed, Mar 2, 2011 at 10:47 AM, Ben123 wrote: > On Mar 2, 12:22?pm, geremy condra wrote: >> On Wed, Mar 2, 2011 at 10:21 AM, geremy condra wrote: >> > On Wed, Mar 2, 2011 at 6:42 AM, Ben123 wrote: >> >> Hello. I have a written Python program which currently uses numpy to >> >> perform linear algebra operations. Specifically, I do matrix*matrix, >> >> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) >> >> operations. Now I am interested in allowing arbitrary precision. I >> >> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable >> >> to easily implement any with my current program. I suspect I have to >> >> change some commands but I am unsure what. >> >> >> My question is which of the arbitrary precision implementations will >> >> most easily handle linear algebra? I don't care about speed, just ease >> >> of use. Online tutorials for arbitrary precision linear algebra >> >> operations would be useful. >> >> >> For example, it looks like mpmath can handle matrix operations >> >>http://fredrik-j.blogspot.com/search?q=matrix >> >> but I was unable to find a clear tutorial. The tutorials for most of >> >> the arbitrary precision implementations demonstrate simple scalar >> >> examples. >> >> >> Thanks in advance >> >> > Have you looked at Sage[0]? I don't know for a fact, but you should be >> > able to define a matrix over RealField(precision_in_bits) and then >> > take the eigenvalue of it. I don't know if it will actually produce >> > the precision you need though. >> >> > Geremy Condra >> >> Apologies, forgot the links: >> >> http://www.sagemath.org/doc/constructions/linear_algebra.htmlhttp://www.sagemath.org/doc/reference/sage/rings/complex_field.html >> >> Geremy Condra > > I'm not sufficiently familiar with Sage, but from > http://www.sagemath.org/doc/constructions/linear_algebra.html > > "currently Sage does not implement multiprecision numerical > eigenvalues/eigenvectors" > > I'll ask on the Sage forums about this. In the mean time, I'm still > trying to get arbitrary precision linear algebra in Python I'd suggest you read that slightly more carefully. It's speaking specifically of RR and CC, ie, double-width reals and complex values. Using RealField and ComplexField- the arbitrary precision real and complex fields- seems to be working. Using the earlier example: sage: M1 = Matrix(RealField(1000), [[0, 2], [1, 0]]) sage: M2 = Matrix(RR, [[0, 2], [1, 0]]) sage: M1.eigenvalues() [1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799, -1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799] sage: M2.eigenvalues() [1.41421356237310, -1.41421356237310] Converting the first of the latter values to an element of RealField(1000) yields much what I would expect from higher precision arithmetic: R = RealField(1000) sage: x = M1.eigenvalues()[0] sage: y = R(M2.eigenvalues()[0]) sage: x 1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799 sage: y 1.41421356237309514547462185873882845044136047363281250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 So, while I don't know for a fact that it's using the precision you need, it certainly does seem to be using high precision arithmetic here. Furthermore, repeating it for various precisions seems to increase the difference, as would be expected from better approximations, and the number of digits in the result is consistent with the interpretation that it is using the specified precision. All of this to say that it seems to be doing what you want it to do. Geremy Condra From marceljakobs at ymail.com Wed Mar 2 15:53:46 2011 From: marceljakobs at ymail.com (Marcel Jakobs) Date: Wed, 02 Mar 2011 20:53:46 GMT Subject: TkTable and Python 3.1 References: Message-ID: <201132155337usenet@eggheadcafe.com> Hello Chuck, I am working with Ubuntu 10.04 LTS - Lucid Lynx, Python 3.1 and Tktable2.10. I have installed Python and Tktable separatly. So I had to "tell" Python where to find Tktable. I built a file named 'tkTable.pth' in the directory "/usr/lib/python3.1/dist-packages". The file is has only one row: /usr/lib/Tktable2.10 This is the directory where my Tktable-module is stored. ".pth"-files are working as "pointer" to modules. I don't know how your directories are built, but I think the structure is equal. Marcel > On Tuesday, February 16, 2010 12:00 AM Charles McKnight wrote: > HI All, > > I am fiddling around with Python and I am trying to get tktable to work > with Python 3.1 on Apple OS X 10.6 (Snow Leopard). Has anyone > successfully accomplished this task, and if so, can you share how that > you got it working? I have got Darwin Ports installed (current version) > and I am using Python 3.1 (ports), Tcl/Tk 8.5 (ports) and I have > installed TkTable 2.10 (ports). Somehow, I have missed doing something > because the Python interpreter cannot seem to find the tktable module. > > Thanks in advance! > > Chuck > Submitted via EggHeadCafe > Statistics, Probability, Lotteries and Dumb Programmers > http://www.eggheadcafe.com/tutorials/aspnet/041de19a-e704-468f-bd3c-79164fc739f5/statistics-probability-lotteries-and-dumb-programmers.aspx From marceljakobs at ymail.com Wed Mar 2 15:57:07 2011 From: marceljakobs at ymail.com (Marcel Jakobs) Date: Wed, 02 Mar 2011 20:57:07 GMT Subject: TkTable and Python 3.1 References: <201132155337usenet@eggheadcafe.com> Message-ID: <201132155658usenet@eggheadcafe.com> ... I built a file named 'tkTable.pth' in the directory "/usr/lib/python3.1/dist-packages" ... Submitted via EggHeadCafe Pass Values Between Windows Forms http://www.eggheadcafe.com/tutorials/aspnet/a3e1e170-21d9-4a59-a659-3ead05bb36f2/pass-values-between-windows-forms.aspx From marceljakobs at ymail.com Wed Mar 2 16:00:39 2011 From: marceljakobs at ymail.com (Marcel Jakobs) Date: Wed, 02 Mar 2011 21:00:39 GMT Subject: TkTable and Python 3.1 References: <201132155658usenet@eggheadcafe.com> Message-ID: <20113216031usenet@eggheadcafe.com> I don't know why, but every time when I have "sent" the directories name, it's not to see in the site. => '/usr/lib/python3.1/dist-packages' => Got to the home-directory of python and then save the file in the subdirectory "dist-packages". Marcel Submitted via EggHeadCafe Excel Generate High Quality RoadMaps http://www.eggheadcafe.com/tutorials/aspnet/3310004f-e1ae-45a7-9bea-7b2b970d1230/excel-generate-high-quality-roadmaps.aspx From GertSchmidt1 at gmx.de Wed Mar 2 16:29:06 2011 From: GertSchmidt1 at gmx.de (Gert Schmidt) Date: Wed, 2 Mar 2011 22:29:06 +0100 Subject: No subject Message-ID: Von meinem iPhone gesendet From nobody at nowhere.com Wed Mar 2 17:48:15 2011 From: nobody at nowhere.com (Nobody) Date: Wed, 02 Mar 2011 22:48:15 +0000 Subject: arbitrary precision linear algebra References: Message-ID: On Wed, 02 Mar 2011 06:42:22 -0800, Ben123 wrote: > Hello. I have a written Python program which currently uses numpy to > perform linear algebra operations. Specifically, I do matrix*matrix, > matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) > operations. Now I am interested in allowing arbitrary precision. I > have tried gmpy, bigfloat, mpmath, and decimal but I have been unable > to easily implement any with my current program. I suspect I have to > change some commands but I am unsure what. numpy is implemented in C, and is limited to the language's primitive types. It provides a "float96" type which I would guess is actually a "long double" (80 bits on x86). You can't extend numpy's precision by using a separate arbitary-precision library. From info at wingware.com Wed Mar 2 18:27:09 2011 From: info at wingware.com (Wingware) Date: Wed, 02 Mar 2011 18:27:09 -0500 Subject: ANN: Wing IDE 3.2.13 released Message-ID: <4D6ED24D.7080808@wingware.com> Hi, Wingware has released version 3.2.13 of Wing IDE, an integrated development environment designed specifically for the Python programming language. This is a maintenance release for Wing 3.2 users only and includes the following improvements: * Support for Python 3.2 * 6 minor bug fixes NOTE: Wing 3.2.13 is intended only for users that have not already upgraded to the latest major release, Wing IDE 4.0. See http://wingware.com/pub/wingide/3.2.13/CHANGELOG.txt for details. *Downloads* Wing IDE Professional http://wingware.com/downloads/wingide/3.2 Wing IDE Personal http://wingware.com/downloads/wingide-personal/3.2 Wing IDE 101 http://wingware.com/downloads/wingide-101/3.2 *About Wing IDE* Wing IDE is an integrated development environment designed specifically for the Python programming language. It provides powerful editing, testing, and debugging features that help reduce development and debugging time, cut down on coding errors, and make it easier to understand and navigate Python code. Wing IDE can be used to develop Python code for web, GUI, and embedded scripting applications. Wing IDE is available in three product levels: Wing IDE Professional is the full-featured Python IDE, Wing IDE Personal offers a reduced feature set at a low price, and Wing IDE 101 is a free simplified version designed for teaching entry level programming courses with Python. Version 3.2 of Wing IDE Professional includes the following major features: * Professional quality code editor with vi, emacs, and other keyboard personalities * Code intelligence for Python: Auto-completion, call tips, goto-definition, error indicators, smart indent and re-wrapping, and source navigation * Advanced multi-threaded debugger with graphical UI, command line interaction, conditional breakpoints, data value tool tips over code, watch tool, and externally launched and remote debugging * Powerful search and replace options including keyboard driven and graphical UIs, multi-file, wild card, and regular expression search and replace * Version control integration for Subversion, CVS, Bazaar, git, Mercurial, and Perforce * Integrated unit testing for the unittest, nose, and doctest frameworks * Many other features including project manager, bookmarks, code snippets, OS command integration, indentation manager, PyLint integration, and perspectives * Extremely configurable and may be extended with Python scripts Please refer to the feature list at http://wingware.com/wingide/features for a detailed listing of features by product level. System requirements are Windows 2000 or later, OS X 10.3.9 or later for PPC or Intel (requires X11 Server), or a recent Linux system (either 32 or 64 bit). Wing IDE supports Python versions 2.0.x through 3.1.x and Stackless Python. For more information, see http://wingware.com/products *Purchasing and Upgrading* Wing 3.2.13 is a free upgrade for all Wing IDE 3.x users. Version 2.x licenses must be upgraded. Upgrade a license: https://wingware.com/store/upgrade Purchase a license: https://wingware.com/store/purchase -- Wingware | Python IDE The Intelligent Development Environment for Python Programmers www.wingware.com From steve+comp.lang.python at pearwood.info Wed Mar 2 18:46:31 2011 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 02 Mar 2011 23:46:31 GMT Subject: Checking against NULL will be eliminated? References: <1299078933.17484.1425430073@webmail.messagingengine.com> Message-ID: <4d6ed6d7$0$30003$c3e8da3$5496439d@news.astraweb.com> On Wed, 02 Mar 2011 08:20:56 -0800, Steven Howe wrote: > Back at NCR, they stressed the axiom '90% of the time is spent fixing > 10% of the code'. It's not an axiom, it's a platitude. Nor is it based on any objective evidence I've ever seen. > How true that axiom is. Never more so then when faced with a programming > language fix like PEP 4000. Do you realise that "PEP 4000" was Tom Zych being sarcastic? There is no PEP 4000: http://www.python.org/dev/peps/ > Fortunately for me, I never trusted python's > complex, or should I say 'overloaded' Boolean usage. That's your loss. Just because you choose to not trust something which works deterministically and reliably, doesn't mean the rest of us shouldn't. > If I want to know if a string or list dictionary is empty: if ( len(x) > == 0 ). Apart from the unnecessary length and the pointless reliance on an implementation detail, can you please explain how the above differs from `if not x:`? For starters, how about giving an example of a built-in string, list or dictionary where `if len(x) == 0` and `if x` give different results? > If an item is None: if ( type(x) == types.NoneType ): Good grief, now that truly is astoundingly unpythonic code! `if x is None` is the right way to do it. It is also *guaranteed* to be correct, rather than being subject to failure-modes like this: >>> import types >>> types.NoneType = int # monkey-patch the module >>> x = 42 >>> if type(x) == types.NoneType: ... print "And now your world comes crashing down in flames!" ... And now your world comes crashing down in flames! No rogue libraries or functions can override the `is` operator or the None singleton. I think it is sad that you've been writing code which is *less* safe, in the mistaken belief that it was more safe. Perhaps you should stop writing C in Python, and learn to write Python. > nothing > worse then compiler errors, accept runtime errors. "I find it amusing when novice programmers believe their main job is preventing programs from crashing. ... More experienced programmers realize that correct code is great, code that crashes could use improvement, but incorrect code that doesn?t crash is a horrible nightmare." -- Chris Smith http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/ -- Steven From greg.ewing at canterbury.ac.nz Wed Mar 2 19:30:59 2011 From: greg.ewing at canterbury.ac.nz (Gregory Ewing) Date: Thu, 03 Mar 2011 13:30:59 +1300 Subject: WxPython versus Tkinter. In-Reply-To: References: <920686a4-d157-46af-9e9d-1600a064bcc2@q12g2000yqi.googlegroups.com> <8q7sgiF5tpU1@mid.individual.net> <19891784-d6a3-41ac-a097-5902a6323bc0@o21g2000prn.googlegroups.com><0b12cdb1-45b4-41e4-9bdb-074ee669d76b@k14g2000pre.googlegroups.com> <048FB74272D440A0915ABC7D76AE262B@teddy> <5782E9AD8A8342D691EB3549E5E0ED7B@octavian> Message-ID: <8t85q3FqilU1@mid.individual.net> Terry Reedy wrote: > PyGui seems to be purely a gui package, but it appear to be aimed only > at 2.x with no interest in 3.x. I'm working on 3.x conversion right now and should have something ready soon. -- Greg From greg.ewing at canterbury.ac.nz Wed Mar 2 19:40:33 2011 From: greg.ewing at canterbury.ac.nz (Gregory Ewing) Date: Thu, 03 Mar 2011 13:40:33 +1300 Subject: WxPython versus Tkinter. In-Reply-To: References: <4D3E4377.3060807@tysdomain.com> <9MB%o.14110$%64.6074@unlimited.newshosting.com> <59F6E65E3D9A46AD8D7A3863F3C1DC84@teddy> <27f53f8c-7862-4366-9352-82ae9a2f3970@k3g2000yqc.googlegroups.com> <718D13777F254C839F9564BC4275DE0A@octavian> <4D402C42.1030407@tysdomain.com> <4D40447C.4010108@tysdomain.com> <33C68A0874BE4C66AB478EDFB64C2C1D@teddy> <4D407321.3090705@web.de> <1296128007.17192.1417506961@webmail.messagingengine.com> Message-ID: <8t86c4Fv6vU1@mid.individual.net> Octavian Rasnita wrote: > How complete is this GUI lib compared with others that can be used in > Python apps? It has most of the basic things you would want. There are one or two gaps, and I'm working on filling them. > "Get the library and its documentation included in the core Python > distribution, so that truly cross-platform GUI applications may be written > that will run on any Python installation, anywhere." I'm not sure at this point whether stdlib inclusion is really a desirable goal or not. In any case, it's a very long-term issue. The first priority is to develop it to the point where it's a viable alternative to Tkinter. -- Greg From kb1pkl at aim.com Wed Mar 2 20:21:48 2011 From: kb1pkl at aim.com (Corey Richardson) Date: Wed, 02 Mar 2011 20:21:48 -0500 Subject: WxPython versus Tkinter. In-Reply-To: <8t86c4Fv6vU1@mid.individual.net> References: <4D3E4377.3060807@tysdomain.com> <9MB%o.14110$%64.6074@unlimited.newshosting.com> <59F6E65E3D9A46AD8D7A3863F3C1DC84@teddy> <27f53f8c-7862-4366-9352-82ae9a2f3970@k3g2000yqc.googlegroups.com> <718D13777F254C839F9564BC4275DE0A@octavian> <4D402C42.1030407@tysdomain.com> <4D40447C.4010108@tysdomain.com> <33C68A0874BE4C66AB478EDFB64C2C1D@teddy> <4D407321.3090705@web.de> <1296128007.17192.1417506961@webmail.messagingengine.com> <8t86c4Fv6vU1@mid.individual.net> Message-ID: <4D6EED2C.3090107@aim.com> On 03/02/2011 07:40 PM, Gregory Ewing wrote: > Octavian Rasnita wrote: > >> How complete is this GUI lib compared with others that can be used in >> Python apps? > > It has most of the basic things you would want. There are one > or two gaps, and I'm working on filling them. What are those gaps? -- Corey Richardson From steve+comp.lang.python at pearwood.info Wed Mar 2 20:48:14 2011 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 03 Mar 2011 01:48:14 GMT Subject: Checking against NULL will be eliminated? References: <1299078933.17484.1425430073@webmail.messagingengine.com> <4d6ed6d7$0$30003$c3e8da3$5496439d@news.astraweb.com> Message-ID: <4d6ef35d$0$30003$c3e8da3$5496439d@news.astraweb.com> On Wed, 02 Mar 2011 23:46:31 +0000, Steven D'Aprano wrote: > For starters, how about giving an example of a built-in string, list or > dictionary where `if len(x) == 0` and `if x` give different results? Er, how embarrassment... of course I mean either len(x) != 0, or not x, take your pick. -- Steven From freethinker at pobox.com Wed Mar 2 21:29:05 2011 From: freethinker at pobox.com (Tom Zych) Date: Wed, 02 Mar 2011 21:29:05 -0500 Subject: Checking against NULL will be eliminated? In-Reply-To: <4d6ed6d7$0$30003$c3e8da3$5496439d@news.astraweb.com> References: <1299078933.17484.1425430073@webmail.messagingengine.com> <4d6ed6d7$0$30003$c3e8da3$5496439d@news.astraweb.com> Message-ID: <4D6EFCF1.4070300@pobox.com> Steven D'Aprano wrote: > Do you realise that "PEP 4000" was Tom Zych being sarcastic? There is no > PEP 4000: Eh, well, maybe 10% sarcastic, 90% facetious. Wasn't trying to give Carl a hard time. -- Tom Zych / freethinker at pobox.com Q: I'm having problems with my Windows software. Will you help me? A: Yes. Go to a DOS prompt and type "format c:". Any problems you are experiencing will cease within a few minutes. -- Hacker Howto From ben.is.located at gmail.com Wed Mar 2 21:48:16 2011 From: ben.is.located at gmail.com (Ben123) Date: Wed, 2 Mar 2011 18:48:16 -0800 (PST) Subject: arbitrary precision linear algebra References: Message-ID: <34185c66-d377-45a4-81f4-8106898e8dd8@e8g2000vbz.googlegroups.com> On Mar 2, 4:48?pm, Nobody wrote: > On Wed, 02 Mar 2011 06:42:22 -0800, Ben123 wrote: > > Hello. I have a written Python program which currently uses numpy to > > perform linear algebra operations. Specifically, I do matrix*matrix, > > matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) > > operations. Now I am interested in allowing arbitrary precision. I > > have tried gmpy, bigfloat, mpmath, and decimal but I have been unable > > to easily implement any with my current program. I suspect I have to > > change some commands but I am unsure what. > > numpy is implemented in C, and is limited to the language's primitive > types. It provides a "float96" type which I would guess is actually a > "long double" (80 bits on x86). You can't extend numpy's precision by > using a separate arbitary-precision library. Hello. To clarify, I don't need numpy explicitly. I'm looking for an arbitrary precision library which can also do linear algebra operations: matrix*matrix, matrix*vector, matrix inverse, and eigenvalues of matrix. From ben.is.located at gmail.com Wed Mar 2 22:40:40 2011 From: ben.is.located at gmail.com (Ben123) Date: Wed, 2 Mar 2011 19:40:40 -0800 (PST) Subject: arbitrary precision linear algebra References: Message-ID: <64664821-ab8f-4425-84ce-ef3a288b1301@22g2000prx.googlegroups.com> On Mar 2, 1:34?pm, geremy condra wrote: > On Wed, Mar 2, 2011 at 10:47 AM, Ben123 wrote: > > On Mar 2, 12:22?pm, geremy condra wrote: > >> On Wed, Mar 2, 2011 at 10:21 AM, geremy condra wrote: > >> > On Wed, Mar 2, 2011 at 6:42 AM, Ben123 wrote: > >> >> Hello. I have a written Python program which currently uses numpy to > >> >> perform linear algebra operations. Specifically, I do matrix*matrix, > >> >> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix) > >> >> operations. Now I am interested in allowing arbitrary precision. I > >> >> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable > >> >> to easily implement any with my current program. I suspect I have to > >> >> change some commands but I am unsure what. > > >> >> My question is which of the arbitrary precision implementations will > >> >> most easily handle linear algebra? I don't care about speed, just ease > >> >> of use. Online tutorials for arbitrary precision linear algebra > >> >> operations would be useful. > > >> >> For example, it looks like mpmath can handle matrix operations > >> >>http://fredrik-j.blogspot.com/search?q=matrix > >> >> but I was unable to find a clear tutorial. The tutorials for most of > >> >> the arbitrary precision implementations demonstrate simple scalar > >> >> examples. > > >> >> Thanks in advance > > >> > Have you looked at Sage[0]? I don't know for a fact, but you should be > >> > able to define a matrix over RealField(precision_in_bits) and then > >> > take the eigenvalue of it. I don't know if it will actually produce > >> > the precision you need though. > > >> > Geremy Condra > > >> Apologies, forgot the links: > > >>http://www.sagemath.org/doc/constructions/linear_algebra.htmlhttp://w... > > >> Geremy Condra > > > I'm not sufficiently familiar with Sage, but from > >http://www.sagemath.org/doc/constructions/linear_algebra.html > > > "currently Sage does not implement multiprecision numerical > > eigenvalues/eigenvectors" > > > I'll ask on the Sage forums about this. In the mean time, I'm still > > trying to get arbitrary precision linear algebra in Python > > I'd suggest you read that slightly more carefully. It's speaking > specifically of RR and CC, ie, double-width reals and complex values. > Using RealField and ComplexField- the arbitrary precision real and > complex fields- seems to be working. Using the earlier example: > > sage: M1 = Matrix(RealField(1000), [[0, 2], [1, 0]]) > sage: M2 = Matrix(RR, [[0, 2], [1, 0]]) > sage: M1.eigenvalues() > [1.414213562373095048801688724209698078569671875376948073176679737990732478 462107038850387534327641572735013846230912297024924836055850737212644121497 099935831413222665927505592755799950501152782060571470109559971605970274534 596862014728517418640889198609552329230484308714321450839762603627995251407 99, > -1.414213562373095048801688724209698078569671875376948073176679737990732478 462107038850387534327641572735013846230912297024924836055850737212644121497 099935831413222665927505592755799950501152782060571470109559971605970274534 596862014728517418640889198609552329230484308714321450839762603627995251407 99] > sage: M2.eigenvalues() > [1.41421356237310, -1.41421356237310] > > Converting the first of the latter values to an element of > RealField(1000) yields much what I would expect from higher precision > arithmetic: > > ?R = RealField(1000) > sage: x = M1.eigenvalues()[0] > sage: y = R(M2.eigenvalues()[0]) > sage: x > 1.4142135623730950488016887242096980785696718753769480731766797379907324784 621070388503875343276415727350138462309122970249248360558507372126441214970 999358314132226659275055927557999505011527820605714701095599716059702745345 968620147285174186408891986095523292304843087143214508397626036279952514079 9 > sage: y > 1.4142135623730951454746218587388284504413604736328125000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000 0 > > So, while I don't know for a fact that it's using the precision you > need, it certainly does seem to be using high precision arithmetic > here. Furthermore, repeating it for various precisions seems to > increase the difference, as would be expected from better > approximations, and the number of digits in the result is consistent > with the interpretation that it is using the specified precision. > > All of this to say that it seems to be doing what you want it to do. > > Geremy Condra Hello. I was able to install Sage 4.6.1 and get your example to work. I will update this thread once I get my program to work with Sage. From lanyjie at yahoo.com Wed Mar 2 22:45:16 2011 From: lanyjie at yahoo.com (Yingjie Lan) Date: Wed, 2 Mar 2011 19:45:16 -0800 (PST) Subject: having both dynamic and static variables Message-ID: <954906.97927.qm@web121517.mail.ne1.yahoo.com> Hi everyone, Variables in Python are resolved dynamically at runtime, which comes at a performance cost. However, a lot of times we don't need that feature. Variables can be determined at compile time, which should boost up speed. Therefore, I wonder if it is a good idea to have static variables as well. So at compile time, a variable is determined to be either static or dynamic (the reference of a static varialbe is determined at compile time -- the namespace implementation will consist of two parts, a tuple for static variables and a dict for dynamic ones). The resolution can be done at the second pass of compilation. By default, variables are considered static. A variables is determined dynamic when: 1. it is declared dynamic; 2. it is not defined locally and the nearest namespace has it declared dynamic. A static variable can't be deleted, so a deleted variable must be a dynamic one: we can either enforce that the variable must be explicitly declared or allow a del statement to implicitly declare a dynamic variable. Any thoughts? Yingjie From steve+comp.lang.python at pearwood.info Thu Mar 3 00:27:01 2011 From: steve+comp.lang.python at pearwood.info (Steven D'Aprano) Date: 03 Mar 2011 05:27:01 GMT Subject: having both dynamic and static variables References: Message-ID: <4d6f26a5$0$30003$c3e8da3$5496439d@news.astraweb.com> On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrote: > Hi everyone, > > Variables in Python are resolved dynamically at runtime, which comes at > a performance cost. However, a lot of times we don't need that feature. > Variables can be determined at compile time, which should boost up > speed. [...] This is a very promising approach taken by a number of projects. Cython and Pyrex are compilers that take Python-like code with static type declarations and use it to produce compiled C code. PyPy is an implementation of Python with a JIT compiler that aims to eventually rival C for speed; it's currently about twice the speed of CPython for many tasks. It was based on the earlier project, Psyco. Neither Psyco nor PyPy require type declarations, the optimized path is taken at runtime according to the type of the data. In principle, the use of runtime data can enable the compiler to generate code which is significantly faster than would be generated at compile time. Finally, Python 3 introduced type annotations, which are currently a feature looking for a reason. -- Steven From coolaj86 at gmail.com Thu Mar 3 01:13:05 2011 From: coolaj86 at gmail.com (AJ ONeal) Date: Wed, 2 Mar 2011 23:13:05 -0700 Subject: Presentation: Offline (iPhone) Web Apps - Thurs 7pm in Lindon @ CORDA Message-ID: Sorry for spamming you all... or not actually. I'm glad. We're going to have an awesome meeting tomorrow at CORDA with two presentations about something all your people using web frameworks are hopefully interested in: Offline Web Apps and IndexDB AND Offline Web Apps on iPhone / Android / MIDs Bring a laptop and an Android, iPhone, iPad, whatever, and let's have an awesome meeting tomorrow! 7pm - 9pm CORDA Technologies, Inc. 350 South 400 West, Suite 100 Lindon, UT 84042 AJ ONeal (317) 426-6525 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lanyjie at yahoo.com Thu Mar 3 01:30:55 2011 From: lanyjie at yahoo.com (Yingjie Lan) Date: Wed, 2 Mar 2011 22:30:55 -0800 (PST) Subject: having both dynamic and static variables In-Reply-To: <4d6f26a5$0$30003$c3e8da3$5496439d@news.astraweb.com> References: <4d6f26a5$0$30003$c3e8da3$5496439d@news.astraweb.com> Message-ID: <437477.59555.qm@web121519.mail.ne1.yahoo.com> ----- Original Message ---- From: Steven D'Aprano To: python-list at python.org Sent: Thu, March 3, 2011 1:27:01 PM Subject: Re: having both dynamic and static variables On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrote: > Hi everyone, > > Variables in Python are resolved dynamically at runtime, which comes at > a performance cost. However, a lot of times we don't need that feature. > Variables can be determined at compile time, which should boost up > speed. :This is a very promising approach taken by a number of projects. Thanks, that's good to know -- so people are doing this already! :Finally, Python 3 introduced type annotations, which are currently a :feature looking for a reason. I have a use for that feature -- I have a project that help build the scaffold for people to extend CPython. See http://expy.sf.net/ It is only good for Python 2 at this moment. Yingjie From greg.ewing at canterbury.ac.nz Thu Mar 3 01:52:29 2011 From: greg.ewing at canterbury.ac.nz (Gregory Ewing) Date: Thu, 03 Mar 2011 19:52:29 +1300 Subject: WxPython versus Tkinter. In-Reply-To: References: <4D3E4377.3060807@tysdomain.com> <9MB%o.14110$%64.6074@unlimited.newshosting.com> <59F6E65E3D9A46AD8D7A3863F3C1DC84@teddy> <27f53f8c-7862-4366-9352-82ae9a2f3970@k3g2000yqc.googlegroups.com> <718D13777F254C839F9564BC4275DE0A@octavian> <4D402C42.1030407@tysdomain.com> <4D40447C.4010108@tysdomain.com> <33C68A0874BE4C66AB478EDFB64C2C1D@teddy> <4D407321.3090705@web.de> <1296128007.17192.1417506961@webmail.messagingengine.com> <8t86c4Fv6vU1@mid.individual.net> Message-ID: <8t8s5gFnp6U1@mid.individual.net> Corey Richardson wrote: > What are those gaps? That depends on what you consider to be essential. Things I would like to add include: * Combo box * Group box * Tab panel (aka "notebook") * Table view * Tree view * Rich text editor -- Greg From greg.ewing at canterbury.ac.nz Thu Mar 3 01:58:29 2011 From: greg.ewing at canterbury.ac.nz (Gregory Ewing) Date: Thu, 03 Mar 2011 19:58:29 +1300 Subject: 2to3 and maketrans Message-ID: <8t8sgnFpogU1@mid.individual.net> What is the recommended way to write code for 2.7 using maketrans() on text strings in such a way that it will convert correctly using 2to3? There seems to be two versions of maketrans in 3.x, one for text and one for bytes. Code that references string.maketrans ends up with the one for bytes, which is not what I want. But I can't write str.maketrans, because that doesn't exist in 2.x. So what am I supposed to do? -- Greg From vgnulinux at gmail.com Thu Mar 3 02:28:00 2011 From: vgnulinux at gmail.com (VGNU Linux) Date: Thu, 3 Mar 2011 12:58:00 +0530 Subject: Playing WAV file with Python In-Reply-To: References: Message-ID: On Wed, Mar 2, 2011 at 1:17 PM, VGNU Linux wrote: > Hi All, > How can I play WAV file in python without OS(like Linux/Windows/MAC) on a > device ? > On Google I found lot of different solution but related to OS's like > winsound, ossaudiodev etc which are not useful. > Thanks in advance. > > Regards, > VGNU > Hi All, Can anyone please give me any idea on this ? Regards, VGNU -------------- next part -------------- An HTML attachment was scrubbed... URL: From niklasro at gmail.com Thu Mar 3 02:50:03 2011 From: niklasro at gmail.com (Niklasro) Date: Wed, 2 Mar 2011 23:50:03 -0800 (PST) Subject: Python escape usage in django templates by GAE Message-ID: <3262816b-a696-4182-bef4-2b2b148e96ae@p24g2000vbl.googlegroups.com> Hi I got problems with escape displaying like junk when upgrading from django 0.96 to 1.2 with google app engine. The code is # let user choose authenticator for p in openIdProviders: p_name = p.split('.')[0] # take "AOL" from "AOL.com" p_url = p.lower() # "AOL.com" -> "aol.com" loginmsg = loginmsg + '%s ' % ( #'','') users.create_login_url(federated_identity=p_url), p_name) loginmsg = loginmsg + '%s' % ('login',_("Log in")) And the output is strange. View source show this:
  • Add
  • 03 Mar
  • Log in<a href="google.com">Google</a> <a href="google.com">Yahoo</a> <a href="google.com">MySpace</a> <a href="google.com">AOL</a> <a href="login">Log in</a>
Can you make ad advice how to proceed? Many thanks, Niklas Rosenrantz From clp2 at rebertia.com Thu Mar 3 02:56:55 2011 From: clp2 at rebertia.com (Chris Rebert) Date: Wed, 2 Mar 2011 23:56:55 -0800 Subject: Playing WAV file with Python In-Reply-To: References: Message-ID: On Tue, Mar 1, 2011 at 11:47 PM, VGNU Linux wrote: > Hi All, > How can I play WAV file in python without OS(like Linux/Windows/MAC) on a > device ? > On Google I found lot of different solution but related to OS's like > winsound, ossaudiodev etc which are not useful. Do you mean you want your code to be cross-platform, or what? "Without OS" is rather vague. What are you trying to accomplish? Regards, Chris -- http://blog.rebertia.com From clp2 at rebertia.com Thu Mar 3 03:11:22 2011 From: clp2 at rebertia.com (Chris Rebert) Date: Thu, 3 Mar 2011 00:11:22 -0800 Subject: Python escape usage in django templates by GAE In-Reply-To: <3262816b-a696-4182-bef4-2b2b148e96ae@p24g2000vbl.googlegroups.com> References: <3262816b-a696-4182-bef4-2b2b148e96ae@p24g2000vbl.googlegroups.com> Message-ID: On Wed, Mar 2, 2011 at 11:50 PM, Niklasro wrote: > Hi > I got problems with escape displaying like junk when upgrading from > django 0.96 to 1.2 with google app engine. > The code is > > ? ? # let user choose authenticator > ? ? ? ?for p in openIdProviders: > ? ? ? ? ? ?p_name = p.split('.')[0] # take "AOL" from "AOL.com" > ? ? ? ? ? ?p_url = p.lower() ? ? ? ?# "AOL.com" -> "aol.com" > ? ? ? ? ? ?loginmsg = loginmsg + '%s ' % ( #'','') > ? ? ? ? ? ? ? ? ? users.create_login_url(federated_identity=p_url), > p_name) > ? ? ? ?loginmsg = loginmsg + '%s' % > ('login',_("Log in")) > > And the output is strange. View source show this: > >
  • Add
  • 03 Mar
  • > >
  • Log in<a href="google.com">Google</a> <a > href="google.com">Yahoo</a> <a > href="google.com">MySpace</a> <a > href="google.com">AOL</a> <a > href="login">Log in</a>
  • > >
> > Can you make ad advice how to proceed? Many thanks, IIRC, at some point after v0.96, Django made HTML-character-entity-escaping of values in templates the default behavior; your code assumes the opposite, hence your excessive escaping problem. I'm sure there's a way to indicate that certain values should be treated literally and not get HTML-escaped. Check the transition docs / release notes, and/or try asking on the django-specific mailing list (http://groups.google.com/group/django-users ) (You should probably ask there first with any future Django questions too.) Cheers, Chris -- http://blog.rebertia.com From landimatte at gmail.com Thu Mar 3 03:15:46 2011 From: landimatte at gmail.com (Matteo Landi) Date: Thu, 3 Mar 2011 00:15:46 -0800 (PST) Subject: Playing WAV file with Python In-Reply-To: Message-ID: I imagine he is looking for a cross-platform solution: n this case, I guess the most suitable solution is pygame. Regards, Matteo From landimatte at gmail.com Thu Mar 3 03:15:46 2011 From: landimatte at gmail.com (Matteo Landi) Date: Thu, 3 Mar 2011 00:15:46 -0800 (PST) Subject: Playing WAV file with Python In-Reply-To: Message-ID: I imagine he is looking for a cross-platform solution: n this case, I guess the most suitable solution is pygame. Regards, Matteo From vgnulinux at gmail.com Thu Mar 3 03:17:54 2011 From: vgnulinux at gmail.com (VGNU Linux) Date: Thu, 3 Mar 2011 13:47:54 +0530 Subject: Playing WAV file with Python In-Reply-To: References: Message-ID: Hi, On Thu, Mar 3, 2011 at 1:26 PM, Chris Rebert wrote: > On Tue, Mar 1, 2011 at 11:47 PM, VGNU Linux wrote: > > Hi All, > > How can I play WAV file in python without OS(like Linux/Windows/MAC) on a > > device ? > > On Google I found lot of different solution but related to OS's like > > winsound, ossaudiodev etc which are not useful. > > Do you mean you want your code to be cross-platform, or what? > "Without OS" is rather vague. What are you trying to accomplish? > I will be using WAVE on embedded devices, and the device will not have any OS's. So I am looking for modules which can play WAVE sound without underlying OS. > Regards, > Chris > -- > http://blog.rebertia.com Regards, VGNU -------------- next part -------------- An HTML attachment was scrubbed... URL: From niklasro at gmail.com Thu Mar 3 03:20:15 2011 From: niklasro at gmail.com (Niklas RTZ) Date: Thu, 3 Mar 2011 08:20:15 +0000 Subject: Python escape usage in django templates by GAE In-Reply-To: References: <3262816b-a696-4182-bef4-2b2b148e96ae@p24g2000vbl.googlegroups.com> Message-ID: Wow, that really explains it superbly also pointing me to the right place onwards. Many thanks Chris! On Thu, Mar 3, 2011 at 8:11 AM, Chris Rebert wrote: > On Wed, Mar 2, 2011 at 11:50 PM, Niklasro wrote: >> Hi >> I got problems with escape displaying like junk when upgrading from >> django 0.96 to 1.2 with google app engine. >> The code is >> >> ? ? # let user choose authenticator >> ? ? ? ?for p in openIdProviders: >> ? ? ? ? ? ?p_name = p.split('.')[0] # take "AOL" from "AOL.com" >> ? ? ? ? ? ?p_url = p.lower() ? ? ? ?# "AOL.com" -> "aol.com" >> ? ? ? ? ? ?loginmsg = loginmsg + '%s ' % ( #'','') >> ? ? ? ? ? ? ? ? ? users.create_login_url(federated_identity=p_url), >> p_name) >> ? ? ? ?loginmsg = loginmsg + '%s' % >> ('login',_("Log in")) >> >> And the output is strange. View source show this: >> >>
  • Add
  • 03 Mar
  • >> >>
  • Log in<a href="google.com">Google</a> <a >> href="google.com">Yahoo</a> <a >> href="google.com">MySpace</a> <a >> href="google.com">AOL</a> <a >> href="login">Log in</a>
  • >> >>
>> >> Can you make ad advice how to proceed? Many thanks, > > IIRC, at some point after v0.96, Django made > HTML-character-entity-escaping of values in templates the default > behavior; your code assumes the opposite, hence your excessive > escaping problem. I'm sure there's a way to indicate that certain > values should be treated literally and not get HTML-escaped. > > Check the transition docs / release notes, and/or try asking on the > django-specific mailing list > (http://groups.google.com/group/django-users ) > (You should probably ask there first with any future Django questions too.) > > Cheers, > Chris > -- > http://blog.rebertia.com > From clp2 at rebertia.com Thu Mar 3 03:24:10 2011 From: clp2 at rebertia.com (Chris Rebert) Date: Thu, 3 Mar 2011 00:24:10 -0800 Subject: Playing WAV file with Python In-Reply-To: References: Message-ID: On Thu, Mar 3, 2011 at 12:17 AM, VGNU Linux wrote: > On Thu, Mar 3, 2011 at 1:26 PM, Chris Rebert wrote: >> On Tue, Mar 1, 2011 at 11:47 PM, VGNU Linux wrote: >> > How can I play WAV file in python without OS(like Linux/Windows/MAC) on >> > a >> > device ? >> > On Google I found lot of different solution but related to OS's like >> > winsound, ossaudiodev etc which are not useful. >> >> Do you mean you want your code to be cross-platform, or what? >> "Without OS" is rather vague. What are you trying to accomplish? > > I will be using WAVE on embedded devices, and the device will not have any > OS's. So I am looking for modules which can play WAVE sound without > underlying OS. What implementation of Python are you going to use? I don't personally know of any that can run on the "bare metal" without an OS. Cheers, Chris From vgnulinux at gmail.com Thu Mar 3 04:32:51 2011 From: vgnulinux at gmail.com (VGNU Linux) Date: Thu, 3 Mar 2011 15:02:51 +0530 Subject: Playing WAV file with Python In-Reply-To: References: Message-ID: On Thu, Mar 3, 2011 at 1:54 PM, Chris Rebert wrote: > On Thu, Mar 3, 2011 at 12:17 AM, VGNU Linux wrote: > > On Thu, Mar 3, 2011 at 1:26 PM, Chris Rebert wrote: > >> On Tue, Mar 1, 2011 at 11:47 PM, VGNU Linux > wrote: > >> > How can I play WAV file in python without OS(like Linux/Windows/MAC) > on > >> > a > >> > device ? > >> > On Google I found lot of different solution but related to OS's like > >> > winsound, ossaudiodev etc which are not useful. > >> > >> Do you mean you want your code to be cross-platform, or what? > >> "Without OS" is rather vague. What are you trying to accomplish? > > > > I will be using WAVE on embedded devices, and the device will not have > any > > OS's. So I am looking for modules which can play WAVE sound without > > underlying OS. > > What implementation of Python are you going to use? I don't personally > know of any that can run on the "bare metal" without an OS. > I am planning to use python-on-a-chip(PyMite) which can be run without an OS therefore I am looking for a module/library which can play sound files. > Cheers, > Chris > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gelonida at gmail.com Thu Mar 3 04:40:20 2011 From: gelonida at gmail.com (Gelonida) Date: Thu, 03 Mar 2011 10:40:20 +0100 Subject: debugging segfaults in pythen PyQt (QWebview) Message-ID: Hi, I have a QWebview application, which segfaults rather often, but not all the time. I assume it is some kind of race condition when loading a certain web page with quite some built in AJax. How can I debug it? The application crashes under Windows and under Linux. I enabled already core dumps and am able to start gdb python.exe core I guess the command "bt" will be able to give m a backtrace of the C program Is there any way to obtain the related backtrace of the python script? I'm at a complete loss of what I am doing wrong in my script and would hope to get at least some indication. From pavlovevidence at gmail.com Thu Mar 3 05:01:57 2011 From: pavlovevidence at gmail.com (Carl Banks) Date: Thu, 3 Mar 2011 02:01:57 -0800 (PST) Subject: Checking against NULL will be eliminated? References: <1299078933.17484.1425430073@webmail.messagingengine.com> <4d6ed6d7$0$30003$c3e8da3$5496439d@news.astraweb.com> Message-ID: <08e595a3-7315-4de3-b765-446bb473cf70@f36g2000pri.googlegroups.com> On Mar 2, 3:46?pm, Steven D'Aprano wrote: > > Fortunately for me, I never trusted python's > > complex, or should I say 'overloaded' Boolean usage. > > That's your loss. Just because you choose to not trust something which > works deterministically and reliably, doesn't mean the rest of us > shouldn't. Perl works deterministically and reliably. In fact, pretty much every language works deterministically and reliably. Total non-argument. Carl Banks From tonyplayer101 at gmail.com Thu Mar 3 05:04:23 2011 From: tonyplayer101 at gmail.com (tony player) Date: Thu, 3 Mar 2011 02:04:23 -0800 (PST) Subject: --------------> Web design in Chennai <-------------- Message-ID: <6f6e249d-aa45-4096-8f40-9ef0fa13ed6e@i39g2000prd.googlegroups.com> Web Design in Chennai ****************************************** http://webdesignchennai.co.in/ ****************************************** Web Design Chennai offers Web Design in Chennai,website designing,maintenance in chennai,Web Designing and development Companies Chennai,web hosting in chennai,web site maintenance chennai. From jeanmichel at sequans.com Thu Mar 3 05:07:45 2011 From: jeanmichel at sequans.com (Jean-Michel Pichavant) Date: Thu, 03 Mar 2011 11:07:45 +0100 Subject: Checking against NULL will be eliminated? In-Reply-To: <4D6E6E68.5040504@gmail.com> References: <1299078933.17484.1425430073@webmail.messagingengine.com> <4D6E6E68.5040504@gmail.com> Message-ID: <4D6F6871.7080702@sequans.com> Steven Howe wrote: > > If an item is None: if ( type(x) == types.NoneType ): > Bye the way, the beauty of python is that "If an item is None" translates into "If item is None". JM From freethinker at pobox.com Thu Mar 3 05:30:06 2011 From: freethinker at pobox.com (Tom Zych) Date: Thu, 03 Mar 2011 05:30:06 -0500 Subject: Checking against NULL will be eliminated? In-Reply-To: <08e595a3-7315-4de3-b765-446bb473cf70@f36g2000pri.googlegroups.com> References: <1299078933.17484.1425430073@webmail.messagingengine.com> <4d6ed6d7$0$30003$c3e8da3$5496439d@news.astraweb.com> <08e595a3-7315-4de3-b765-446bb473cf70@f36g2000pri.googlegroups.com> Message-ID: <4D6F6DAE.2030507@pobox.com> Carl Banks wrote: > Perl works deterministically and reliably. In fact, pretty much every > language works deterministically and reliably. Total non-argument. Well, yes. I think the real issue is, how many surprises are waiting to pounce on the unwary developer. C is deterministic and reliable, but full of surprises. Python is generally low in surprises. Using "if " is one place where you do have to think about unintended consequences. -- Tom Zych / freethinker at pobox.com Q: I'm having problems with my Windows software. Will you help me? A: Yes. Go to a DOS prompt and type "format c:". Any problems you are experiencing will cease within a few minutes. -- Hacker Howto From stephen at recombinant.co.uk Thu Mar 3 05:38:26 2011 From: stephen at recombinant.co.uk (Stephen Evans) Date: Thu, 3 Mar 2011 02:38:26 -0800 (PST) Subject: builtin max() and weak ordering Message-ID: <2322f9a5-642a-4245-a5ab-d230a364d060@glegroupsg2000goo.googlegroups.com> The CPython builtins min() and max() both return the first satisfactory object found. This behaviour is undocumented. Examining the source in bltinmodule.c shows that min() and max() both result in a call to min_max() with Py_LT and Py_GT passed respectively. The behaviour of min() is correct. But with weak orderings of equivalent objects, surely max() should be using Py_GE ? (the converse of Py_LT). Should I be reporting a bug, submitting a patch, making feature request or suggesting a documentation update ? For a more mathematical consideration (not casual reading): Stepanov, Alexander and Paul McJones. 2009. Elements of Programming. Addison Wesley. Pages 52-53 The code below demonstrates the issue. Using the total key gives the correct result. Using the weak key returns the "incorrect" result. Tested with Python 2.7.1 and 3.1.2 (applies to 3.2) Stephen Evans from __future__ import print_function from operator import attrgetter class Pair(): def __init__(self, m0, m1): self.m0, self.m1 = m0, m1 # rich comparisons are not used def __lt__(self, other): raise NotImplementedError def __le__(self, other): raise NotImplementedError def __eq__(self, other): raise NotImplementedError def __ne__(self, other): raise NotImplementedError def __gt__(self, other): raise NotImplementedError def __ge__(self, other): raise NotImplementedError def __repr__(self): """repr() as a tuple""" return repr((self.m0, self.m1)) @property def total(self): return (self.m0, self.m1) @property def weak(self): return self.m0 def test(): """ demonstrate the failure of the builtin max() to respect the original order of equivalent objects. """ r = [ (0, 1), (0, 2) ] r = [ Pair(*p) for p in r ] # verify total and weak ordering assert r == sorted(r, key=attrgetter('weak')) == sorted(r, key=attrgetter('total')) print(r) # from the sorted list print(r[0], r[-1]) # using total ordering print(min(r, key=attrgetter('total')), max(r, key=attrgetter('total'))) # using weak ordering, builtin_min and builtin_max functions in bltinmodule.c # min works as expected using Py_LT # max uses Py_GT rather than the converse of Py_LT (which would be Py_GE) print(min(r, key=attrgetter('weak')), max(r, key=attrgetter('weak'))) test() From abhinav.sood at radbox.me Thu Mar 3 05:50:14 2011 From: abhinav.sood at radbox.me (Abhinav Sood) Date: Thu, 03 Mar 2011 10:50:14 GMT Subject: Anybody use web2py? References: <6oidnWzFKdtK6LHWnZ2dnUVZ_opi4p2d@supernews.com> Message-ID: <2011335505usenet@eggheadcafe.com> We have built Radbox.me on web2py and it's amazing.. > On Saturday, December 19, 2009 1:42 AM AppRe Godeck wrote: > Just curious if anybody prefers web2py over django, and visa versa. I > know it is been discussed on a flame war level a lot. I am looking for a > more intellectual reasoning behind using one or the other. >> On Saturday, December 19, 2009 3:48 PM Yarko wrote: >> Chevy or Ford? (or whatever pair you prefer) >> vi or emacs? >> ... >> >> These hold one aspect. >> >> Hammer or a saw? >> >> Hold (perhaps) another... >> >> us.pycon.org, for example, uses both (in reality a mix of the above >> argument sets, but at least evidence of the latter: different tools >> for different problems). >> >> From a rapid prototyping perspective, web2py is heavily data-table >> efficient: that is, you can define a system, and all the app creation, >> form generation and validation have defaults out of the box, and you >> can have a "sense" of your data-centric structure in minutes. The >> same argument can go against ("how do I get it to do exactly what _I_ >> want it to, not what it wants to?") - that is, defaults hide things, >> and that has two edges... >> >> From a layout/user interaction rapid prototyping perspective, web2py >> is just entering the waters... >> >> There is a steady growth of users, and (as you would expect for a >> young framework), a lot of changes going on (although backward >> compatiblity is a constant mantra when considering changes, that too >> is a double-edged thing). >> >> I find web2py useful, fast, and at times / in areas not as evolved / >> flexible as I'd like. BUT I could learn it quickly, and get to work >> quickly. >> >> I have taken an intro Django course (at a PyCon), have built a few >> things with it (not nearly as many as I have w/ web2py), and I _can_ >> do things in it - so I will let someone else w/ django "miles" under >> their belt speak their mind. >> >> - Yarko >>> On Saturday, December 19, 2009 3:51 PM Yarko wrote: >>> Oh and one more thing: I find it dependable (not that snapshots do not >>> have bugs, but that they are well defined, not "wild", and quickly >>> fixed - and if you work around them, you can also depend on the system >>> you have created). FYI, it does the money/registration part of PyCon >>> (past 2 years). >>>> On Saturday, December 19, 2009 6:32 PM mdipierro wrote: >>>> Of course I am the most biased person in the world on this topic but >>>> perhaps you want to hear my bias. >>>> >>>> A little bit of history... I thought a Django course at DePaul >>>> University and built a CMS for the United Nations in Django. I loved >>>> it. Then I also learned RoR. I found RoR more intuitive and better for >>>> rapid prototyping. I found Django much faster and more solid. I >>>> decided to build a proof of concept system that was somewhat in >>>> between Django and Rails with focus on 3 features: 1) easy to start >>>> with (no installation, no configuration, web based IDE, web based >>>> testing, debugging, and database interface); 2) enforce good practice >>>> (MVC, postbacks); 3) secure (escape all output, talk to database via >>>> DAL to present injections, server-side cookies with uuid session keys, >>>> role based access control with pluggable login methods, regex >>>> validation for all input including URLs). >>>> >>>> Originally it was a proof of concept, mostly suitable for teaching. >>>> Then lots of people helped to make it better and turn it into a >>>> production system. Now he had more than 50 contributors and a more >>>> than 20 companies that provide support. >>>> >>>> There are some distinctive features of web2py vs Django. Some love >>>> them, some hate hate them (mostly people who did not try them): >>>> >>>> - We promise backward compatibility. I do not accept patches that >>>> break it. It has been backward compatible for three years and I will >>>> enforce the copyright, if necessary, in order to ensure it for the >>>> future. >>>> >>>> - In web2py models and controllers are not modules. They are not >>>> imported. They are executed. This means you do not need to import >>>> basic web2py symbols. They are already defined in the environment that >>>> executes the models and controllers (like in Rails). This also means >>>> you do not need to restart the web server when you edit your app. You >>>> can import additional modules and you can define modules if you like. >>>> >>>> - You have a web based IDE with editor, some conflict resolution, >>>> Mercurial integration, ticketing system, web-based testing and >>>> debugging. >>>> >>>> - The Database Abstraction Layer (DAL) is closed to SQL than Dango ORM >>>> is. This means it does less for you (in particular about many 2 many) >>>> but it is more flaxible when it comes to complex joins, aggregates and >>>> nested selects. >>>> >>>> - The DAL supports out of the box SQLite, MySQL, PostgreSQL, MSSQL, >>>> Oracle, FireBird, FireBase, DB2, Informix, Ingres, and the Google App >>>> Engine (except for joins and multi-entity transactions). We plan >>>> support for Sybase and MongoDB within one month. >>>> >>>> - The DAL supports transactions. It means it will create and/or ALTER >>>> tables for you as your model changes. This can be disabled. >>>> >>>> - The DAL has partial support for some legacy databases that do not >>>> have an 'id' auto increment primary key. >>>> >>>> - It has a plugin and a component systems (here is an old video: >>>> http://www.vimeo.com/7182692 the video says "experimental" but this is >>>> now stable in trunk, although not very well documented). >>>> >>>> - both systems have a web based database interface (Django calls it >>>> "admin", web2py calls it "appadmin, not to be confused with web2py >>>> "admin", the IDE). The Django one is more polished, customizable and >>>> designed to be exposed to users. The web2py one is raw and designed >>>> for the administrator. It is not customizable. Because it is designed >>>> for the administrator and requires administrator login it allows >>>> arbitrary DAL code to be executed. It can be disabled. >>>> >>>> Here is the last app I built with it: http://www.vimeo.com/7182692 >>>> running on GAE here: http://www.vimeo.com/7182692 >>>> >>>> >>>> Here http://www.vimeo.com/6507384 you can see a video in which I >>>> rewrite the Django polls tutorial in web2py. You will get an idea of >>>> some of the differences. >>>> >>>> Anyway, I think both system are great. Spend 15 minutes (no more) with >>>> each to make up your mind, and stick with it. >>>> >>>> Massimo >>>>> On Saturday, December 19, 2009 6:35 PM mdipierro wrote: >>>>> Errata. I said "The dal supports transactions" where I meant "the dal >>>>> supports migrations". >>>>> Of course it also supports "transactions" as well as "distributed >>>>> transactions". >>>>> >>>>> >>>>> w.vimeo.com/7182692the video says "experimental" but this is >>>>>> On Saturday, December 19, 2009 6:42 PM Jake wrote: >>>>>> Hi! I come from a mvc framework background in a few different >>>>>> languages (java, php, ruby). I am only a couple weeks into web2py, I am >>>>>> finding web2py a joy to work with. I will not waste your time with the >>>>>> features it provides, as you can find these on the website. There is >>>>>> also a copy of the lead developer's book on the site, and its very >>>>>> well written. >>>>>> >>>>>> If web2py intrigues you, I would recommend just trying it for a few >>>>>> days. it is pretty small (relatively few exposed classes and >>>>>> functions) and very comprehensible, so you will not really have to invest >>>>>> much if you decide to try it and do not like it. The mailing list is >>>>>> active and responsive, and the lead developer happens to have chimed >>>>>> in on every question i've asked. On the down side, the irc community >>>>>> is very small. >>>>>> >>>>>> Good Luck, >>>>>> Jake >>>>>>> On Saturday, December 19, 2009 7:07 PM mdipierro wrote: >>>>>>> Errata 2. Before people jump on me. I said "copyright" but I meant >>>>>>> "trademark". Of course web2py is GPL2 so everybody can copy and modify >>>>>>> it. >>>>>>> >>>>>>> The license has an exception that basically treats the compiled web2py >>>>>>> as freeware. >>>>>>> >>>>>>> The license does not extend to apps that require web2py. They can be >>>>>>> distributed under any license you like, included closed source and >>>>>>> bundled with the web2py binary. >>>>>>> >>>>>>> w.vimeo.com/7182692the video says "experimental" but this is >>>>>>>> On Saturday, December 19, 2009 9:39 PM AppRe Godeck wrote: >>>>>>>> tis the nature of man kind to war. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> It seems that this is the biggest issue surrounding web2py, from my >>>>>>>> research, is the ability to customize the defaults (the easy). If all >>>>>>>> web2py offers is default views, then it may be good for proof of concept >>>>>>>> projects, however I cannot see in my right mind, proofing an application, >>>>>>>> and then turning around to write it in django because more than the >>>>>>>> defaults is needed. >>>>>>>> >>>>>>>> Thanks for your replies, I was hoping to hear from some django people as >>>>>>>> well. Especially if you choose django over web2py, and why. >>>>>>>> >>>>>>>> If you have time to write, >>>>>>>> >>>>>>>> Give a situation where you would prefer to have django over web2py, and >>>>>>>> then another situation you would prefer web2py over django, and why. >>>>>>>> >>>>>>>> Why does web2py have classes that represent HTML? I cannot see ever >>>>>>>> needing to write VIEW code in my controller, since thats what views are >>>>>>>> for. >>>>>>>> >>>>>>>> It seems that even though web2py is fast, supports lots of features, the >>>>>>>> fact that in the end it gets in the way of doing what you want is it is >>>>>>>> downfall. Django, even though requiring more "ground work", this ground >>>>>>>> work becomes a solid foundation on which to build your application on. >>>>>>>>> On Saturday, December 19, 2009 10:04 PM mdipierro wrote: >>>>>>>>> You do not need to use but if, for example, you want to build a menu >>>>>>>>> recursively, having a server-side presentation of the DOM allows to do >>>>>>>>> it without string manipulation. It is safer and less error prone. >>>>>>>>> Anyway, it is not something you must use. >>>>>>>>> >>>>>>>>> Lots of the features are optional. Like the web based IDE. If you do >>>>>>>>> not like it, you can use the shell like you use Django. >>>>>>>>> >>>>>>>>> features, the >>>>>>>>> >>>>>>>>> What do you mean by "gets in the way"? Could you provide an example? >>>>>>>>>> On Saturday, December 19, 2009 11:21 PM Thadeus Burgess wrote: >>>>>>>>>> a >>>>>>>>>> n >>>>>>>>>> t >>>>>>>>>> t >>>>>>>>>> s >>>>>>>>>> >>>>>>>>>> You need to realize that web2py is still a relatively young framework, >>>>>>>>>> issues to certain problems are currently being addressed in web2py. >>>>>>>>>> For example, the DAL is being re-written in a much more modular maner, >>>>>>>>>> allowing the addition of new database backends to be quite seemless. >>>>>>>>>> Other parts of web2py will follow as web2py grows I am sure. I >>>>>>>>>> would not disqualify web2py based off what you read, you really need to >>>>>>>>>> try it for yourself, and if you run into a problem, I am sure, some way >>>>>>>>>> there is a solution if you bring up the problem, and your problem >>>>>>>>>> might even help web2py to grow to be an even better framework. >>>>>>>>>> >>>>>>>>>> I dare you to try developing a web application with both. Spend one >>>>>>>>>> day working on a simple django application, polls, blog, image >>>>>>>>>> gallery, family pet tree, you name it. Then take the next day, and >>>>>>>>>> write the same application with web2py, and you decide. In the end, >>>>>>>>>> both are tools and you need to figure out what is best for YOU. >>>>>>>>>>> On Saturday, December 19, 2009 11:30 PM Anand Vaidya wrote: >>>>>>>>>>> Hi, >>>>>>>>>>> >>>>>>>>>>> I am not very familiar with Django, anyway, my reasons for selecting >>>>>>>>>>> web2py are: >>>>>>>>>>> >>>>>>>>>>> - I believe Django naturally "fits in" to a publishing type of >>>>>>>>>>> application. web2py seems to be more focussed on being a front-end to >>>>>>>>>>> "applications" not so much for CMS type or newspaper type publishing. >>>>>>>>>>> (There is a web2py based wiki/CMS app, though). Though, I agree either >>>>>>>>>>> could fulfil any of these roles. >>>>>>>>>>> >>>>>>>>>>> - Django documentation is vastly superior, including third party books >>>>>>>>>>> etc. After the v2 Web2py book, we do have solid documentation, but >>>>>>>>>>> web2py evolves so quickly, there are always things that are documented >>>>>>>>>>> only on the google groups, slices or wiki. >>>>>>>>>>> >>>>>>>>>>> - Many training courses are available pretty much everywhere for >>>>>>>>>>> Django. Web2py needs to catch up - it will, probably. >>>>>>>>>>> >>>>>>>>>>> - Web2py lowers the barrier to entry into python web programming, >>>>>>>>>>> since it is well thought out and intuitive. The support on the mailing >>>>>>>>>>> list is fantastic, though I have no idea how good the support for >>>>>>>>>>> Django is. w2py is easy to pick up for even a python newbie. >>>>>>>>>>> >>>>>>>>>>> - Massimo claims about the backward compatibility. I was surprised >>>>>>>>>>> recently when I took an app I deployed several months (and several >>>>>>>>>>> versions old) and retested it with the latest SVN code. And it worked >>>>>>>>>>> fine! Which means, if my client asks for it, I could swap out old w2py >>>>>>>>>>> with the latest code with no problems. >>>>>>>>>>> >>>>>>>>>>> My $0.02 >>>>>>>>>>>> On Sunday, December 20, 2009 2:32 PM Lacrima wrote: >>>>>>>>>>>> Sorry, if this is not related to this topic. >>>>>>>>>>>> Does web2py support distributed transactions with Google App Engine >>>>>>>>>>>> Datastore? >>>>>>>>>>>>> On Sunday, December 20, 2009 3:14 PM mdipierro wrote: >>>>>>>>>>>>> The concept of distributed transaction does not make sense on GAE >>>>>>>>>>>>> because there is only one datastore. >>>>>>>>>>>>> >>>>>>>>>>>>> It supports regular transactions on GAE to the extent that GAE >>>>>>>>>>>>> supports them but you have to use the GAE run_in_transaction API >>>>>>>>>>>>> explictely. >>>>>>>>>>>>> >>>>>>>>>>>>> It does support distributed transactions with multiple database >>>>>>>>>>>>> connection to postgresq, mysql and/or firebird. >>>>>>>>>>>>> I think this is related to the topic because it is a distinctive >>>>>>>>>>>>> feature of web2py. >>>>>>>>>>>>> >>>>>>>>>>>>> Massimo >>>>>>>>>>>>>> On Sunday, December 20, 2009 4:09 PM Baron wrote: >>>>>>>>>>>>>> You *can* customize web2py views ... >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> I use these in my views when a HTML tag has multiple dynamic >>>>>>>>>>>>>> properties because it looks more neat. >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> I came to web2py a year back after writing applications in many other >>>>>>>>>>>>>> frameworks (Turbogears / Symonfy / Rails / Django) and find myself >>>>>>>>>>>>>> more productive with web2py. >>>>>>>>>>>>>> So as others have said - try both. Write a small application in both >>>>>>>>>>>>>> to see which suits you. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Richard >>>>>>>>>>>>>>> On Sunday, December 20, 2009 5:57 PM mdipierro wrote: >>>>>>>>>>>>>>> People seem to think that because web2py has a default for almost >>>>>>>>>>>>>>> everything (part of its design) than you must use the default. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> - There is a web based IDE but you *can* use the shell instead (like >>>>>>>>>>>>>>> you do in Django) >>>>>>>>>>>>>>> - There are migrations but you *can* disable then (and it works like >>>>>>>>>>>>>>> Django that does not do migrations) >>>>>>>>>>>>>>> - There are default views for every action but you *can* make your own >>>>>>>>>>>>>>> - There is a default route to every action but you *can* create your >>>>>>>>>>>>>>> own routes.py, equivalent to Django urls.py >>>>>>>>>>>>>>> - There is a default for form layout but you *can* customize them in >>>>>>>>>>>>>>> multiple ways >>>>>>>>>>>>>>> - There is a default widget for every field but you *can* change it or >>>>>>>>>>>>>>> define your own >>>>>>>>>>>>>>> - There is a default validator for every field but you *can* change it >>>>>>>>>>>>>>> or create your own >>>>>>>>>>>>>>> - It comes with a default layout.html but you can user any other html/ >>>>>>>>>>>>>>> css layout or make your own >>>>>>>>>>>>>>> - It comes with jQuery but you *can* use any other javascript library >>>>>>>>>>>>>>> - It default to email/password login but you *can* use other >>>>>>>>>>>>>>> authentication methods (gmail, twitter, openid, rpx, cas, ldap). >>>>>>>>>>>>>>> - etc. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> The only things that web2py does not let you customize are things that >>>>>>>>>>>>>>> have security implications (like how sessions and uploads are >>>>>>>>>>>>>>> handled). >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> t >>>>>>>>>>>>>>> , >>>>>>>>>>>>>>>> On Monday, December 21, 2009 3:25 AM Bruno Desthuilliers wrote: >>>>>>>>>>>>>>>> AppRe Godeck a ??crit : >>>>>>>>>>>>>>>> (snip) >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> I do not know what a "django people" is - but if you mean "django core >>>>>>>>>>>>>>>> developper", I am not one of them. Now wrt while I use Django instead of >>>>>>>>>>>>>>>> web2py, the answer is quite simple: web2py did not exist when I started >>>>>>>>>>>>>>>> using Django !-) >>>>>>>>>>>>>>>>> On Monday, December 21, 2009 3:32 AM Bruno Desthuilliers wrote: >>>>>>>>>>>>>>>>> Thadeus Burgess a ?crit : >>>>>>>>>>>>>>>>> (snip) >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> The problem is not how easy it makes to write a *simple* (should I say >>>>>>>>>>>>>>>>> "braindead" ?) dummy test app, but how easy - or even possible -it makes >>>>>>>>>>>>>>>>> writing and maintaining a *real-world* complex application. >>>>>>>>>>>>>>>>>> On Monday, December 21, 2009 3:50 AM Bruno Desthuilliers wrote: >>>>>>>>>>>>>>>>>> mdipierro a ?crit : >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Indeed !-) >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> I assume you mean "executed in an environment defined by the framework"... >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Ok. As far as I am concerned : show stops here. >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> The dev server that comes with Django do the autorestart thing. And you >>>>>>>>>>>>>>>>>> *do not* "edit yoour app" directly on the production server, do you ? >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Why should I care ? I have a way better development environment on my >>>>>>>>>>>>>>>>>> own box. >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> What if use something else than mercurial ? >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> ...does not belong to the framework. FWIW, I already have a ticketing >>>>>>>>>>>>>>>>>> system that is language/techno agnostic, thanks. >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Err... how does schema changes relates to transactions ??? >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Now FWIW, when my schema do change, the create/alter table code is >>>>>>>>>>>>>>>>>> usually the most trivial part - there are quite a few other things to >>>>>>>>>>>>>>>>>> do, that no framework will ever be abale to guess. IOW, you *do* have to >>>>>>>>>>>>>>>>>> write a migration script anyway. >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Django's ORM has full support for tables that do not use an "auto_id" key. >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Once again, while doing a quick dummy test app can give you a first >>>>>>>>>>>>>>>>>> general "feel" of the tool, it means nothing wrt/ complex real-world >>>>>>>>>>>>>>>>>> applications. >>>>>>>>>>>>>>>>>>> On Monday, December 21, 2009 3:55 AM Bruno Desthuilliers wrote: >>>>>>>>>>>>>>>>>>> Anand Vaidya a ?crit : >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> I just do not get why so many people have this antipattern... None of the >>>>>>>>>>>>>>>>>>> projects I did with Django were on the CMS side. Django is *NOT* a >>>>>>>>>>>>>>>>>>> "CMS-growned-into-a-framework" in any way, it is a web development >>>>>>>>>>>>>>>>>>> framework, period. >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> Don't "believe", check. >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> Please provide *any* evidence of your (plain wrong) assertions and >>>>>>>>>>>>>>>>>>> assumptions... >>>>>>>>>>>>>>>>>>>> On Monday, December 21, 2009 10:02 AM mdipierro wrote: >>>>>>>>>>>>>>>>>>>> yes >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> It is your choice but, why? >>>>>>>>>>>>>>>>>>>> Exec/eval is only true distinctive feature of an interpreted language >>>>>>>>>>>>>>>>>>>> vs a compiled language. >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> Unfortunately it has happened. >>>>>>>>>>>>>>>>>>>> In my experience the distinction between development and production is >>>>>>>>>>>>>>>>>>>> fiction. >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> I only use emacs. I do not use the web based IDE much myself but I >>>>>>>>>>>>>>>>>>>> found it really helps in learning how to use the framework. >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> You can use any version control you want, the same way you would in >>>>>>>>>>>>>>>>>>>> Django. web2py itself is version controlled in both bazaar and >>>>>>>>>>>>>>>>>>>> mercurial. The only think about mercurial is that, if you have it >>>>>>>>>>>>>>>>>>>> installed, the web based IDE lets you commit at the click on a >>>>>>>>>>>>>>>>>>>>