Newbie suggestion: nice tutorial

2014-10-26 Thread Martin S
Even after having written three small tool for calculating chess ratings, I felt that I severly lacked a proper understanding of what the BEEP I was actually doing. So I looked at our standard bookshop at work, found a book that I thought neat only to discover that our work account has been cancell

Dive Into Python 3, good tutorial (was: Newbie suggestion: nice tutorial)

2014-10-26 Thread Ben Finney
Martin S writes: > So it was back to the internet - and this one seems pretty > comprehensive and understandable: > > http://www.diveintopython3.net/ Yes, Mark Pilgrim wrote this originally for Python 2, and it was one of the best even then. The revised edition for Python 3 is highly recommended

Re: When to use assert

2014-10-26 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Oct 24, 2014 at 6:49 PM, Steven D'Aprano > wrote: >> addresses = [get_address(name) for name in database] >> assert all(address for address in addresses) >> # ... much later on ... >> for i, address in enumerate(addresses): >> if some_condition(): >> ad

Re: When to use assert

2014-10-26 Thread Chris Angelico
On Sun, Oct 26, 2014 at 8:39 PM, Steven D'Aprano wrote: > In the absence of correctness proofs for your code, anything you do (unit > tests, assertions, regression tests, etc.) is just a statistically sampling > of all the potential paths your code might take, hoping to capture bugs. As > any stat

Sample sqlite databases for use in python

2014-10-26 Thread Nicholas Cannon
Hello I am making a data management program and although i can make my own databases I would like a couple sample ones to check out. Of course I searched on google for sample db's and I downloaded some but they are not working and I keep getting: File is not a database or en

Re: Sample sqlite databases for use in python

2014-10-26 Thread Peter Otten
Nicholas Cannon wrote: > Hello I am making a data management program and although i can make my own > databases I would like a couple sample ones to check out. Of course I > searched on google for sample db's and I downloaded some but they are not > working and I keep getting: >

SQLObject 1.6.1

2014-10-26 Thread Oleg Broytman
Hello! I'm pleased to announce version 1.6.1, the first bugfix release of branch 1.6 of SQLObject. What's new in SQLObject === * Allow unicode in .orderBy(u'-column'). Contributor for this release is Andrew Trusty. For a more complete list, please see the news: http://sqlo

Re: Status of side-effecting functions in python

2014-10-26 Thread Dan Sommers
On Sun, 26 Oct 2014 00:45:49 -0700, wxjmfauth wrote: > Ditto for .write(). Why should it return "something" ? > with open('z.txt', 'w') as f: > ... f.write('abc') > ... > 3 OTOH, why shouldn't it return something? In this case, it returns the length of the string written. This va

Lazy-evaluation lists/dictionaries

2014-10-26 Thread Jon Ribbens
I have a need, in a Python C extension I am writing, for lists and dictionaries with "lazy evaluation" - by which I mean that at least some of the values in the lists/dictionaries are "proxy objects" which, rather than returning as themselves, should return the thing they are a proxy for when retri

Re: Status of side-effecting functions in python

2014-10-26 Thread Rustom Mody
On Sunday, October 26, 2014 7:11:43 PM UTC+5:30, Dan Sommers wrote: > At one time, on a huge project, millions of lines of C and assembly > code, we had a local guideline *not* to write void functions. The idea > was to return something that might be useful later, even if it seemed > unlikely now

Finding my way around help

2014-10-26 Thread Rustom Mody
Context: I will be showing the way around to some experienced programmers new to python. Do >>> help() Among other things I get: | Enter the name of any module, keyword, or topic to get help on writing | Python programs and using Python modules. To quit this help utility and | return to the in

Re: Status of side-effecting functions in python

2014-10-26 Thread Marko Rauhamaa
wxjmfa...@gmail.com: > Yes and no. If something goes wrong in a .write() method, > is not Python supposed to raise an error? (!) We have multiple cases: 1. write succeeds with all of the given bytes 2. write succeeds with some but not all of the given bytes 3. write cannot at the moment wri

XML Patch

2014-10-26 Thread Nicholas Cole
Hi All, I'm looking for a python library that can parse XML Documents and create xml-aware "diff" files, and then use those to patch documents. In other words, I'd like something similar to the Google diff-match-patch tools, but something which is XML aware. I can see several projects on Pypi tha

Re: XML Patch

2014-10-26 Thread Joel Goldstick
On Sun, Oct 26, 2014 at 1:00 PM, Nicholas Cole wrote: > Hi All, > > I'm looking for a python library that can parse XML Documents and > create xml-aware "diff" files, and then use those to patch documents. > In other words, I'd like something similar to the Google > diff-match-patch tools, but som

Re: XML Patch

2014-10-26 Thread Stefan Behnel
Nicholas Cole schrieb am 26.10.2014 um 18:00: > I'm looking for a python library that can parse XML Documents and > create xml-aware "diff" files, and then use those to patch documents. > In other words, I'd like something similar to the Google > diff-match-patch tools, but something which is XML a

Re: Lazy-evaluation lists/dictionaries

2014-10-26 Thread Tim Delaney
On 27 October 2014 01:14, Jon Ribbens wrote: > I have a need, in a Python C extension I am writing, for lists and > dictionaries with "lazy evaluation" - by which I mean that at least > some of the values in the lists/dictionaries are "proxy objects" > which, rather than returning as themselves,

Re: (-1)**1000

2014-10-26 Thread Ned Batchelder
On 10/26/14 4:07 PM, Tony the Tiger wrote: On Wed, 22 Oct 2014 10:27:34 +0200, ast wrote: If i am writing (-1)**1000 on a python program, will the interpreter do (-1)*(-1)*...*(-1) or something clever ? Even vs. odd. It ought to know. I would assume from a set of defined rules how math works.

Re: Test driven programming, was Re: VB to Python migration

2014-10-26 Thread Viorica Gheorghiu
-- https://mail.python.org/mailman/listinfo/python-list

Re: (test) ? a:b

2014-10-26 Thread Terry Reedy
On 10/26/2014 12:15 AM, Steven D'Aprano wrote: Ben Finney wrote: Steven D'Aprano writes: I suspect that Guido and the core developers disagree with you, since they had the opportunity to fix that in Python 3 and didn't. That doesn't follow; there are numerous warts in Python 2 that were no

Re: I am out of trial and error again Lists

2014-10-26 Thread Terry Reedy
On 10/26/2014 1:08 AM, Dennis Lee Bieber wrote: On Sat, 25 Oct 2014 18:48:59 -0400, Terry Reedy declaimed the following: C:\Users\Wulfraed\Documents>python3 You must have done something extra to make this work on Windows. Possibly hand-edited my system PATH -- I've got a rather nas

Re: Status of side-effecting functions in python

2014-10-26 Thread Roy Smith
In article <683c84d8-d916-4b63-b4b2-92cd2763e...@googlegroups.com>, wxjmfa...@gmail.com wrote: > Le dimanche 26 octobre 2014 14:41:43 UTC+1, Dan Sommers a écrit : > > On Sun, 26 Oct 2014 00:45:49 -0700, wxjmfauth wrote: > > > > > Ditto for .write(). Why should it return "something" ? > > > > >

Re: Newbie suggestion: nice tutorial

2014-10-26 Thread Terry Reedy
On 10/26/2014 3:22 AM, Martin S wrote: So it was back to the internet - and this one seems pretty comprehensive and understandable: http://www.diveintopython3.net/ It doesn't cover the latest point version of Python (it's still Python 3), but I hope it doesn't matter much? I expect not. The

Re: Lazy-evaluation lists/dictionaries

2014-10-26 Thread Terry Reedy
On 10/26/2014 10:14 AM, Jon Ribbens wrote: I have a need, in a Python C extension I am writing, for lists and dictionaries with "lazy evaluation" - by which I mean that at least some of the values in the lists/dictionaries are "proxy objects" which, rather than returning as themselves, should ret

id == vs is

2014-10-26 Thread Dan Stromberg
Are the following two expressions the same? x is y Id(x) == id(y) ? I ported some Java code to Python, and it was using Java's idea of equality (via ==) in some places. Right now, I have a suite of unit tests working using the second expression above, but I'm thinking about switching to the fi

Re: id == vs is

2014-10-26 Thread MRAB
On 2014-10-27 00:12, Dan Stromberg wrote: Are the following two expressions the same? x is y Id(x) == id(y) ? Yes. I ported some Java code to Python, and it was using Java's idea of equality (via ==) in some places. Right now, I have a suite of unit tests working using the second expressi

Re: id == vs is

2014-10-26 Thread Joshua Landau
On 27 October 2014 00:12, Dan Stromberg wrote: > Are the following two expressions the same? > > x is y > > Id(x) == id(y) Much of the time, but not all the time. The obvious exception is if "id" is redefined, but that one's kind of boring. The real thing to watch out for is if the object that "x

Re: id == vs is

2014-10-26 Thread Ethan Furman
On 10/26/2014 05:23 PM, Ethan Furman wrote: On 10/26/2014 05:12 PM, Dan Stromberg wrote: Are the following two expressions the same? x is y Id(x) == id(y) ? Listen to MRAB, ignore me. That is all. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: id == vs is

2014-10-26 Thread Ethan Furman
On 10/26/2014 05:12 PM, Dan Stromberg wrote: Are the following two expressions the same? x is y Id(x) == id(y) ? Nope. If the value if `id(x)` is not interned, then the two value could be different objects that still represent the same value. -- ~Ethan~ -- https://mail.python.org/mailman

Re: (test) ? a:b

2014-10-26 Thread Ben Finney
Steven D'Aprano writes: > Do you really not see the connection between counting and summing? Connection? Of course. But I also see a huge distinction. I'm surprised you could misunderstand my position to the extent you think such a question needs to be asked. The difference between “sum these v

Re: id == vs is

2014-10-26 Thread MRAB
On 2014-10-27 00:24, Ethan Furman wrote: On 10/26/2014 05:23 PM, Ethan Furman wrote: On 10/26/2014 05:12 PM, Dan Stromberg wrote: Are the following two expressions the same? x is y Id(x) == id(y) ? Listen to MRAB, ignore me. That is all. Well, apart of Joshua's qualifications, that is!

Re: id == vs is

2014-10-26 Thread Ben Finney
Dan Stromberg writes: > Are the following two expressions the same? > > x is y > > Id(x) == id(y) It depends what you mean by “the same”. Do they give the same result? Sometimes yes, sometimes no. It depends on what the types of the values are. Do they express the same intent? Always no. The f

Re: (test) ? a:b

2014-10-26 Thread MRAB
On 2014-10-27 00:38, Ben Finney wrote: Steven D'Aprano writes: Do you really not see the connection between counting and summing? Connection? Of course. But I also see a huge distinction. I'm surprised you could misunderstand my position to the extent you think such a question needs to be as

Re: id == vs is

2014-10-26 Thread Denis McMahon
On Sun, 26 Oct 2014 17:12:29 -0700, Dan Stromberg wrote: > Are the following two expressions the same? > > x is y > > Id(x) == id(y) No, although if "Id" and "id" were the same function, they might be equivalent in some cases. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.pyth

Re: (test) ? a:b

2014-10-26 Thread Joshua Landau
On 26 October 2014 01:03, Ben Finney wrote: > Steven D'Aprano writes: > >> I suspect that Guido and the core developers disagree with you, since >> they had the opportunity to fix that in Python 3 and didn't. > > That doesn't follow; there are numerous warts in Python 2 that were not > fixed in P

Re: (test) ? a:b

2014-10-26 Thread Rustom Mody
On Sunday, October 26, 2014 9:45:22 AM UTC+5:30, Steven D'Aprano wrote: > http://legacy.python.org/dev/peps/pep-0285/ > Ben Finney wrote: > > > > I agree with the decision, because this isn't an issue which often leads > > to *incorrect* code. But I maintain that it's an unfortunate and > > need

Re: (test) ? a:b

2014-10-26 Thread Ben Finney
Joshua Landau writes: > Guido van Rossum answered Jul 28 '11 at 21:20, > http://stackoverflow.com/questions/3174392/is-it-pythonic-to-use-bools-as-ints > > False==0 and True==1, and there's nothing wrong with that. Guido is incorrect. I've already stated what's wrong. That's different from sayi

Classes and the command line

2014-10-26 Thread Seymore4Head
I am trying to learn classes. I am currently using Python 2.7 at the command line. If you try to type commands at the command line and make the slightest mistake you have to start over. I was trying to copy and paste these instructions into the command prompt. http://en.wikibooks.org/wiki/Python_

Re: (test) ? a:b

2014-10-26 Thread Rustom Mody
On Monday, October 27, 2014 7:59:04 AM UTC+5:30, Ben Finney wrote: > Joshua Landau writes: > > > Guido van Rossum answered Jul 28 '11 at 21:20, > > http://stackoverflow.com/questions/3174392/is-it-pythonic-to-use-bools-as-ints > > > False==0 and True==1, and there's nothing wrong with that. > > G

Re: (test) ? a:b

2014-10-26 Thread Joshua Landau
On 27 October 2014 02:28, Ben Finney wrote: > Joshua Landau writes: > >> Guido van Rossum answered Jul 28 '11 at 21:20, >> http://stackoverflow.com/questions/3174392/is-it-pythonic-to-use-bools-as-ints >> > False==0 and True==1, and there's nothing wrong with that. > > Guido is incorrect. I've al

Re: (test) ? a:b

2014-10-26 Thread Ben Finney
Joshua Landau writes: > On 27 October 2014 02:28, Ben Finney wrote: > > Guido is incorrect. I've already stated what's wrong. > > You were arguing about what Guido thinks. I don't know where I did that; to my knowledge, this is the first time I've mentioned Guido, and it's in rebuttal to his au

Python tutorials

2014-10-26 Thread Seymore4Head
Python tutorials http://anandology.com/python-practice-book/object_oriented_programming.html This is a good onebut it gets too deep too fast. This is the best thing I have read so far to help me understand classes. What I would like to see is more examples of computing before starting on drawi

Re: Classes and the command line

2014-10-26 Thread Ben Finney
Seymore4Head writes: > I am trying to learn classes. > I am currently using Python 2.7 at the command line. (I think you mean “the interactive Python interpreter”, or just “the Python shell”.) Since you are learning Python, I will strongly recommend you ignore Python 2 unless it becomes unavoid

Re: id == vs is

2014-10-26 Thread Cameron Simpson
On 27Oct2014 00:41, MRAB wrote: On 2014-10-27 00:24, Ethan Furman wrote: On 10/26/2014 05:23 PM, Ethan Furman wrote: On 10/26/2014 05:12 PM, Dan Stromberg wrote: Are the following two expressions the same? x is y Id(x) == id(y) ? Listen to MRAB, ignore me. That is all. Well, apart of J

Re: Classes and the command line

2014-10-26 Thread Rustom Mody
On Monday, October 27, 2014 8:00:04 AM UTC+5:30, Seymore4Head wrote: > I am trying to learn classes. > I am currently using Python 2.7 at the command line. Why not idle? And if in general you are at python 3, why 2.7 here? There are enough factor to learn ( and get confused)! Please dont add new o

Re: Classes and the command line

2014-10-26 Thread Chris Angelico
On Mon, Oct 27, 2014 at 2:06 PM, Ben Finney wrote: > Right. There is line-by-line history, and editing enabled with the > “readline” plug-in. (This is an advantage of using a programmer-friendly > operating system, which MS Windows sadly is not.) You can get block-by-block history by using Idle.

Re: id == vs is

2014-10-26 Thread Ben Finney
Ben Finney writes: > Dan Stromberg writes: > > Are the following two expressions the same? […] > > It depends what you mean by “the same”. My apologies, I mis-read the question. My answers were for a different question (one you didn't ask). Please ignore that. -- \ “If you ever reach to

Re: Classes and the command line

2014-10-26 Thread Rustom Mody
On Monday, October 27, 2014 8:40:48 AM UTC+5:30, Chris Angelico wrote: > On Mon, Oct 27, 2014 at 2:06 PM, Ben Finney wrote: > > Right. There is line-by-line history, and editing enabled with the > > "readline" plug-in. (This is an advantage of using a programmer-friendly > > operating system, whic

Re: Classes and the command line

2014-10-26 Thread Chris Angelico
On Mon, Oct 27, 2014 at 2:18 PM, Rustom Mody wrote: > On Monday, October 27, 2014 8:40:48 AM UTC+5:30, Chris Angelico wrote: >> On Mon, Oct 27, 2014 at 2:06 PM, Ben Finney wrote: >> > Right. There is line-by-line history, and editing enabled with the >> > "readline" plug-in. (This is an advantage

Re: Classes and the command line

2014-10-26 Thread Rustom Mody
On Monday, October 27, 2014 8:48:52 AM UTC+5:30, Rustom Mody wrote: > On Monday, October 27, 2014 8:40:48 AM UTC+5:30, Chris Angelico wrote: > > On Mon, Oct 27, 2014 at 2:06 PM, Ben Finney wrote: > > > Right. There is line-by-line history, and editing enabled with the > > > "readline" plug-in. (Th

Re: Classes and the command line

2014-10-26 Thread Seymore4Head
Your message showed up as unavailable on my server I have to cut and paste Google Groups to reply. (I am going to change news servers probably tomorrow to try to fix that) So the quoting is going to be bad. Why not idle? And if in general you are at python 3, why 2.7 here? There are enough

Re: Classes and the command line

2014-10-26 Thread Seymore4Head
On Mon, 27 Oct 2014 14:06:11 +1100, Ben Finney wrote: >Seymore4Head writes: > >> I am trying to learn classes. >> I am currently using Python 2.7 at the command line. > >(I think you mean “the interactive Python interpreter”, or just “the >Python shell”.) > >Since you are learning Python, I will

Re: Classes and the command line

2014-10-26 Thread Seymore4Head
On Mon, 27 Oct 2014 14:10:01 +1100, Chris Angelico wrote: >On Mon, Oct 27, 2014 at 2:06 PM, Ben Finney wrote: >> Right. There is line-by-line history, and editing enabled with the >> “readline” plug-in. (This is an advantage of using a programmer-friendly >> operating system, which MS Windows sa

Python Fabric on Windows :

2014-10-26 Thread Ganesh Pal
Hi Team , Iam new to Fabric and Iam using the fab command-line tool to run a set of task on Linux clients. I just started coding and Iam pretty new to fabric, Iam hoping I will be able to launch my fabric scripts from both Windows and Linux Machine . Installing Cygwin might help in wi

Re: 403 forbidden error

2014-10-26 Thread Diya Rai
On Wednesday, October 22, 2014 5:07:00 PM UTC+5:30, Diya Rai wrote: > Hai, > > Could anyone please help me to resolve 403 forbidden error while logging > into an application. > > Following is the error details: > > Traceback (most recent call last): > File "./example6.py", line 18, in >

Re: 403 forbidden error

2014-10-26 Thread Chris Angelico
On Mon, Oct 27, 2014 at 4:12 PM, Diya Rai wrote: > This is the part of the code which im trying to execute. We are trying to > load test a web application through python script, currently checking the > login part. > Does it work when you log in using a web browser? If so, grab a browser with d

Re: 403 forbidden error

2014-10-26 Thread Diya Rai
On Monday, October 27, 2014 11:05:04 AM UTC+5:30, Chris Angelico wrote: > On Mon, Oct 27, 2014 at 4:12 PM, Diya Rai wrote: > > This is the part of the code which im trying to execute. We are trying to > > load test a web application through python script, currently checking the > > login part. >