THRINAXODON BLOWS THE SMOKE HARD!

2014-01-25 Thread Thrinass
== >BREAKING NEWS == > The New York Times, Thrinaxodon, PhD === > According to U.S. dictator Obama, the U.S. has recently legalized weed to brainwash it's citizens. Millions of Americans hate the new move, they don't want OUR KIDS GROWING UP IN A WORLD RUL

Re: Trying to understand this moji-bake

2014-01-25 Thread Peter Otten
Steven D'Aprano wrote: > I have an unexpected display error when dealing with Unicode strings, and > I cannot understand where the error is occurring. I suspect it's not > actually a Python issue, but I thought I'd ask here to start. I suppose it is a Python issue -- where Python fails to guess a

Re: Trying to understand this moji-bake

2014-01-25 Thread wxjmfauth
Le samedi 25 janvier 2014 05:37:34 UTC+1, Steven D'Aprano a écrit : > I have an unexpected display error when dealing with Unicode strings, and > > I cannot understand where the error is occurring. I suspect it's not > > actually a Python issue, but I thought I'd ask here to start. > > > > U

Help with my 8-year old son's first program. I'm stuck!

2014-01-25 Thread justinpmullins
My son is learning Python and I know nothing about computers. He's written a simple calculator program that doesn't work. For the life of me, I can't see why. Any help gratefully received. Here's his code: def a(): import sys print("welcome to the calculation") print("ple

Re: Help with my 8-year old son's first program. I'm stuck!

2014-01-25 Thread Ervin Hegedüs
Hello, On Sat, Jan 25, 2014 at 02:02:15AM -0800, justinpmull...@gmail.com wrote: > My son is learning Python and I know nothing about computers. :) > He's written a simple calculator program that doesn't work. For the life of > me, I can't see why. > Any help gratefully received. Here's his co

Re: Help with my 8-year old son's first program. I'm stuck!

2014-01-25 Thread justinpmullins
PS: At the first statement, we've also tried op == "d": But that doesn't work either. On Saturday, January 25, 2014 10:02:15 AM UTC, justinp...@gmail.com wrote: > My son is learning Python and I know nothing about computers. > > He's written a simple calculator program that doesn't work. F

Re: Help with my 8-year old son's first program. I'm stuck!

2014-01-25 Thread Peter Otten
justinpmull...@gmail.com wrote: > My son is learning Python and I know nothing about computers. > He's written a simple calculator program that doesn't work. Normally you are supposed to explain what you or your son expect and what you get instead. If Python ends with an error you should paste

Re: Python declarative

2014-01-25 Thread Matěj Cepl
[This message has also been posted to gmane.comp.python.general.] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 2014-01-25, 07:18 GMT, Frank Millman wrote: > I have stated that my objective is to express as little as > possible in Python code. Yes, and I believe that it is very wrong. But any

Re: Help with my 8-year old son's first program. I'm stuck!

2014-01-25 Thread Denis McMahon
On Sat, 25 Jan 2014 02:02:15 -0800, justinpmullins wrote: > def a(): > import sys print("welcome to the calculation") print("please type a > number") > one = int(sys.stdin.readline()) print("type d for division,") > print("type m for multiplication,") print("type s for su

Re: Need Help with Programming Science Project

2014-01-25 Thread Denis McMahon
On Fri, 24 Jan 2014 20:58:50 -0800, theguy wrote: > I know. I'm kind of ashamed of the code, but it does the job I need it > to up to a certain point OK, well first of all take a step back and look at the problem. You have n exemplars, each from a known author. You analyse each exemplar, and de

Re: should I transfer 'iterators' between functions?

2014-01-25 Thread Ned Batchelder
On 1/25/14 1:37 AM, seasp...@gmail.com wrote: take the following as an example, which could work well. But my concern is, will list 'l' be deconstructed after function return? and then iterator point to nowhere? def test(): l = [1, 2, 3, 4, 5, 6, 7, 8] return iter(l) def main():

Re: should I transfer 'iterators' between functions?

2014-01-25 Thread Ned Batchelder
On 1/25/14 1:37 AM, seasp...@gmail.com wrote: take the following as an example, which could work well. But my concern is, will list 'l' be deconstructed after function return? and then iterator point to nowhere? def test(): l = [1, 2, 3, 4, 5, 6, 7, 8] return iter(l) def main():

Re: should I transfer 'iterators' between functions?

2014-01-25 Thread Peter Otten
Ned Batchelder wrote: > On 1/25/14 1:37 AM, seasp...@gmail.com wrote: >> take the following as an example, which could work well. >> But my concern is, will list 'l' be deconstructed after function return? >> and then iterator point to nowhere? >> >> def test(): >> l = [1, 2, 3, 4, 5, 6, 7, 8

Re: Help with my 8-year old son's first program. I'm stuck!

2014-01-25 Thread justinpmullins
Thanks Peter, that did the trick. You've got here a very happy 8-year old and a mighty relieved 46-year old!! On Saturday, January 25, 2014 10:41:20 AM UTC, Peter Otten wrote: > justinpmull...@gmail.com wrote: > > > > > My son is learning Python and I know nothing about computers. > > > He's

Re: Need Help with Programming Science Project

2014-01-25 Thread Rustom Mody
On Saturday, January 25, 2014 8:12:20 PM UTC+5:30, Dennis Lee Bieber wrote: > > Heck, at the very least turn all those _99 variables into single > lists The posted code looks like something from 1968 K&K BASIC. Yes thats correct. My suggestion of data-files is a second step. A fir

Re: Trying to understand this moji-bake

2014-01-25 Thread Peter Pearson
On Sat, 25 Jan 2014 17:08:56 +1100, Chris Angelico wrote: > On Sat, Jan 25, 2014 at 3:37 PM, Steven D'Aprano > wrote: >> But using Python 2.7, I get a really bad case of moji-bake: >> >> [steve@ando ~]$ python2.7 -c "print u'ñøλπйж'" >> ñøλÏйж > > What's 2.7's default source code encoding? I

Pls help me...I want to save data to my database but I am unable to

2014-01-25 Thread Max Cuban
This is my first programming pet project. I have the following script that extracts links from specific sites and display them on the web(via django). The script work fine but I'm unable to save any stuff in my database. Hence if I run the code, I get the output I want but then it always extracts

Re: Trying to understand this moji-bake

2014-01-25 Thread Chris Angelico
On Sun, Jan 26, 2014 at 4:56 AM, Peter Pearson wrote: > $ python2.7 -c "import sys; print(sys.stdin.encoding)" > UTF-8 This isn't from stdin, though, it's about the interpretation of the bytes of source code without a magic cookie. According to PEP 263 [1], the default encoding should have becom

Re: Pls help me...I want to save data to my database but I am unable to

2014-01-25 Thread Chris Angelico
On Sun, Jan 26, 2014 at 6:00 AM, Max Cuban wrote: > This is my first programming pet project. I have the following script that > extracts links from specific sites and display them on the web(via django). > The script work fine but I'm unable to save any stuff in my database. > > Hence if I run th

Re: Trying to understand this moji-bake

2014-01-25 Thread Oscar Benjamin
On 25 January 2014 04:37, Steven D'Aprano wrote: > > But using Python 2.7, I get a really bad case of moji-bake: > > [steve@ando ~]$ python2.7 -c "print u'ñøλπйж'" > ñøλÏйж > > However, interactively it works fine: > > [steve@ando ~]$ python2.7 -E > Python 2.7.2 (default, May 18 2012, 18:25:1

Pls help me...I want to save scraped data automatically to my database(cleaner version)

2014-01-25 Thread Max Cuban
I have asked this question earlier but this should make more sense than the earlier version and I don't want anyone who could potentially helped to be put off by the initial mess even if I updated it with my cleaner version as a reply I want to save the links scraped to be save in my database so t

Can't get sqlite3.Row working: keyword lookup doesn't work

2014-01-25 Thread lgabiot
Hello, using Python 2.7.6 I try to access a sqlite database using keyword lookup instead of position (much more easy to maintain code), but it always fail, with the error: Index must be int or string I have created the database, populated it, and here is the code that tries to retrieve the

Re: Trying to understand this moji-bake

2014-01-25 Thread Steven D'Aprano
On Sat, 25 Jan 2014 17:08:56 +1100, Chris Angelico wrote: > On Sat, Jan 25, 2014 at 3:37 PM, Steven D'Aprano > wrote: >> But using Python 2.7, I get a really bad case of moji-bake: >> >> [steve@ando ~]$ python2.7 -c "print u'ñøλπйж'" ñøλÏйж > > What's 2.7's default source code encoding? I t

Re: Trying to understand this moji-bake

2014-01-25 Thread Chris Angelico
On Sun, Jan 26, 2014 at 1:04 PM, Steven D'Aprano wrote: > If there's a bug, it is that Python 2.7 doesn't > raise SyntaxError when called with -c and there are non-ASCII literals in > the source. Instead, it seems to be defaulting to Latin-1, hence the moji- > bake. That might well be a bug! I wa

Re: Python declarative

2014-01-25 Thread Steven D'Aprano
On Sat, 25 Jan 2014 09:18:44 +0200, Frank Millman wrote: > I have realised that we unlikely to come to an agreement on this in the > near future, as our philosophies are completely different. > > You [Chris Angelo] have stated that your objective is to express as > much as possible in Python code

Re: Python declarative

2014-01-25 Thread Mark Lawrence
On 26/01/2014 02:33, Steven D'Aprano wrote: Here's a simple programming expression, familiar to most people, common to hundreds of programming languages: 3+4*5 Here it is written as XML: 345 Source: http://www.ibm.com/developerworks/xml/library/x-sbxml/index.html More here: http://www.codin

Re: Trying to understand this moji-bake

2014-01-25 Thread Terry Reedy
On 1/25/2014 2:13 PM, Chris Angelico wrote: On Sun, Jan 26, 2014 at 4:56 AM, Peter Pearson wrote: $ python2.7 -c "import sys; print(sys.stdin.encoding)" UTF-8 This isn't from stdin, though, it's about the interpretation of the bytes of source code without a magic cookie. According to PEP 263

Re: Python declarative

2014-01-25 Thread Chris Angelico
On Sun, Jan 26, 2014 at 1:33 PM, Steven D'Aprano wrote: >> Here is your version - >> >> mainwindow = GTK2.Window(0)->add(GTK2.Vbox(0,0) >> ->add(GTK2.Label("About Gypsum: big long multi-line string")) >> ->add(GTK2.HbuttonBox() >> ->add(GTK2.Button("Close")) >> ->add(GTK2.B

Re: Python declarative

2014-01-25 Thread Chris Angelico
On Sun, Jan 26, 2014 at 1:45 PM, Mark Lawrence wrote: > If I worked as a consultant I'd much prefer the XML version as I'd be able > to charge much more on the grounds that I'd done much more, hoping that the > people paying didn't bother with design reviews or the like :) And that's very true. I

Re: Python declarative

2014-01-25 Thread Rustom Mody
On Sunday, January 26, 2014 9:36:15 AM UTC+5:30, Chris Angelico wrote: > Code isn't something to be afraid of. It's just text files like any > other. After all, Python code is a config file for /usr/bin/python, so > if you want to change what Python does, just edit its config file! Windows stores

Re: Python declarative

2014-01-25 Thread Chris Angelico
On Sun, Jan 26, 2014 at 3:47 PM, Rustom Mody wrote: > On Sunday, January 26, 2014 9:36:15 AM UTC+5:30, Chris Angelico wrote: >> Code isn't something to be afraid of. It's just text files like any >> other. After all, Python code is a config file for /usr/bin/python, so >> if you want to change wha

Re: Python declarative

2014-01-25 Thread Frank Millman
"Steven D'Aprano" wrote in message news:52e473fc$0$2$c3e8da3$54964...@news.astraweb.com... > On Sat, 25 Jan 2014 09:18:44 +0200, Frank Millman wrote: > >> I have realised that we unlikely to come to an agreement on this in the >> near future, as our philosophies are completely different. >>