Unable to make http request to django server using twisted.web.client.AGENT

2015-11-04 Thread Akshat Tripathi
I have written a basic tcp server factory, server client and a service using twisted. The tcp server acts as the middleware between a django server and an another program (let's call it client program). What I want to achieve - 1.client requests the middleware tcp server; 2.it sends a string a

Re: What does “grep” stand for?

2015-11-04 Thread Christian Gollwitzer
Am 05.11.15 um 01:42 schrieb Chris Angelico: On Thu, Nov 5, 2015 at 6:38 AM, Christian Gollwitzer wrote: As someone who grew up on MS-DOS, I'd like to mention that EDLIN's value wasn't in the obvious places. There were two features it had that most other editors didn't: firstly, it would read on

Re: Detection of a specific sound

2015-11-04 Thread Gregory Ewing
Joel Goldstick wrote: Sometimes (maybe most times) the follow on discussion goes off on insightful tangents that may have little to do with the OP. And then someone mentions a Monty Python sketch about Hitler, thereby both bring the discussion back on-topic *and* invoking Godwin's Law at the sa

Re: Regular expressions

2015-11-04 Thread rurpy--- via Python-list
On Wednesday, November 4, 2015 at 7:46:24 PM UTC-7, Chris Angelico wrote: > On Thu, Nov 5, 2015 at 11:24 AM, rurpy wrote: > The "take away" that I recommend is: Rurpy loves to argue in favour of > regular expressions, No, I don't love it, I quite dislike it. > but as you can see from the other p

Re: Regular expressions

2015-11-04 Thread rurpy--- via Python-list
On 11/04/2015 07:24 PM, Steven D'Aprano wrote: > On Thu, 5 Nov 2015 11:24 am, wrote: > >> You will find they are an indispensable tool, not just in Python >> programming but in many aspects of computer use. > > You will find them a useful tool, but not indispensable by any means. > > Hint: > > - Ho

Re: Regular expressions

2015-11-04 Thread rurpy--- via Python-list
On Wednesday, November 4, 2015 at 7:31:34 PM UTC-7, Steven D'Aprano wrote: > On Thu, 5 Nov 2015 11:13 am, rurpy wrote: > > > There would be far fewer computer languages, and they would be much > > more primitive if regular expressions (and the fundamental concepts > > that they express) did not ex

Re: Regular expressions

2015-11-04 Thread rurpy--- via Python-list
On 11/04/2015 05:33 PM, Chris Angelico wrote: > On Thu, Nov 5, 2015 at 11:13 AM, rurpy--- via Python-list > wrote: >> On 11/04/2015 07:52 AM, Chris Angelico wrote: >>> On Thu, Nov 5, 2015 at 1:38 AM, rurpy wrote: I'm afraid you are making a category error but perhaps that's in part becau

Re: raw_input and break

2015-11-04 Thread tian . su . yale
在 2015年11月4日星期三 UTC-6下午3:45:09,input/ld...@casema.nl写道: > I have an continues loop with "while True:" > Now I want to use "raw_input" and when I press "s" on the keybord that it > will > "break" the continues loop. > > I tried: > choices = raw_input > if choises == s: > break > > But even when

Re: How to handle exceptions properly in a pythonic way?

2015-11-04 Thread tian . su . yale
Hi, If I may, I feel you are tying to address a few questions at the same time, although they are related 1. Where to put the try/except block, inside or outside the function 2. How to deal with un-anticipated exceptions 3. How to keep record My personal feelings are: 1. Kind of prefer try/except

Re: How to handle exceptions properly in a pythonic way?

2015-11-04 Thread tian . su . yale
在 2015年11月4日星期三 UTC-6下午10:18:33,zlju...@gmail.com写道: > > Which would you prefer? > > So if I am just checking for the ConnectionError in get_html and a new > exception arises, I will have traceback to the get_html function showing that > unhandled exception has happened. > Now I have to put addi

Re: How to handle exceptions properly in a pythonic way?

2015-11-04 Thread Chris Angelico
On Thu, Nov 5, 2015 at 3:18 PM, wrote: >> Which would you prefer? > > So if I am just checking for the ConnectionError in get_html and a new > exception arises, I will have traceback to the get_html function showing that > unhandled exception has happened. > Now I have to put additional excepti

Re: How to handle exceptions properly in a pythonic way?

2015-11-04 Thread zljubisic
> Which would you prefer? So if I am just checking for the ConnectionError in get_html and a new exception arises, I will have traceback to the get_html function showing that unhandled exception has happened. Now I have to put additional exception block for managing the new exception in the get

Re: How to handle exceptions properly in a pythonic way?

2015-11-04 Thread zljubisic
On Monday, 2 November 2015 21:59:45 UTC+1, Ian wrote: > I'm having a hard time understanding what question you're asking. :) I am really having a hard time to explain the problem as English is not my first language. > You > have a lot of discussion about where to handle exceptions, That's

Re: How to handle exceptions properly in a pythonic way?

2015-11-04 Thread Chris Angelico
On Thu, Nov 5, 2015 at 2:41 PM, wrote: > Raising an exception forces me to put every call of the get_html function in > try/except block. > If I am returning a special value, than I can call get_html and then test the > value. > > I am not sure which approach is better. Raising an exception me

Re: How to handle exceptions properly in a pythonic way?

2015-11-04 Thread zljubisic
> The best way is probably to do nothing at all, and let the caller handle > any exceptions. In that case every call of the get_html function has to be in the try/except block with many exceptions. Sometimes, it is enough just to know whether I managed to get the html or not. In that case, I coul

Re: Regular expressions

2015-11-04 Thread Ben Finney
Steven D'Aprano writes: > Yes yes, I know that regexes aren't the only tool in my tool box, but > *right now* I want to learn how to use regexes. I'll gently suggest this isn't a particularly good forum to do so. Learn them with a tool like http://www.regexr.com/> and a tutorial http://www.usna

Re: Regular expressions

2015-11-04 Thread Ben Finney
Steven D'Aprano writes: > On Wed, 4 Nov 2015 07:57 pm, Peter Otten wrote: > > > I tried Tim's example > > > > $ seq 5 | grep '1*' > > 1 > > 2 > > 3 > > 4 > > 5 > > $ > > I don't understand this. What on earth is grep matching? How does "4" > match "1*"? You can experiment with regular expressio

Re: Regular expressions

2015-11-04 Thread Tim Chase
On 2015-11-05 13:28, Steven D'Aprano wrote: > > I tried Tim's example > > > > $ seq 5 | grep '1*' > > 1 > > 2 > > 3 > > 4 > > 5 > > $ > > I don't understand this. What on earth is grep matching? How does > "4" match "1*"? The line with "4" matches "zero or more 1s". If it was searching for a

Re: Regular expressions

2015-11-04 Thread Chris Angelico
On Thu, Nov 5, 2015 at 11:24 AM, rurpy--- via Python-list wrote: > On Wednesday, November 4, 2015 at 4:05:06 PM UTC-7, Seymore4Head wrote: >>[...] >> I am still here, but I have to admit I am not picking up too much. > > The "take away" I recommend is: the folks here are often way > overly negativ

Re: Regular expressions

2015-11-04 Thread Steven D'Aprano
On Thu, 5 Nov 2015 11:13 am, ru...@yahoo.com wrote: > There would be far fewer computer languages, and they would be much > more primitive if regular expressions (and the fundamental concepts > that they express) did not exist. Well, that's certainly true. But only because contra-factual statemen

Re: Regular expressions

2015-11-04 Thread Steven D'Aprano
On Wed, 4 Nov 2015 07:57 pm, Peter Otten wrote: > I tried Tim's example > > $ seq 5 | grep '1*' > 1 > 2 > 3 > 4 > 5 > $ I don't understand this. What on earth is grep matching? How does "4" match "1*"? > which surprised me because I remembered that there usually weren't any > matching lines wh

Re: Regular expressions

2015-11-04 Thread Steven D'Aprano
On Thu, 5 Nov 2015 11:24 am, ru...@yahoo.com wrote: > You will find they are an indispensable tool, not just in Python > programming but in many aspects of computer use. You will find them a useful tool, but not indispensable by any means. Hint: - How many languages make arithmetic a built-in p

Re: Regular expressions

2015-11-04 Thread Steven D'Aprano
On Thu, 5 Nov 2015 10:02 am, Seymore4Head wrote: > So far the only use I have for regex is to replace slicing, but I > think it is an improvement. I don't understand this. This is like saying "so far the only use I have for a sandwich press is to replace my coffee pot". Regular expressions and sl

Re: raw_input and break

2015-11-04 Thread Steven D'Aprano
On Thu, 5 Nov 2015 09:37 am, input/ldompel...@casema.nl wrote: > I quote the s, but its still break even when I not press the s. The code you have shown us is so full of bugs and typos that you cannot possibly be running that code. Unfortunately, we do not have magical powers. We cannot see the

Re: What does “grep” stand for?

2015-11-04 Thread Chris Angelico
On Thu, Nov 5, 2015 at 6:38 AM, Christian Gollwitzer wrote: > Am 04.11.15 um 19:24 schrieb Ben Finney: >> >> The name is a mnemonic for a compound command in ‘ed’ [0], a text editor >> that pre-dates extravagant luxuries like “presenting a full screen of >> text at one time”. >> >> [... lots of f

Re: Regular expressions

2015-11-04 Thread Chris Angelico
On Thu, Nov 5, 2015 at 11:13 AM, rurpy--- via Python-list wrote: > On 11/04/2015 07:52 AM, Chris Angelico wrote: >> On Thu, Nov 5, 2015 at 1:38 AM, rurpy wrote: >>> I'm afraid you are making a category error but perhaps that's in >>> part because I wasn't clear. I was not talking about computer >

Re: Regular expressions

2015-11-04 Thread rurpy--- via Python-list
On Wednesday, November 4, 2015 at 4:05:06 PM UTC-7, Seymore4Head wrote: >[...] > I am still here, but I have to admit I am not picking up too much. The "take away" I recommend is: the folks here are often way overly negative regarding regular expressions and that you not ignore them, but take the

Re: Regular expressions

2015-11-04 Thread rurpy--- via Python-list
On 11/04/2015 07:52 AM, Chris Angelico wrote: > On Thu, Nov 5, 2015 at 1:38 AM, rurpy wrote: >> I'm afraid you are making a category error but perhaps that's in >> part because I wasn't clear. I was not talking about computer >> science. I was talking about human beings learning about computers.

OT ish History Channel - The Invention of the Internet

2015-11-04 Thread Seymore4Head
https://www.youtube.com/watch?v=M9ebkjWU6Z4 -- https://mail.python.org/mailman/listinfo/python-list

Re: Regular expressions

2015-11-04 Thread Seymore4Head
On Wed, 4 Nov 2015 18:08:51 -0500, Terry Reedy wrote: >On 11/3/2015 10:23 PM, Steven D'Aprano wrote: > >> I don't even know what grep stands for. > >Get Regular Expression & Print Thanks, I may get around to that eventually. -- https://mail.python.org/mailman/listinfo/python-list

Re: any practise site about python?

2015-11-04 Thread Joel Goldstick
On Wed, Nov 4, 2015 at 5:59 PM, Emile van Sebille wrote: > On 11/4/2015 11:38 AM, alperen wrote: > >> hi guys. >> i am computer engineering student and i want to practise the lectures >> that i saw at school. for example dictionaries tuples or some other topics. >> i know eulerproject but it is h

Re: Regular expressions

2015-11-04 Thread Seymore4Head
On Wed, 04 Nov 2015 14:48:21 +1100, Steven D'Aprano wrote: >On Wednesday 04 November 2015 11:33, ru...@yahoo.com wrote: > >>> Not quite. Core language concepts like ifs, loops, functions, >>> variables, slicing, etc are the socket wrenches of the programmer's >>> toolbox. Regexs are like an ele

Re: Bugfixing python 3.5 asyncio

2015-11-04 Thread Dmitry Panteleev
Hello, Yes, the fix has been merged. If 3.5.1 gets released in a month, it should not be a problem. And looks like it dpends on http://bugs.python.org/issue25446 . Thank you for the information. Dmitry On Wed, Nov 4, 2015 at 5:52 PM, Terry Reedy wrote: > On 11/3/2015 8:24 PM, Dmitry Panteleev w

Re: Regular expressions

2015-11-04 Thread Terry Reedy
On 11/3/2015 10:23 PM, Steven D'Aprano wrote: I don't even know what grep stands for. Get Regular Expression & Print -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Regular expressions

2015-11-04 Thread Seymore4Head
On Wed, 04 Nov 2015 08:13:51 -0700, Michael Torrie wrote: >On 11/04/2015 01:57 AM, Peter Otten wrote: >> and then headed for the man page. Apparently there is a subset >> called "basic regular expressions": >> >> """> Basic vs Extended Regular Expressions >>In basic regular expressions

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Terry Reedy
On 11/3/2015 10:18 PM, Steven D'Aprano wrote: On Wednesday 04 November 2015 09:25, Terry Reedy wrote: On 11/3/2015 10:42 AM, Chris Angelico wrote: On Wed, Nov 4, 2015 at 2:00 AM, Random832 wrote: Nobody writes: It's probably related to the fact that std{in,out,err} are Unicode streams.

Re: any practise site about python?

2015-11-04 Thread Emile van Sebille
On 11/4/2015 11:38 AM, alperen wrote: hi guys. i am computer engineering student and i want to practise the lectures that i saw at school. for example dictionaries tuples or some other topics. i know eulerproject but it is hard for starting. do you know any exercise sites for students or begin

Re: Bugfixing python 3.5 asyncio

2015-11-04 Thread Terry Reedy
On 11/3/2015 8:24 PM, Dmitry Panteleev wrote: Hello, There is a bug in asyncio.Queue (https://github.com/python/asyncio/issues/268), which makes it unusable for us. It is fixed in master now. I presume that the fix has been merged into the CPython repository (you could check). If so, it shou

Re: raw_input and break

2015-11-04 Thread input/ldompeling
In reply to "Joel Goldstick" who wrote the following: > On Wed, Nov 4, 2015 at 4:44 PM, wrote: > > > I have an continues loop with "while True:" > > Now I want to use "raw_input" and when I press "s" on the keybord that it > > will > > "break" the continues loop. > > > > I tried: > > choices =

Re: raw_input and break

2015-11-04 Thread Joel Goldstick
On Wed, Nov 4, 2015 at 4:44 PM, wrote: > I have an continues loop with "while True:" > Now I want to use "raw_input" and when I press "s" on the keybord that it > will > "break" the continues loop. > > I tried: > choices = raw_input > if choises == s: > break > > But even when I not press "s" it

Re: raw_input and break

2015-11-04 Thread Ian Kelly
On Wed, Nov 4, 2015 at 2:44 PM, wrote: > I have an continues loop with "while True:" > Now I want to use "raw_input" and when I press "s" on the keybord that it will > "break" the continues loop. > > I tried: > choices = raw_input This doesn't call raw_input. For that you need to write raw_input

raw_input and break

2015-11-04 Thread input/ldompeling
I have an continues loop with "while True:" Now I want to use "raw_input" and when I press "s" on the keybord that it will "break" the continues loop. I tried: choices = raw_input if choises == s: break But even when I not press "s" it "break" I want that I not press "s" the script continues. A

Re: teacher need help!

2015-11-04 Thread Ian Kelly
On Wed, Nov 4, 2015 at 11:18 AM, Storey, Geneva wrote: > > > > > I am having the same problem that we experienced earlier (see below). This > student was exploring random numbers in Python. She named her program random > which caused confusion for her computer. We deleted the file, but still

Re: CherryPy cpstats and ws4py

2015-11-04 Thread Israel Brewster
Ok, let me ask a different question: the impression I have gotten when trying to find help with CherryPy in general and ws4py specifically is that these frameworks are not widely used or well supported. Is that a fair assessment, or do I just have issues that are outside the realm of experience

Re: teacher need help!

2015-11-04 Thread Storey, Geneva
I am having the same problem that we experienced earlier (see below). This student was exploring random numbers in Python. She named her program random which caused confusion for her computer. We deleted the file, but still had the problem. I removed Python from the machine. When I trie

Re: What does “grep” stand for?

2015-11-04 Thread Christian Gollwitzer
Am 04.11.15 um 19:24 schrieb Ben Finney: The name is a mnemonic for a compound command in ‘ed’ [0], a text editor that pre-dates extravagant luxuries like “presenting a full screen of text at one time”. [... lots of fun facts ...] Here is another fun fact: The convincing UI of ed was actually

any practise site about python?

2015-11-04 Thread alperen
hi guys. i am computer engineering student and i want to practise the lectures that i saw at school. for example dictionaries tuples or some other topics. i know eulerproject but it is hard for starting. do you know any exercise sites for students or beginners -- https://mail.python.org/mailman

Re: What does “grep” stand for? (was: Regular expressions)

2015-11-04 Thread Tim Chase
On 2015-11-05 05:24, Ben Finney wrote: > A very common command to issue, then, is “actually show me the line > of text I just specified”; the ‘p’ (for “print”) command. > > Another very common command is “find the text matching this pattern > and perform these commands on it”, which is ‘g’ (for “g

Re: pycrypto

2015-11-04 Thread Nagy László Zsolt
Can u give me a suited solution that simply works for me? > http://stackoverflow.com/questions/11405549/how-do-i-install-pycrypto-on-windows Voidspace only has Python 3.3. They are usually behind some minor versions. The only good way to do this is to compile it from sources. Unfortunately, not

What does “grep” stand for? (was: Regular expressions)

2015-11-04 Thread Ben Finney
Steven D'Aprano writes: > On Wednesday 04 November 2015 13:55, Dan Sommers wrote: > > > Its very name indicates that its default mode most certainly is > > regular expressions. > > I don't even know what grep stands for. “grep” stands for ‘g/RE/p’. The name is a mnemonic for a compound command

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Dave Farrance
Random832 wrote: >The opposite of line buffering is not no buffering, but full >(i.e. block) buffering, that doesn't get flushed until it runs >out of space. TextIOWrapper has its own internal buffer, and its >design apparently doesn't contemplate the possibility of using >it with a raw FileIO ob

Re: pycrypto

2015-11-04 Thread Ian Kelly
On Wed, Nov 4, 2015 at 5:41 AM, Christoph Zallmann wrote: > Hey there, > > > > i tried using Python 3.5.0 in combination with pycrypto and everything i got > was crap. Really. I tried so many things, how to solve my problem - using > environment variables, vs 2015 and many more. With python 2.7 or

Re: Regular expressions

2015-11-04 Thread Tim Chase
On 2015-11-04 09:57, Peter Otten wrote: > Well, I didn't know that grep uses regular expressions by default. It doesn't help that grep(1) comes in multiple flavors: grep: should use BRE (Basic REs) fgrep: same as "grep -F"; uses fixed strings, no REs egrep: same as "grep -E"; uses ERE (Extende

Re: Irregular last line in a text file, was Re: Regular expressions

2015-11-04 Thread Tim Chase
On 2015-11-04 14:39, Steven D'Aprano wrote: > On Wednesday 04 November 2015 03:56, Tim Chase wrote: >> Or even more valuable to me: >> >> with open(..., newline="strip") as f: >> assert all(not line.endswith(("\n", "\r")) for line in f) > > # Works only on Windows text files. > def chomp(li

Re: Regular expressions

2015-11-04 Thread Michael Torrie
On 11/04/2015 01:57 AM, Peter Otten wrote: > and then headed for the man page. Apparently there is a subset > called "basic regular expressions": > > """> Basic vs Extended Regular Expressions >In basic regular expressions the meta-characters ?, +, {, |, (, >and ) lose their speci

Re: Regular expressions

2015-11-04 Thread Chris Angelico
On Thu, Nov 5, 2015 at 1:38 AM, rurpy--- via Python-list wrote: > I'm afraid you are making a category error but perhaps that's in > part because I wasn't clear. I was not talking about computer > science. I was talking about human beings learning about computers. > Most people I know consider p

Re: Regular expressions

2015-11-04 Thread rurpy--- via Python-list
On Wednesday, November 4, 2015 at 1:52:31 AM UTC-7, Steven D'Aprano wrote: > On Wednesday 04 November 2015 18:21, Christian Gollwitzer wrote: > > > What rurpy meant, was that regexes can surface to a computer user > > earlier than variables and branches; a user who does not go into the > > depth t

Re: Regular expressions

2015-11-04 Thread rurpy--- via Python-list
On 11/03/2015 08:48 PM, Steven D'Aprano wrote: > On Wednesday 04 November 2015 11:33, rurpy wrote: > >>> Not quite. Core language concepts like ifs, loops, functions, >>> variables, slicing, etc are the socket wrenches of the programmer's >>> toolbox. Regexs are like an electric impact socket wre

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Random832
Wolfgang Maier writes: > Standard I/O streams are line-buffered only if interactive (i.e., > connected to a console), but block-buffered otherwise. That's not appropriate for stderr, nor is it justified by the argument that Terry Reedy cited earlier. I had assumed he was making an implicit claim

Re: Regular expressions

2015-11-04 Thread Grant Edwards
On 2015-11-04, Michael Torrie wrote: > On 11/03/2015 08:23 PM, Steven D'Aprano wrote: >> Grep can use regular expressions (and I do so with it regularly), but it's default mode is certainly not regular expressions ... >>> >>> Its very name indicates that its default mode most certainly i

Re: LU decomposition

2015-11-04 Thread Nagy László Zsolt
> Hey, > > I have to write a LU-decomposition. My Code worked so far but (I want to > become better:) ) I want to ask you, if I could write this LU-decomposition > in a better way? Why can't you just use scipy for this? http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.linalg.lu.

Bugfixing python 3.5 asyncio

2015-11-04 Thread Dmitry Panteleev
Hello, There is a bug in asyncio.Queue (https://github.com/python/asyncio/issues/268), which makes it unusable for us. It is fixed in master now. What is the easiest way to patch the asyncio bundled with python if I have to distribute it among 5 colleagues? It is used in our private module. I can

pycrypto

2015-11-04 Thread Christoph Zallmann
Hey there, i tried using Python 3.5.0 in combination with pycrypto and everything i got was crap. Really. I tried so many things, how to solve my problem - using environment variables, vs 2015 and many more. With python 2.7 or even 3.4 i heard it was no problem but using 3.5 all i got was one e

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Wolfgang Maier
On 04.11.2015 11:43, Wolfgang Maier wrote: On 04.11.2015 11:24, Steven D'Aprano wrote: On Wed, 4 Nov 2015 07:19 pm, Wolfgang Maier wrote: On 04.11.2015 04:18, Steven D'Aprano wrote: This is one of the offending line from our code base: print('<4>Suspicious answer "{}"!'.format(answer), file

Re: Regular expressions

2015-11-04 Thread Antoon Pardon
Op 04-11-15 om 04:35 schreef Steven D'Aprano: > On Wednesday 04 November 2015 03:20, Chris Angelico wrote: > >> (So, >> too, are all the comments about using [-1] or string methods. But we >> weren't to know that.) > If MRAB could understand what he wanted, I'm sure most others could have > too.

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Wolfgang Maier
On 04.11.2015 11:24, Steven D'Aprano wrote: On Wed, 4 Nov 2015 07:19 pm, Wolfgang Maier wrote: On 04.11.2015 04:18, Steven D'Aprano wrote: This is one of the offending line from our code base: print('<4>Suspicious answer "{}"!'.format(answer), file=sys.stderr) So that ought to be terminated

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Steven D'Aprano
On Wed, 4 Nov 2015 07:19 pm, Wolfgang Maier wrote: > On 04.11.2015 04:18, Steven D'Aprano wrote: >> On Wednesday 04 November 2015 09:25, Terry Reedy wrote: >> >>> On 11/3/2015 10:42 AM, Chris Angelico wrote: On Wed, Nov 4, 2015 at 2:00 AM, Random832 wrote: > Nobody writes: > >>

Re: Creating PST files using Python

2015-11-04 Thread Tim Golden
On 03/11/2015 22:12, Chris Angelico wrote: > On Wed, Nov 4, 2015 at 6:09 AM, Anthony Papillion > wrote: >> Does anyone know of a module that allows the wiring of Outlook PST >> files using Python? I'm working on a project that will require me >> to migrate 60gb of maildir mail (multiple accounts)

Re: Irregular last line in a text file, was Re: Regular expressions

2015-11-04 Thread Oscar Benjamin
On 4 November 2015 at 03:39, Steven D'Aprano wrote: > > Better would be this: > > def chomp(lines): > for line in lines: > yield line.rstrip() # remove all trailing whitespace > > > with open(...) as f: > for line in chomp(f): ... with open(...) as f: for line in map(str.rstr

Re: Regular expressions

2015-11-04 Thread Peter Otten
Michael Torrie wrote: > On 11/03/2015 08:23 PM, Steven D'Aprano wrote: Grep can use regular expressions (and I do so with it regularly), but it's default mode is certainly not regular expressions ... >>> >>> Its very name indicates that its default mode most certainly is regular >>> expr

Re: Regular expressions

2015-11-04 Thread Steven D'Aprano
On Wednesday 04 November 2015 18:21, Christian Gollwitzer wrote: > What rurpy meant, was that regexes can surface to a computer user > earlier than variables and branches; a user who does not go into the > depth to actually program the machine, might still encounter them in a > text editor or data

Re: Is it ok to install python binaries on a network drive?

2015-11-04 Thread Fabien
On 10/29/2015 01:07 PM, Steven D'Aprano wrote: My question is: what will happen when about 20 students will do the same >at the same time? I know too little about what's going under the hood >with an "import X" command to be able to predict problems that might >occur. I think it should be fine.

Re: Unbuffered stderr in Python 3

2015-11-04 Thread Wolfgang Maier
On 04.11.2015 04:18, Steven D'Aprano wrote: On Wednesday 04 November 2015 09:25, Terry Reedy wrote: On 11/3/2015 10:42 AM, Chris Angelico wrote: On Wed, Nov 4, 2015 at 2:00 AM, Random832 wrote: Nobody writes: It's probably related to the fact that std{in,out,err} are Unicode streams. Th