Re: Fortran

2014-05-14 Thread Steven D'Aprano
On Wed, 14 May 2014 07:35:35 +0300, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Tue, 13 May 2014 22:57:16 +0300, Marko Rauhamaa wrote: >> >>> Producing an effective JIT for Python seems like a formidable >>> challenge but not impossible in principle. >> >> Or in practice. >> >> http://pypy.

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread wxjmfauth
Le mardi 13 mai 2014 10:08:45 UTC+2, Johannes Bauer a écrit : > On 13.05.2014 03:18, Steven D'Aprano wrote: > > > > > Armin Ronacher is an extremely experienced and knowledgeable Python > > > developer, and a Python core developer. He might be wrong, but he's not > > > *obviously* wrong. >

Re: SQLAlchemy - web framework ?

2014-05-14 Thread flebber
One of the main parts that is tripping myself up is that I need to consistently import xml files into my database. Looking to find the best support and methodologies to do this, that is one of the reasons I am looking at SqlAlchemy. Sayth -- https://mail.python.org/mailman/listinfo/python-li

Re: SQLAlchemy - web framework ?

2014-05-14 Thread Ben Finney
flebber writes: > One of the main parts that is tripping myself up is that I need to > consistently import xml files into my database. XML documents represent a hierarchical tree of data. Relational databases are not good at representing hierarchical documents. So I don't know what you mean by

Re: Fortran

2014-05-14 Thread Marko Rauhamaa
Steven D'Aprano : > On Wed, 14 May 2014 07:35:35 +0300, Marko Rauhamaa wrote: >> I'm having a hard time finding information on how well it performs wrt >> Java, for example. Did PyPy truly find the Philosophers' Stone? > > [...] do you mean, how does PyPy compare with compiler here? I don't know.

problems decoding json objects

2014-05-14 Thread Tamer Higazi
Hi people! My JSON String: from json.decoder import JSONDecoder myjs = '{"AVName":"Tamer","ANName":"Higazi","AAnschrift":"Bauerngasse","AHausnr":"1","APLZ":"55116","AOrt":"Mainz"},{"KontaktTel":["01234","11223344"],{"ZahlungsArt":"0"},{"ZugangsDaten":["tamer.hig...@nomail.com","mypass"]}' If I

Re: problems decoding json objects

2014-05-14 Thread Ben Finney
Tamer Higazi writes: > myjs = > '{"AVName":"Tamer","ANName":"Higazi","AAnschrift":"Bauerngasse","AHausnr":"1","APLZ":"55116","AOrt":"Mainz"},{"KontaktTel":["01234","11223344"],{"ZahlungsArt":"0"},{"ZugangsDaten":["tamer.hig...@nomail.com","mypass"]}' That's not a valid JSON document. See http://

RE: Exception problem with module

2014-05-14 Thread Joseph L. Casale
> I see that you've solved your immediate problem, but you shouldn't call > __setattr__ directly. That should actually be written > > setattr(bar, 'a_new_name', MyError) > > But really, since bar is (apparently) a module, and it is *bar itself* > setting the attribute, the better way is > > a

Re: problems decoding json objects

2014-05-14 Thread Skip Montanaro
On Wed, May 14, 2014 at 3:36 AM, Tamer Higazi wrote: > myjs = > '{"AVName":"Tamer","ANName":"Higazi","AAnschrift":"Bauerngasse","AHausnr":"1","APLZ":"55116","AOrt":"Mainz"},{"KontaktTel":["01234","11223344"],{"ZahlungsArt":"0"},{"ZugangsDaten":["tamer.hig...@nomail.com","mypass"]}' Following up o

Re: problems decoding json objects

2014-05-14 Thread Ben Finney
Ben Finney writes: > Tamer Higazi writes: > > How do I solve this problem ?! > > Fix the document. Where did it come from? If you're the one typing raw JSON into your program: Fix that. Don't type raw JSON. JSON is an object serialisation format; it's foolish to type it yourself. You should on

python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread Antoon Pardon
This is the code I run (python 3.3) host = ... user = ... passwd = ... from ftplib import FTP ftp = FTP(host, user, passwd) ftp.mkd(b'NewDir') ftp.rmd(b'NewDir') This is the traceback Traceback (most recent call last): File "ftp-problem", line 9, in ftp.mkd(b'NewDir') File "/usr/lib/p

Re: New to Python. For in loops curiosity

2014-05-14 Thread Roy Smith
In article <2f08e970-1334-4e7f-ba84-14869708a...@googlegroups.com>, Leonardo Petry wrote: > Basically my question is: Why is python not treating the contents of > [a file] as one long string and looping each character? Because whoever designed the original file object decided that the right w

Re: problems decoding json objects

2014-05-14 Thread Roy Smith
In article , Skip Montanaro wrote: > I guess JSON doesn't have tuples JSON has sequences, which both Python lists and tuples serialize as (losing the distinction between them). In the other direction, JSON sequences typically unpack as lists, but I think that's just convention. There might

Re: problems decoding json objects

2014-05-14 Thread Denis McMahon
On Wed, 14 May 2014 10:36:11 +0200, Tamer Higazi wrote: > Hi people! > > My JSON String: > > from json.decoder import JSONDecoder > myjs = > '{"AVName":"Tamer","ANName":"Higazi","AAnschrift":"Bauerngasse","AHausnr":"1","APLZ":"55116","AOrt":"Mainz"}, {"KontaktTel":["01234","11223344"],{"Zahlun

Re: problems decoding json objects

2014-05-14 Thread Tamer Higazi
You are right! It was all alone my mistake which I recently figured out. Thanks for helping me. Tamer Am 14.05.2014 11:20, schrieb Ben Finney: > Tamer Higazi writes: > > That's not a valid JSON document. See http://json.org/>. > -- https://mail.python.org/mailman/listinfo/python-list

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread alister
On Tue, 13 May 2014 10:08:42 -0600, Ian Kelly wrote: > On Tue, May 13, 2014 at 5:19 AM, alister > wrote: >> I am only an amateur python coder which is why I asked if I am missing >> something >> >> I could not see any reason to be using the shutil module if all that >> the programm is doing is op

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread alister
On Wed, 14 May 2014 10:08:57 +1000, Chris Angelico wrote: > On Wed, May 14, 2014 at 9:53 AM, Steven D'Aprano > wrote: >> With the current system, all of us here are technically violating >> copyright every time we reply to an email and quote more than a small >> percentage of it. > > Oh wow... s

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread Chris Angelico
On Wed, May 14, 2014 at 10:42 PM, alister wrote: > On Wed, 14 May 2014 10:08:57 +1000, Chris Angelico wrote: > >> On Wed, May 14, 2014 at 9:53 AM, Steven D'Aprano >> wrote: >>> With the current system, all of us here are technically violating >>> copyright every time we reply to an email and quot

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread Dave Angel
On 05/13/2014 09:39 AM, Steven D'Aprano wrote: On Tue, 13 May 2014 07:20:34 -0400, Roy Smith wrote: ASCII *is* all I need. You've never needed to copyright something? Copyright © Roy Smith 2014... I know some people use (c) instead, but that actually has no legal standing. (Not that any reaso

Re: Need help to write data onto an XML file after reading data from another xml file

2014-05-14 Thread Dave Angel
On 05/14/2014 02:49 AM, varun...@gmail.com wrote: I try to add an edge with the source id and destination id over a loop but this is the error I am getting. And the range for the for addEdge is something I have no clue about. python export.py --output topology.xml --xml germany50.xml Traceback

Re: Exception problem with module

2014-05-14 Thread Steven D'Aprano
On Wed, 14 May 2014 09:21:50 +, Joseph L. Casale wrote: >> I see that you've solved your immediate problem, but you shouldn't call >> __setattr__ directly. That should actually be written >> >> setattr(bar, 'a_new_name', MyError) >> >> But really, since bar is (apparently) a module, and it

Re: Fortran

2014-05-14 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> The real nice thing that makes Julia a different language is the >> optional static typing, which the JIT can use to produce efficient code. >> It's the only meaningful difference with the current state of python. > > I'm guessing the two main perfo

Re: Exception problem with module

2014-05-14 Thread Chris Angelico
On Wed, May 14, 2014 at 11:08 PM, Steven D'Aprano wrote: > One should code as if the next person who reads your program is an easily > upset psychotic axe-murderer who knows where you live. You wouldn't > condone writing y = x.__add__(1) instead of y = x + 1, you shouldn't > condone writing module

Re: Why isn't my re.sub replacing the contents of my MS Word file?

2014-05-14 Thread alister
On Tue, 13 May 2014 23:12:40 -0700, wxjmfauth wrote: > Le mardi 13 mai 2014 22:26:51 UTC+2, MRAB a écrit : >> On 2014-05-13 20:01, scottca...@gmail.com wrote: >> >> > On Tuesday, May 13, 2014 9:49:12 AM UTC-4, Steven D'Aprano wrote: >> >> >> >> >> >> You may have missed my follow up post, where

Re: New to Python. For in loops curiosity

2014-05-14 Thread Ned Batchelder
On 5/13/14 11:38 PM, Leonardo Petry wrote: Hi All, So I am starting with python and I have been working on some simple exercises. Here is something I found curious about python loops This loop run each character in a string def avoids(word,letters): flag = True for letter in l

Re: Need help to write data onto an XML file after reading data from another xml file

2014-05-14 Thread varun7rs
That is a very descriptive post. Since its my first time programming I am not aware of many conventions that are being used to name classes. I tried to distinguish them by naming classes in caps. I borrowed some ideas from here and there to come up with the Approach_Read.py file. What I intend t

Re: Need help to write data onto an XML file after reading data from another xml file

2014-05-14 Thread Chris Angelico
On Wed, May 14, 2014 at 11:42 PM, wrote: > Since its my first time programming I am not aware of many conventions that > are being used to name classes. I tried to distinguish them by naming classes > in caps. The most commonly followed naming conventions in Python are those mandated for Pytho

Re: Using threads for audio computing?

2014-05-14 Thread Sturla Molden
On 12/05/14 07:33, lgabiot wrote: But AFAIK the python GIL (and in smaller or older computers that have only one core) does not permit true paralell execution of two threads. I believe it is quite like the way multiple processes are handled by an OS on a single CPU computer: process A has x CPU

Re: Why isn't my re.sub replacing the contents of my MS Word file?

2014-05-14 Thread scottcabit
On Tuesday, May 13, 2014 4:26:51 PM UTC-4, MRAB wrote: > > 0x96 is a hexadecimal literal for an int. Within a string you need \x96 > > (it's \x for 2 hex digits, \u for 4 hex digits, \U for 8 hex digits). Yes, that was my problem. Figured it out just after posting my last message. using \x96

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread Ian Kelly
On May 13, 2014 6:10 PM, "Chris Angelico" wrote: > > On Wed, May 14, 2014 at 9:53 AM, Steven D'Aprano > wrote: > > With the current system, all of us here are technically violating > > copyright every time we reply to an email and quote more than a small > > percentage of it. > > Oh wow... so whe

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread Robin Becker
On 13/05/2014 17:08, Ian Kelly wrote: . And since it's so simple, it shouldn't be hard to see that the use of the shutil module has nothing to do with the Unicode woes here. The crux of the issue is that a general-purpose command like cat typically can't know the encoding of its input a

Re: httplib with NETRC authentication

2014-05-14 Thread Akira Li
Chris Angelico writes: > On Wed, May 14, 2014 at 9:33 AM, pratibha natani > wrote: >> I am trying to establish http connection to a gerrit host using >> netrc authentication. I have a netrc file created with following >> entries: >> machine host1.com login name password pass >> >> I did a debug

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread Ian Kelly
On Wed, May 14, 2014 at 9:30 AM, Robin Becker wrote: > Doesn't this issue also come up wherever bytes are being read ie in sockets, > pipe file handles etc? Some sources may have well defined encodings and so > allow use of unicode strings but surely not all. I imagine all of the > problems associ

Re: python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread Akira Li
Antoon Pardon writes: > This is the code I run (python 3.3) > > host = ... > user = ... > passwd = ... > > from ftplib import FTP > > ftp = FTP(host, user, passwd) > ftp.mkd(b'NewDir') > ftp.rmd(b'NewDir') > > This is the traceback > > Traceback (most recent call last): > File "ftp-problem", li

Re: httplib with NETRC authentication

2014-05-14 Thread Akira Li
pratibha natani writes: > Hi, > > I am trying to establish http connection to a gerrit host using netrc > authentication. I have a netrc file created with following entries: > machine host1.com login name password pass > > I did a debug and saw that my netrc file is being read correctly. Also in

Re: httplib with NETRC authentication

2014-05-14 Thread Chris Angelico
On Thu, May 15, 2014 at 1:44 AM, Akira Li <4kir4...@gmail.com> wrote: >> The obvious question is: What *does* work? Does it work when you use >> wget, or some other application? Then go and look at what that sends >> for its authentication headers. Tip: It won't be "Authorization". > > "Authorizati

Re: python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread Antoon Pardon
op 14-05-14 18:24, Akira Li schreef: > Antoon Pardon writes: > >> This is the code I run (python 3.3) >> >> host = ... >> user = ... >> passwd = ... >> >> from ftplib import FTP >> >> ftp = FTP(host, user, passwd) >> ftp.mkd(b'NewDir') >> ftp.rmd(b'NewDir') >> >> This is the traceback >> >> Trace

Re: python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread MRAB
On 2014-05-14 19:06, Antoon Pardon wrote: op 14-05-14 18:24, Akira Li schreef: Antoon Pardon writes: This is the code I run (python 3.3) host = ... user = ... passwd = ... from ftplib import FTP ftp = FTP(host, user, passwd) ftp.mkd(b'NewDir') ftp.rmd(b'NewDir') This is the traceback Tra

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-14 Thread Simon Evans
I downloaded the get-pip.py file. I installed it to the same folder on my C drive as the Beautiful Soup one in which the Beautiful Soup 4 downloads was unzipped to. I changed directory to the folder on the Command Prompt, as you instructed in step 2. I input the code to the console you gave on s

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-14 Thread Simon Evans
I have input the above code by copy and pasting to the Idle python console, as the python 2.7 command prompt is fussy about the indentation on the eleventh line down, if I then indent it, it replies that the indentation is unnecessary of unexpected, and if I don't it says an indentation is expec

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-14 Thread Ian Kelly
On Wed, May 14, 2014 at 12:58 PM, Simon Evans wrote: > c:\Beautiful Soup>pip install beautifulsoup4 > 'pip' is not recognized as an internal or external command, > operable program or batch file. > > c:\Beautiful Soup> > -

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-14 Thread Ian Kelly
On Wed, May 14, 2014 at 1:28 PM, Simon Evans > Again it does not recognise 'bs4'. I think having used 'Just unzip it' instead of 'WinZip' may have caused this problem, in the first place ,as when I looked at the WinZip version at a local net café, it did have a folder hierarchy, however I wanted, a

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-14 Thread Chris Angelico
On Thu, May 15, 2014 at 5:33 AM, Ian Kelly wrote: > I use 7-zip (www.7-zip.org), which is freely distributed and open source. You beat me to the punch. :) Was about to say the exact same thing, so instead I'll second your recommendation. ChrisA -- https://mail.python.org/mailman/listinfo/python

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Terry Reedy
On 5/13/2014 6:55 PM, Ben Finney wrote: Steven D'Aprano writes: On Tue, 13 May 2014 04:52:26 -0700, Rustom Mody wrote: What this goes to show is that while 80 is ridiculously low by most displays today, Not for people who like to has two (or three, or four) windows side-by- side. Or multip

Re: Everything you did not want to know about Unicode in Python 3

2014-05-14 Thread Terry Reedy
On 5/13/2014 8:53 PM, Ethan Furman wrote: On 05/13/2014 05:10 PM, Steven D'Aprano wrote: On Tue, 13 May 2014 10:08:42 -0600, Ian Kelly wrote: Because Python 3 presents stdin and stdout as text streams however, it makes them more difficult to use with binary data, which is why Armin sets up all

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Albert van der Horst
In article , Rustom Mody wrote: >On Tuesday, May 13, 2014 12:37:24 PM UTC+5:30, Ganesh Pal wrote: >> Hi Team , >> >> >> what would be the best way to intent the below line . >> >> I have few lines in my program exceeding the allowed maximum line >Length of 79./80 characters >> >> >> Example 1 :

Re: Fortran

2014-05-14 Thread Sturla Molden
Ian Kelly wrote: > Also numba, which is reminiscent of psyco, but with more features and > Python 3 support. For numerical computing with NumPy, Numba tends to give performance comparable to -O2 in C. This is because it is very easy to do type inference in most scientific array computing. Numba

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Gary Herron
On 05/14/2014 03:53 PM, Albert van der Horst wrote: In article , Rustom Mody wrote: On Tuesday, May 13, 2014 12:37:24 PM UTC+5:30, Ganesh Pal wrote: Hi Team , what would be the best way to intent the below line . I have few lines in my program exceeding the allowed maximum line Length of

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Mark Lawrence
On 15/05/2014 01:15, Gary Herron wrote: Which is a relic of the even older punch cards which contained one line of (up to) 80 characters. Gary Herron I still remember the cry of anguish when the guy in the computer building at (the then) Portsmouth Polytechnic dropped his cardboard box of

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Roy Smith
In article , Mark Lawrence wrote: > I still remember the cry of anguish when the guy in the computer > building at (the then) Portsmouth Polytechnic dropped his cardboard box > of punch cards that made up his end of course project. That's why you punch sequence numbers in columns 73-80. If t

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Rustom Mody
On Thursday, May 15, 2014 4:23:52 AM UTC+5:30, Albert van der Horst wrote: > > Rustom Mody wrote: > >80-character limit?! > >Sheesh! A relic of the days when terminals were ASCII and 80x24 > > > 80 character was the hard limit. > The soft limit for readability is 60..65 characters. > Think abo

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Ben Finney
Rustom Mody writes: > Until then may we relegate '79' to quaint historical curiosities Not until the general capacity of human cognition advances to make longer lines easier to read. We humans may be historical curiosities some day; until then, let's continue to write our code as though humans

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Steven D'Aprano
On Wed, 14 May 2014 19:36:13 -0700, Rustom Mody wrote: > And there are (semi)hard technological limits like if you post code > longer 65 chars out here it will fold at random unforeseen points. These > limits get irrelevant as the technology changes. The technological limits may become irrelevant

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Mark Lawrence
On 15/05/2014 03:43, Ben Finney wrote: Rustom Mody writes: Until then may we relegate '79' to quaint historical curiosities Not until the general capacity of human cognition advances to make longer lines easier to read. We humans may be historical curiosities some day; until then, let's con

Re: python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread Akira Li
Antoon Pardon writes: > op 14-05-14 18:24, Akira Li schreef: >> Antoon Pardon writes: >> >>> This is the code I run (python 3.3) >>> >>> host = ... >>> user = ... >>> passwd = ... >>> >>> from ftplib import FTP >>> >>> ftp = FTP(host, user, passwd) >>> ftp.mkd(b'NewDir') >>> ftp.rmd(b'NewDir') >