Re: coverage.py: Statement coverage is the weakest measure of code coverage

2007-10-30 Thread Ned Batchelder
Finney [EMAIL PROTECTED] wrote: Howdy all, Ned Batchelder has been maintaining the nice simple tool 'coverage.py' URL:http://nedbatchelder.com/code/modules/coverage.html for measuring unit test coverage. On the same site, Ned includes documentation URL:http://nedbatchelder.com/code/modules/rees

Re: Is it possible to make a unittest decorator to rename a method from x to testx?

2013-08-08 Thread Ned Batchelder
On 8/8/13 12:17 PM, adam.pre...@gmail.com wrote: On Thursday, August 8, 2013 3:50:47 AM UTC-5, Peter Otten wrote: Peter Otten wrote: Oops, that's an odd class name. Fixing the name clash in Types.__new__() is left as an exercise... I will do some experiments with a custom test loader since I

Re: How many times does unittest run each test?

2013-08-10 Thread Ned Batchelder
On 8/10/13 4:40 PM, Roy Smith wrote: In article f7b24010-f3f4-4e86-b6c4-9ddb503d0...@googlegroups.com, Josh English joshua.r.engl...@gmail.com wrote: I am working on a library, and adding one feature broke a seemingly unrelated feature. As I already had Test Cases written, I decided to try

Re: Am I not seeing the Error?

2013-08-12 Thread Ned Batchelder
On 8/12/13 8:33 AM, Devyn Collier Johnson wrote: On 08/10/2013 10:47 PM, Chris Angelico wrote: On Sun, Aug 11, 2013 at 3:43 AM, Roy Smith r...@panix.com wrote: In article mailman.452.1376188442.1251.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: When you get a syntax

Re: Am I not seeing the Error?

2013-08-12 Thread Ned Batchelder
On 8/12/13 4:16 PM, Devyn Collier Johnson wrote: On 08/12/2013 12:56 PM, Joel Goldstick wrote: On Mon, Aug 12, 2013 at 11:47 AM, Roy Smith r...@panix.com wrote: I can't quite sort out the multiple quoting levels, but somebody said: Programming like that is called trolling. A programmer

Re: Am I not seeing the Error?

2013-08-13 Thread Ned Batchelder
On 8/13/13 5:16 PM, Dave Angel wrote: Denis McMahon wrote: On Sat, 10 Aug 2013 22:19:23 -0400, Devyn Collier Johnson wrote: I am checking my 1292-line script for syntax errors. I ran the following commands in a terminal to check for errors, but I do not see the error. JOB_WRITEURGFILES =

Re: Basic Python Query

2013-08-21 Thread Ned Batchelder
On 8/21/13 6:50 PM, Fábio Santos wrote: On 21 Aug 2013 20:07, Johannes Bauer dfnsonfsdu...@gmx.de mailto:dfnsonfsdu...@gmx.de wrote: On 21.08.2013 11:11, Ulrich Eckhardt wrote: That said, there is never a need for deriving from the Thread class, you can also use it to run a function

Re: Basic Python Query

2013-08-22 Thread Ned Batchelder
On 8/22/13 1:43 AM, Bob Martin wrote: in 704175 20130822 010625 Ned Batchelder n...@nedbatchelder.com wrote: This is a multi-part message in MIME format. Please post in plain text, not HTML. Sorry, Bob, I will try to remember in the future. I think Thunderbird is sending in the same format

Re: python eval function

2013-08-25 Thread Ned Batchelder
On 8/25/13 7:49 PM, Terry Reedy wrote: On 8/25/2013 3:18 PM, Mohsen Pahlevanzadeh wrote: eval doesn't run my code at the following link: http://stackoverflow.com/questions/18432198/eval-function-doesnt-work-in-python Already answered there (code is statememt, not expression) The larger

Re: semicolon at end of python's statements

2013-08-28 Thread Ned Batchelder
On 8/28/13 8:18 PM, Mohsen Pahlevanzadeh wrote: Dear all, I'm C++ programmer and unfortunately put semicolon at end of my statements in python. Quesion: What's really defferences between putting semicolon and don't put? There is no difference. The semicolon is unnecessary in Python. If you

Re: Interface and duck typing woes

2013-08-30 Thread Ned Batchelder
On 8/30/13 8:13 PM, Steven D'Aprano wrote: On Fri, 30 Aug 2013 06:35:47 -0400, Roy Smith wrote: In article 52200699$0$6599$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: These days, it would be relatively simple to implement pre- and post-

Re: print function and unwanted trailing space

2013-08-31 Thread Ned Batchelder
On 8/31/13 4:17 AM, candide wrote: What is the equivalent in Python 3 to the following Python 2 code: # - for i in range(5): print i, # - ? Be careful that the above code doesn't add a trailing space after the last number in the

Re: Encapsulation unpythonic?

2013-08-31 Thread Ned Batchelder
On 8/31/13 7:46 AM, Steven D'Aprano wrote: On Fri, 30 Aug 2013 23:07:47 -0700, Fabrice Pombet wrote: well, look at that: a=(1,2) a=2+3 -a is an object and I have changed its type and value from outside. Incorrect. You have not changed the type or value of any object. a is not an object, it

Re: Chardet, file, ... and the Flexible String Representation

2013-09-06 Thread Ned Batchelder
On 9/6/13 5:11 AM, wxjmfa...@gmail.com wrote: The Flexible String Representation has conceptually to face the same problem. It splits unicode in chunks and it has to solve two problems at the same time, the coding and the handling of multiple char sets. The problem? It fails. Just once, please

Re: Chardet, file, ... and the Flexible String Representation

2013-09-09 Thread Ned Batchelder
On 9/9/13 10:28 AM, wxjmfa...@gmail.com wrote: Le vendredi 6 septembre 2013 17:46:14 UTC+2, Piet van Oostrum a écrit : wxjmfa...@gmail.com writes: The Flexible String Representation has conceptually to face the same problem. It splits unicode in chunks and it has to solve two problems at

Re: Language design

2013-09-12 Thread Ned Batchelder
On 9/12/13 2:24 PM, Markus Rother wrote: On 10.09.2013 08:09, Steven D'Aprano wrote: What design mistakes, traps or gotchas do you think Python has? Gotchas are not necessarily a bad thing, there may be good reasons for it, but they're surprising. I have one more: Dictionaries should iterate

Re: mutlifile inheritance problem

2013-09-18 Thread Ned Batchelder
On 9/18/13 7:54 PM, Peter Cacioppi wrote: This is a very old topic, but here is a trick for single inheritance. (The problem you allude to isn't restricted to multiple inheritance). Any class with a single parent simply defines this function. def mySuper(self) : return

Re: building an online judge to evaluate Python programs

2013-09-20 Thread Ned Batchelder
On 9/20/13 6:26 PM, Jabba Laci wrote: I just found Docker ( http://docs.docker.io/en/latest/faq/ ). It seems sandboxing could be done with this easily. At edX, I wrote CodeJail (https://github.com/edx/codejail) to use AppArmor to run Python securely. For grading Python programs, we use a

Re: building an online judge to evaluate Python programs

2013-09-21 Thread Ned Batchelder
protections beyond AppArmor, setrlimits is also used to limit some resource use. --Ned. BTW: Top-posting makes it harder to follow threads of conversations, better form is to add your comments below the person you're replying to. Thanks, Laszlo On Sat, Sep 21, 2013 at 12:46 AM, Ned Batchelder n

Re: Why do I have to use global so much when using Turtle?

2013-09-22 Thread Ned Batchelder
On 9/22/13 12:39 AM, John Ladasky wrote: For a while, I had a quit function that I bound to the q key: sc.onkeypress(quit, q) The quit function simply printed a message, and then called sc.bye(). As with move_balls, quit wouldn't work unless I had a global sc declaration in it. (My

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-22 Thread Ned Batchelder
On 9/22/13 12:09 AM, Luca Cerone wrote: Hi Chris, actually my priority is to check that the code is correct. I changed the syntax during the development, and I want to be sure that my tutorial is up to date. If you do manage to ignore the output, how will you know that the syntax is correct?

Re: building an online judge to evaluate Python programs

2013-09-23 Thread Ned Batchelder
On 9/23/13 8:33 AM, Fábio Santos wrote: On 20 Sep 2013 21:14, Jabba Laci jabba.l...@gmail.com mailto:jabba.l...@gmail.com wrote: That last seems to me to be the biggie. Several times in the past few years, people in this mailing list have tried to build a safe sandbox. And each one

Re: Referrer key missing form os.environ dictionary?

2013-09-25 Thread Ned Batchelder
On 9/25/13 10:26 AM, John Gordon wrote: You could try this: try: referer = os.environ.get('HTTP_REFERER', 'UnknownRef') except KeyError: referer = None if not referer: referer = 'UnknownRef' There's no need for the except KeyError clause. dict.get

Re: Convert namedtuple to dictionary

2013-09-25 Thread Ned Batchelder
On 9/25/13 6:45 PM, trip...@gmail.com wrote: Need suggestions. Say, I have a namedtuple like this: {'a': brucelee(x=123, y=321), 'b': brucelee('x'=123, 'y'=321) I need to convert it to: {'a': {'x':123, 'y': 321},'b': {'x':123, 'y': 321}} Namedtuples have a ._asdict() method. You can

Re: Convert namedtuple to dictionary

2013-09-26 Thread Ned Batchelder
On 9/26/13 1:17 PM, Virendra Tripathi wrote: Hi Ned, Thanks. Wouldn't I have to first create a function to pull out the 'dictdict' from the data? I assume 'dictdict' refers to the 'brucelee' named tuple in the example. That's where I was getting stuck-trying to pull out the named tuples from

Re: Convert namedtuple to dictionary

2013-09-26 Thread Ned Batchelder
On 9/26/13 1:42 PM, Ned Batchelder wrote: On 9/26/13 1:17 PM, Virendra Tripathi wrote: Hi Ned, Thanks. Wouldn't I have to first create a function to pull out the 'dictdict' from the data? I assume 'dictdict' refers to the 'brucelee' named tuple in the example. That's where I was getting

Re: card dealer

2013-09-27 Thread Ned Batchelder
On 9/27/13 12:10 PM, Denis McMahon wrote: On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: i recall writing a shuffle function in C decades ago, which took an array of (52) unique items and put them in random order. Whenever I tried to write shuffles I came up against a fairly

Re: walking a heapq nondestructively without duplicating?

2013-09-27 Thread Ned Batchelder
On 9/27/13 6:22 PM, Tim Chase wrote: I've got a large heapq'ified list and want to walk it in-order without altering it. I get the unsorted heap'ish results if I just do from heapq import heappush, heappop, nlargest, nsmallest my_heap = [] for thing in lots_of_items():

Re: card dealer

2013-09-28 Thread Ned Batchelder
On 9/28/13 2:01 AM, Steven D'Aprano wrote: On Fri, 27 Sep 2013 17:40:46 -0400, Ned Batchelder wrote: On 9/27/13 12:10 PM, Denis McMahon wrote: On Fri, 27 Sep 2013 12:08:33 +, Dave Angel wrote: i recall writing a shuffle function in C decades ago, which took an array of (52) unique items

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-09-29 Thread Ned Batchelder
On 9/29/13 4:04 AM, Νίκος wrote: Στις 29/9/2013 11:00 πμ, ο/η Chris Angelico έγραψε: On Sun, Sep 29, 2013 at 5:53 PM, Νίκος nikos.gr...@gmail.com wrote: Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte Something's trying to decode a stream of

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-09-29 Thread Ned Batchelder
On 9/29/13 1:30 PM, Terry Reedy wrote: On 9/29/2013 6:53 AM, Ned Batchelder wrote: This is the nature of Unicode pain in Python 2 (Python 3 has a different kind!). This may help you understand what's going on: http://nedbatchelder.com/text/unipain.html This is really excellent and I

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-09-30 Thread Ned Batchelder
On 9/30/13 2:42 PM, Mark Lawrence wrote: Please drop dead and the sooner the better. Your arrogant attitide to the numerous people who've tried so hard to help you is disgraceful. Mark, I'm as frustrated as anyone by Nikos' threads, but there's really no call for Please drop dead. We can do

Re: class implementation

2013-09-30 Thread Ned Batchelder
On 9/30/13 3:34 PM, Dave Angel wrote: Python doesn't actually have variables, but the things it documents as variables are local names within a method. Those are not visible outside of the method, regardless of whether you're in a class or a subclass. Why does this meme persist!? Of course

Re: Python variables? [was Re: class implementation]

2013-09-30 Thread Ned Batchelder
On 9/30/13 6:02 PM, Ethan Furman wrote: On 09/30/2013 02:28 PM, Ned Batchelder wrote: On 9/30/13 3:34 PM, Dave Angel wrote: Python doesn't actually have variables, but the things it documents as variables are local names within a method. Those are not visible outside of the method

Re: Python variables?

2013-09-30 Thread Ned Batchelder
On 9/30/13 6:37 PM, Ben Finney wrote: Ethan Furman et...@stoneleaf.us writes: From [Ned Batchelder]'s blog: Names are Python's variables: they refer to values, and those values can change (vary) over the course of your program. This is partially incorrect. If the value referred

Re: Python variables?

2013-09-30 Thread Ned Batchelder
On 9/30/13 9:03 PM, Steven D'Aprano wrote: On Mon, 30 Sep 2013 19:47:49 -0400, Ned Batchelder wrote: On 9/30/13 6:37 PM, Ben Finney wrote: Ethan Furman et...@stoneleaf.us writes: From [Ned Batchelder]'s blog: Names are Python's variables: they refer to values, and those values can

Re: I haev fixed it

2013-10-01 Thread Ned Batchelder
On 10/1/13 6:54 AM, Νίκος wrote: Στις 1/10/2013 1:47 μμ, ο/η Chris Angelico έγραψε: On Tue, Oct 1, 2013 at 8:16 PM, Νίκος nikos.gr...@gmail.com wrote: WHO AND MOST IMPORTNTANLY HOW DID HE MANAGED TO UPLOAD THIS FILE ON MY ACCOUNT? PLEASE ANSWER ME, I WONT GET MAD, BUT THIS IS AN IMPORTANT

Re: JUST GOT HACKED

2013-10-01 Thread Ned Batchelder
On 10/1/13 10:24 AM, Daniel Stojanov wrote: 2) I just signed up the this mailing list. To the regulars, is this what normally happens on this list? This is not what normally happens here. Usually we have concise and helpful conversations. Unfortunately, every online community has to

Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Ned Batchelder
On 10/2/13 9:41 AM, Νίκος wrote: Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε: On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote: Is it possible for someone that knows the MYSQL password of a server to run arbitrary code on a linux server? Yes, it is possible. Is that what might have

Re: Can arbitrary code run in a server if someone's know just the MySQL password?

2013-10-02 Thread Ned Batchelder
On 10/2/13 10:46 AM, Νίκος wrote: Στις 2/10/2013 4:58 μμ, ο/η Ned Batchelder έγραψε: On 10/2/13 9:41 AM, Νίκος wrote: Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε: On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote: Is it possible for someone that knows the MYSQL password of a server

Re: Select fails when cookie tried to get a numeric value

2013-10-05 Thread Ned Batchelder
On 10/5/13 9:38 AM, Νίκος Αλεξόπουλος wrote: # initialize cookie cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') ) cookie.load( cookie ) vip = cookie.get('ID') ... ... # if browser cookie does not exist, set it vip = random.randrange(0, 1) cookie['ID'] = vip

Re: Select fails when cookie tried to get a numeric value

2013-10-05 Thread Ned Batchelder
On 10/5/13 10:30 AM, Νίκος Αλεξόπουλος wrote: Στις 5/10/2013 5:28 μμ, ο/η Chris Angelico έγραψε: On Sun, Oct 6, 2013 at 12:24 AM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: But i have given you the line that produces the error: The statement you quoted is an INSERT. The traceback quotes

Re: Select fails when cookie tried to get a numeric value

2013-10-05 Thread Ned Batchelder
On 10/5/13 10:40 AM, Νίκος Αλεξόπουλος wrote: Στις 5/10/2013 4:53 μμ, ο/η Ned Batchelder έγραψε: From reading the bottom-most frame, you can see that the problem is that val is an http.cookies.Morsel object. This means you probably tried to use a cookie object as data in your SQL query

Re: Select fails when cookie tried to get a numeric value

2013-10-05 Thread Ned Batchelder
On 10/5/13 10:40 AM, Νίκος Αλεξόπουλος wrote: Στις 5/10/2013 4:53 μμ, ο/η Ned Batchelder έγραψε: From reading the bottom-most frame, you can see that the problem is that val is an http.cookies.Morsel object. This means you probably tried to use a cookie object as data in your SQL query

Re: Select fails when cookie tried to get a numeric value

2013-10-05 Thread Ned Batchelder
On 10/5/13 11:52 AM, Νίκος Αλεξόπουλος wrote: Στις 5/10/2013 6:12 μμ, ο/η Ned Batchelder έγραψε: On 10/5/13 10:40 AM, Νίκος Αλεξόπουλος wrote: Στις 5/10/2013 4:53 μμ, ο/η Ned Batchelder έγραψε: From reading the bottom-most frame, you can see that the problem is that val

Re: Select fails when cookie tried to get a numeric value

2013-10-05 Thread Ned Batchelder
On 10/5/13 12:17 PM, Νίκος Αλεξόπουλος wrote: Στις 5/10/2013 7:14 μμ, ο/η Νίκος Αλεξόπουλος έγραψε: Στις 5/10/2013 7:08 μμ, ο/η Ned Batchelder έγραψε: On 10/5/13 11:52 AM, Νίκος Αλεξόπουλος wrote: Στις 5/10/2013 6:12 μμ, ο/η Ned Batchelder έγραψε: On 10/5/13 10:40 AM, Νίκος Αλεξόπουλος

Re: Database statements via python but database left intact

2013-10-05 Thread Ned Batchelder
On 10/5/13 5:02 PM, Νίκος Αλεξόπουλος wrote: Στις 5/10/2013 11:31 μμ, ο/η Ian Kelly έγραψε: Well, have you changed anything in your database configuration? Whether MySQL uses transactions or not depends on which storage engine is being used. I suggest running a test insert with and without

Re: Strange extra f added to bytes object

2013-10-06 Thread Ned Batchelder
On 10/6/13 6:47 PM, Robert Jackson wrote: I am very new to python so I'll apologize up front if this is some boneheaded thing. I am using python and pyserial to talk to an embedded pic processor in a piece of scientific equipment. I sometimes find the when I construct the bytes object to

Re: class-private names and the Zen of Python

2013-10-08 Thread Ned Batchelder
On 10/8/13 6:13 AM, Marco Buttu wrote: In the following case: class Foo: ... _Foo__a = 100 ... __a = 33 ... Foo._Foo__a 33 I think this behavior, for a user who does not know the convention, could be a surprise. Should be raising an exception (in order to inform the user the

Re: class-private names and the Zen of Python

2013-10-08 Thread Ned Batchelder
On 10/8/13 7:15 AM, Marco Buttu wrote: Also, as Terry mentions, no one has ever assigned the two names you show, Sincerely, I can not now if someone has assigned (or will assegne) in such way... If you explain more about what you are building, and where this crops up as a problem, we can

Re: Cookie gets changed when hit comes from a referrer

2013-10-08 Thread Ned Batchelder
On 10/8/13 6:52 PM, Νίκος Αλεξόπουλος wrote: Στις 8/10/2013 10:29 μμ, ο/η Denis McMahon έγραψε: On Tue, 08 Oct 2013 19:04:37 +0300, Νίκος Αλεξόπουλος wrote: Can you help me with this particuler problem please? Unfortunately I can't, because I am unable to reproduce the problem you describe.

Re: Encoding of surrogate code points to UTF-8

2013-10-09 Thread Ned Batchelder
On 10/9/13 4:22 AM, wxjmfa...@gmail.com wrote: Le mercredi 9 octobre 2013 08:20:05 UTC+2, Steven D'Aprano a écrit : http://www.unicode.org/versions/Unicode6.2.0/ch02.pdf#G13708 All three encoding forms can be used to represent the full range of encoded characters in the Unicode Standard; ...

Re: super in Python 3 and variadic arguments

2013-10-09 Thread Ned Batchelder
On 10/9/13 11:44 AM, Marco Buttu wrote: Given this class: class A: ... def afoo(*args): ... print(args) in Python 3 we can write the following class: class B(A): ... def bfoo(*args): ... super(B, args[0]).afoo(*args[1:]) ... B().bfoo(1, 2, 3) (__main__.B object at

Re: super in Python 3 and variadic arguments

2013-10-10 Thread Ned Batchelder
On 10/10/13 3:22 AM, Marco Buttu wrote: On 10/09/2013 06:47 PM, Ned Batchelder wrote: class B(A): ... def bfoo(*args): ... super().afoo(*args[1:]) ... B().bfoo(1, 2, 3) Traceback (most recent call last): File stdin, line 1, in module File stdin, line 3, in bfoo RuntimeError

Re: Python 3.2 | WIndows 7 -- Multiprocessing and files not closing

2013-10-10 Thread Ned Batchelder
On 10/10/13 12:44 PM, Isaac Gerg wrote: Sorry, I am just providing pseudo code since I the code i have is quite large. As I mentioned, the code works fine when I remove the multirpcessing stuff so the filename is not the issue (though you are right in your correction). Someone with the same

Re: Skipping decorators in unit tests

2013-10-10 Thread Ned Batchelder
On 10/10/13 6:12 PM, Cameron Simpson wrote: On 10Oct2013 07:00, Gilles Lenfant gilles.lenf...@gmail.com wrote: (explaining the title) : my app has functions and methods (and maybe classes in the future) that are decorated by decorators provided by the standard library or 3rd party packages.

Re: Unicode Objects in Tuples

2013-10-11 Thread Ned Batchelder
On 10/11/13 4:16 AM, Stephen Tucker wrote: I am using IDLE, Python 2.7.2 on Windows 7, 64-bit. I have four questions: 1. Why is it that print unicode_object displays non-ASCII characters in the unicode object correctly, whereas print (unicode_object, another_unicode_object) displays

Re: Skipping decorators in unit tests

2013-10-11 Thread Ned Batchelder
On 10/10/13 10:22 PM, Cameron Simpson wrote: On 10Oct2013 19:44, Ned Batchelder n...@nedbatchelder.com wrote: On 10/10/13 6:12 PM, Cameron Simpson wrote: Speaking for myself, I would be include to recast this code: @absolutize def addition(a, b): return a + b into: def

Re: Unicode Objects in Tuples

2013-10-12 Thread Ned Batchelder
On 10/12/13 2:20 AM, Ian Kelly wrote: On Fri, Oct 11, 2013 at 7:31 AM, Stephen Tucker stephen_tuc...@sil.org wrote: On the original question, well, I accept Ned's answer (at 10.22). I also like the idea of a helper function given by Peter Otten at 09.51. It still seems like a crutch to help

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-16 Thread Ned Batchelder
On 10/16/13 8:13 PM, Mark Janssen wrote: Who uses object abstraction in C? No one. That's why C++ was invented. If not, Linux, how about Python? http://hg.python.org/cpython/file/e2a411a429d6/Objects Or huge slabs of the OS/2 Presentation Manager, which is entirely object oriented and

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-16 Thread Ned Batchelder
On 10/16/13 8:53 PM, Mark Janssen wrote: And your earlier idea that punched cards didn't have tokens is wildly ignorant of the state of software and languages 50 years ago. Please tell me how you parsed tokens with binary switches 50 years ago. Your input is rubbish. The mention of punched

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-17 Thread Ned Batchelder
On 10/17/13 3:49 PM, Mark Janssen wrote: On Thu, Oct 17, 2013 at 10:32 AM, rusi rustompm...@gmail.com wrote: On Wednesday, October 16, 2013 1:56:27 AM UTC+5:30, zipher wrote: Yes, well clearly we are not having the same thoughts, yet the purpose of the academic establishment is to pin down

Re: Error Testing

2013-10-19 Thread Ned Batchelder
On 10/19/13 8:23 AM, Scott Novinger wrote: Hello. I've written a program for my kids to calculate arc length. I want to include some error testing for value types entered that are something other than integer values. My goal is to make sure that the value entered for the radius is an

Re: Error Testing

2013-10-19 Thread Ned Batchelder
On 10/19/13 8:57 AM, Roy Smith wrote: On 10/19/13 8:23 AM, Scott Novinger wrote: My goal is to make sure that the value entered for the radius is an integer value. In article mailman.1254.1382186691.18130.python-l...@python.org, Ned Batchelder n...@nedbatchelder.com wrote: First, radius

Re: skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Ned Batchelder
On 10/19/13 5:44 PM, Peter Cacioppi wrote: Is the following considered poor Python form? class Foo (object) : _lazy = None def foo(self, x) : _lazy = _lazy or self.get_something(x) def get_something(self, x) : # doesn't really matter I like this idiom for

Re: skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Ned Batchelder
On 10/19/13 8:42 PM, Peter Cacioppi wrote: To be clear, my original post had a goof. So my original, de-goofed, idiom was class Foo (object) : _lazy = None def foo(self, x) : self._lazy = self._lazy or self.get_something(x) def get_something(self, x) : #

Re: Python Front-end to GCC

2013-10-21 Thread Ned Batchelder
On 10/21/13 4:14 PM, Mark Janssen wrote: On Mon, Oct 21, 2013 at 12:46 AM, Steven D'Aprano st...@pearwood.info wrote: On Sun, 20 Oct 2013 20:35:03 -0700, Mark Janssen wrote: [Attribution to the original post has been lost] Is a jit implementation of a language (not just python) better than

Re: python -c commands on windows.

2013-10-21 Thread Ned Batchelder
On 10/21/13 4:47 PM, Terry Reedy wrote: Manual says -c command Execute the Python code in command. command can be one or more statements separated by newlines, with significant leading whitespace as in normal module code. In Windows Command Prompt I get: C:\Programs\Python33python -c

Re: Python Front-end to GCC

2013-10-22 Thread Ned Batchelder
On 10/22/13 11:04 AM, Mark Janssen wrote: I love it. Watch this... [context] A language specification in BNF is just syntax. It doesn't say anything about semantics. So how could this be used to produce executable C code for a program? BNF is used to produce parsers. But a parser isn't

Re: Python Front-end to GCC

2013-10-22 Thread Ned Batchelder
On 10/22/13 2:16 PM, Mark Janssen wrote: So which of you is confused? I ask that in the inclusive (not exclusive OR) sense ;^) -- face says both. Could you please be less snarky? Okay. The purpose of BNF (at least as I envision it) is to produce/specify a *context-free* grammar. A

Re: Python Front-end to GCC

2013-10-22 Thread Ned Batchelder
On 10/22/13 2:22 PM, Mark Janssen wrote: Okay. The purpose of BNF (at least as I envision it) is to produce/specify a *context-free* grammar. A lexer parses the tokens specified in the BNF into an Abstract Syntax Tree. If one can produce such a tree for any given source, the language, in

Re: Python Front-end to GCC

2013-10-22 Thread Ned Batchelder
On 10/22/13 1:50 PM, Mark Janssen wrote: So which of you is confused? I ask that in the inclusive (not exclusive OR) sense ;^) -- face says both. Could you please be less snarky? We're trying to communicate here, and it is not at all clear yet who is confused and who is not. If you are

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-23 Thread Ned Batchelder
On 10/23/13 4:16 AM, Steven D'Aprano wrote: On Tue, 22 Oct 2013 09:38:16 +0200, Lele Gaifax wrote: Roy Smith r...@panix.com writes: You missed the ever-so-special Objective C syntax: [...] The actual syntax would be [object method: arg1 withSomething: arg2 withSomethingElse: arg3] I

Re: Maintaining a backported module

2013-10-24 Thread Ned Batchelder
On 10/24/13 2:59 AM, Ben Finney wrote: Steven D'Aprano st...@pearwood.info writes: I'm now at the point where I wish to backport this module to support versions of Python back to 3.1 at least and possibly 2.7, and put it up on PyPI. Ned Batchelder has managed something at least as ambitious

Re: Will Python 3.x ever become the actual standard?

2013-10-24 Thread Ned Batchelder
On 10/24/13 9:29 AM, Damien Wyart wrote: I am starting to have doubts as to whether Python 3.x will ever be actually adopted by the Python community at large as their standard. Years have passed, and a LARGE number of Python programmers has not even bothered learning version 3.x. Why am I

Re: Maintaining a backported module

2013-10-24 Thread Ned Batchelder
On 10/24/13 7:46 AM, Steven D'Aprano wrote: On Thu, 24 Oct 2013 06:36:04 -0400, Ned Batchelder wrote: coverage.py currently runs on 2.3 through 3.4 You support all the way back to 2.3??? I don't know whether to admire your dedication, or back away slowly since you're obviously a crazy person

Re: Python Coverage: testing a program

2013-10-24 Thread Ned Batchelder
On 10/24/13 6:28 PM, Ethan Furman wrote: On 10/24/2013 01:54 PM, Ben Finney wrote: Terry Reedy tjre...@udel.edu writes: On 10/24/2013 1:46 PM, Ned Batchelder wrote: It's been fun dropping the contortions for coverage.py 4.x, though! One request: ignore if __name__ == '__main__': clauses

Re: Python Front-end to GCC

2013-10-25 Thread Ned Batchelder
On 10/25/13 7:55 AM, Mark Janssen wrote: On Thu, Oct 24, 2013 at 8:40 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 22/10/2013 18:37, Oscar Benjamin wrote: OTOH why in particular would you want to initialise them with zeros? I often initialise arrays to nan which is useful for debugging.

Re: Cookie fucking problem

2013-10-26 Thread Ned Batchelder
On 10/26/13 11:21 AM, Mark Lawrence wrote: On 26/10/2013 15:55, Nick the Gr33k wrote: Στις 26/10/2013 5:34 μμ, ο/η Mark Lawrence έγραψε: On 26/10/2013 14:27, Nick the Gr33k wrote: Buy a sex manual. No need, i can practice with your mother. An interesting combination of stupid, tight

Re: Confusion about python versions

2013-10-27 Thread Ned Batchelder
On 10/27/13 2:13 PM, Aseem Bansal wrote: Python 2.7.6 release candidate 1 and 3.3.3 release candidate 1 was released yesterday. Also Python 3.4.0 alpha 4 was released a week ago. I thought as Python 3.4.0 alpha was released 3.3 branch was done. The 3.3.3 release candidate fixes many bugs as

Re: Removing python django projects

2013-10-27 Thread Ned Batchelder
On 10/26/13 9:14 PM, Gary Roach wrote: Hi In the process of trying to learn python, django, mysql and virtualenvwrapper, I have created two projects and a mess. How can I strip everything from a Debian, Wheezy, linux system. The files are all over the place. Much of the information in this

Re: Cookie fucking problem

2013-10-28 Thread Ned Batchelder
On 10/28/13 11:07 AM, Antoon Pardon wrote: Op 28-10-13 15:38, Chris Angelico schreef: On Tue, Oct 29, 2013 at 1:33 AM, Grant Edwardsinvalid@invalid.invalid wrote: On 2013-10-28, Steven D'Apranost...@pearwood.info wrote: Chris is not baiting Nikos, he is giving him useful information that

Re: Cookie fucking problem

2013-10-28 Thread Ned Batchelder
On 10/28/13 1:53 PM, rusi wrote: On Monday, October 28, 2013 10:38:45 PM UTC+5:30, Ned Batchelder wrote: We've already seen a few new people explicitly asking, is this what usually happens on this list? and they weren't referring to the Chris-style response, they were referring

Re: How do I update a virtualenv?

2013-10-28 Thread Ned Batchelder
On 10/28/13 7:04 PM, Skip Montanaro wrote: I have a virtualenv I'm using for some Django development. Today I switched from MacPorts to HomeBrew on my Mac. I'm thus getting a different version of gcc and its libs. How do I reinstall the virtualenv? I've looked around and found a few

Re: Setting up for python django development with Debian Linux

2013-10-28 Thread Ned Batchelder
On 10/28/13 3:46 PM, Gary Roach wrote: Hi all, I have been trying to set up a python, django, mysql, virtualenvwrapper and git development project and am really confused. All of the documentation seems to ignore the apt-get installation methods used by Debian Linux and its derivatives. Does

Re: How do I update a virtualenv?

2013-10-28 Thread Ned Batchelder
On 10/28/13 7:53 PM, Skip Montanaro wrote: Virtualenvs aren't built to be moved from one Python installation to another. If you used pip to install your packages (you should), then you can activate the virtualenv, and run: $ pip freeze requirements.txt Then you can create a new virtualenv

Re: Pickle virtual machines implemented in other languages?

2013-10-29 Thread Ned Batchelder
On 10/29/13 12:12 PM, Patrick wrote: Hi Everyone I was just wondering if anyone had tried to implement a pickle virtual machine in another language? I was thinking that it might make for a nice little form of cross language IPC within a trusted environment. Pickle can execute class

Re: First day beginner to python, add to counter after nested loop

2013-10-29 Thread Ned Batchelder
On 10/29/13 4:08 PM, jonas.thornv...@gmail.com wrote: Why did Python not implement end... The end is really not necessary for the programming language it can be excluded, but it is a courtesy to the programmer and could easily be transformed to indents automaticly, that is removed before the

Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread Ned Batchelder
On 10/30/13 6:13 AM, jonas.thornv...@gmail.com wrote: Den onsdagen den 30:e oktober 2013 kl. 11:00:30 UTC+1 skrev Mark Lawrence: On 30/10/2013 09:52, jonas.thornv...@gmail.com wrote: Please stop sending us double spaced crap. -- Python is the second best programming language in the

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-30 Thread Ned Batchelder
On 10/30/13 4:49 AM, wxjmfa...@gmail.com wrote: Le mardi 29 octobre 2013 06:24:50 UTC+1, Steven D'Aprano a écrit : On Mon, 28 Oct 2013 09:23:41 -0500, Tim Chase wrote: On 2013-10-28 07:01, wxjmfa...@gmail.com wrote: Simply ignoring diactrics won't get you very far. Right. As an example,

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-30 Thread Ned Batchelder
On 10/30/13 12:08 PM, wxjmfa...@gmail.com wrote: Le mercredi 30 octobre 2013 13:44:47 UTC+1, Ned Batchelder a écrit : On 10/30/13 4:49 AM, wxjmfa...@gmail.com wrote: Le mardi 29 octobre 2013 06:24:50 UTC+1, Steven D'Aprano a écrit : On Mon, 28 Oct 2013 09:23:41 -0500, Tim Chase wrote

Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread Ned Batchelder
On 10/30/13 3:59 PM, Antoon Pardon wrote: Op 30-10-13 20:13, jonas.thornv...@gmail.com schreef: Den onsdagen den 30:e oktober 2013 kl. 20:05:07 UTC+1 skrev Mark Lawrence: On 30/10/2013 18:43, jonas.thornv...@gmail.com wrote: And ***that is not by having every stupid anal monkey sitting

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Ned Batchelder
On Saturday, November 9, 2013 8:08:25 AM UTC-5, John von Horn wrote: Hi Everyone, I'm Mr. Noobie here, I've just started easing into Python (2.7.4) and am enjoying working along to some youtube tutorials. I've done a little programming in the past. I've just got a few thoughts I'd like

Re: Conditional breakpoints in ceval.c

2013-11-09 Thread Ned Batchelder
On Friday, November 8, 2013 9:03:51 PM UTC-5, Demian Brecht wrote: Hi all, I have an .py file with a simple assignment in it: foo = 'bar' Now, I want to set a conditional breakpoint in gdb, breaking on that assignment (I'm guessing the top of the stack would be breaking on the LOAD_CONST

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Ned Batchelder
On Saturday, November 9, 2013 3:33:30 PM UTC-5, zipher wrote: Personally, I wouldn't recommend Python for web scripts. But I'm biased and am speaking from where I see the field of computer languages heading. MarkJ Tacoma, Washington I'd be interested to hear your thoughts on where the

Re: To whoever hacked into my Database

2013-11-10 Thread Ned Batchelder
On Sunday, November 10, 2013 10:28:46 AM UTC-5, Antoon Pardon wrote: Op 10-11-13 16:01, Νίκος Αλεξόπουλος schreef: Στις 10/11/2013 3:49 μμ, ο/η Antoon Pardon έγραψε: Op 10-11-13 11:32, Νίκος Αλεξόπουλος schreef: Ha, ha ha! I'm safe now!! No breaks in this time! You just can't help

Re: Code with random module faster on the vm than the vm host...

2013-11-10 Thread Ned Batchelder
On Friday, November 8, 2013 12:48:04 PM UTC-5, Pascal Bit wrote: Here's the code: from random import random from time import clock s = clock() for i in (1, 2, 3, 6, 8): M = 0 N = 10**i for n in xrange(N): r = random() if 0.5 r 0.6:

Re: 'isimmutable' and 'ImmutableNester'

2013-11-11 Thread Ned Batchelder
On Monday, November 11, 2013 3:47:45 PM UTC-5, Frank-Rene Schäfer wrote: I prepared a PEP and was wondering what your thoughts are about it: The best place to discuss proposals for changes to the Python language and library is the Python-Ideas mailing list:

Re: To whoever hacked into my Database

2013-11-11 Thread Ned Batchelder
On Monday, November 11, 2013 5:47:28 PM UTC-5, ru...@yahoo.com wrote: On 11/08/2013 11:08 AM, Chris Angelico wrote: On Sat, Nov 9, 2013 at 4:11 AM, ru...@yahoo.com wrote: On 11/08/2013 03:05 AM, Νίκος Αλεξόπουλος wrote: I never ignore advices. I read all answers as carefully as i can.

Re: To whoever hacked into my Database

2013-11-12 Thread Ned Batchelder
On Tuesday, November 12, 2013 1:31:32 AM UTC-5, ru...@yahoo.com wrote: On 11/11/2013 06:16 PM, Ned Batchelder wrote: Nikos has received a good deal of genuine advice. He has also been genuinely difficult to help. Yes. If he is too difficult to help without getting angry because he won't

  1   2   3   4   5   6   7   8   9   10   >