Re: Python for philosophers

2013-05-12 Thread Devin Jeanpierre
On Sun, May 12, 2013 at 1:17 AM, Steven D'Aprano wrote: > On Sat, 11 May 2013 21:45:12 -0700, rusi wrote: > >> I have on occasion expressed that newcomers to this list should be >> treated with more gentleness than others. And since my own joking may be >> taken amiss, let me hasten to add (to the

Re: Utility to locate errors in regular expressions

2013-05-24 Thread Devin Jeanpierre
On Fri, May 24, 2013 at 8:58 AM, Malte Forkel wrote: > As a first step, I am looking for a parser for Python regular > expressions, or a Python regex grammar to create a parser from. the sre_parse module is undocumented, but very usable. > But may be my idea is flawed? Or a similar (or better) t

Re: Python Heisenbugs? (was: Re: PyWart: The problem with "print")

2013-06-03 Thread Devin Jeanpierre
On Mon, Jun 3, 2013 at 12:34 AM, Dan Sommers wrote: > On Mon, 03 Jun 2013 13:37:27 +1000, Tim Delaney wrote: > >> With the increase in use of higher-level languages, these days >> Heisenbugs most often appear with multithreaded code that doesn't >> properly protect critical sections, but as you sa

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-06 Thread Devin Jeanpierre
On Thu, Jun 6, 2013 at 12:24 PM, Rick Johnson wrote: > In Python, if you fail to use the return statement, then Python will return > None, NOT some some value that just happens to be the last line executed in > the function -- Ruby breaks the law of least astonishment. Ruby comes from a traditi

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-06 Thread Devin Jeanpierre
Super OT divergence because I am a loser nerd: On Thu, Jun 6, 2013 at 1:27 PM, rusi wrote: > Yes, all programming communities have blind-spots. The Haskell > community's is that Haskell is safe and safe means that errors are > caught at compile-time. I don't think Haskell people believe this wi

Re: Conditional decoration

2012-06-18 Thread Devin Jeanpierre
On Mon, Jun 18, 2012 at 6:49 PM, Emile van Sebille wrote: > On 6/18/2012 3:16 PM Roy Smith said... > class myDecorator(object): >    def __init__(self, f): >        self.f = f >    def __call__(self): >        print "Entering", self.f.__name__ >        self.f() >        print "Exited", self.f.__na

Re: Why has python3 been created as a seperate language where there is still python2.7 ?

2012-06-25 Thread Devin Jeanpierre
On Mon, Jun 25, 2012 at 11:35 PM, Steven D'Aprano wrote: > There's no real difference between typing print(...) and all the other > functions in Python. Do you lament having to type len(obj) instead of > "len obj" or list(zip(a, b, c)) instead of "list zip a b c"? Surely you mean "list $ zip a b

Re: Why has python3 been created as a seperate language where there is still python2.7 ?

2012-06-27 Thread Devin Jeanpierre
On Wed, Jun 27, 2012 at 7:02 AM, Chris Angelico wrote: > Much easier to simply say no. It's also easier to cease developing Python at all. By which I mean: just because something is hard doesn't mean it shouldn't be done. Lots of things Python does are hard, but they make users' lives easier. Th

Re: code review

2012-07-01 Thread Devin Jeanpierre
On Sun, Jul 1, 2012 at 3:28 AM, Ben Finney wrote: > Chris Angelico writes: >> C, SQL, REXX, and many other languages. > > So, languages without strong typing then. In that case, I revise my > statement: I know of no programming language with strong typing that > would give a newcomer to Python th

Re: code review

2012-07-01 Thread Devin Jeanpierre
On Sun, Jul 1, 2012 at 8:41 PM, Steven D'Aprano wrote: > On Sun, 01 Jul 2012 05:18:09 -0400, Devin Jeanpierre wrote: > Sheesh guys. Don't go hunting through the most obscure corners of > mathematics for examples of computer scientists who have invented their > own maths not

Re: code review

2012-07-01 Thread Devin Jeanpierre
On Sun, Jul 1, 2012 at 9:28 PM, Steven D'Aprano wrote: > Technically, < in Python is left-associative: a < b < c first evaluates > a, not b or c. But it is left-associative under the rules of comparison > operator chaining, not arithmetic operator chaining. Left-associativity is when a < b < c is

Re: adding a simulation mode

2012-07-04 Thread Devin Jeanpierre
For what it's worth, this is the reason that Allen Short wrote Exocet. > This way, you can test your code without having to resort to sys.modules > hackery, and you can better factor your applications by separating > configuration and environment concerns from the rest of your code. See: - http:

Re: simpler increment of time values?

2012-07-04 Thread Devin Jeanpierre
On Thu, Jul 5, 2012 at 12:57 AM, Jason Friedman wrote: > I have some thoughts on a solution, but first, what is 12:45 plus 12 > hours? What is 12:45 minus 13 hours? Is there anything unusual that can happen for a notion of time that is dateless, timezone-unaware, and DST-free? I would imagine t

Re: 2 + 2 = 5

2012-07-05 Thread Devin Jeanpierre
On Thu, Jul 5, 2012 at 10:34 AM, Laszlo Nagy wrote: 5+1 > 4 4 + 1 is 5 is 4. (e.g. try 2+3 as well). -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: API design question for dbf.py

2012-07-06 Thread Devin Jeanpierre
On Fri, Jul 6, 2012 at 6:46 PM, Ethan Furman wrote: > It's checking for equality, not identity. >>> x = float('nan') >>> x in [x] True It's checking for equality OR identity. -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: why greenlet, gevent or the stackless are needed?

2012-07-07 Thread Devin Jeanpierre
On Sat, Jul 7, 2012 at 3:09 AM, self.python wrote: > it there somthing that "yield" can't do > or just it is easier or powerful? couroutine-like generators can't give up control flow unless they are the top level function handled by the coroutine controller thing. For example, we can do this:

Re: Python Interview Questions

2012-07-09 Thread Devin Jeanpierre
On Mon, Jul 9, 2012 at 5:22 PM, Peter wrote: > One of my favourite questions when interviewing - and it was 100% reliable > :-) - "what are your hobbies?" > If the answer included programming then they were hired, if not, then they > went to the "B" list. Woe is the poor college grad, who wants

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Devin Jeanpierre
On Sun, Jul 15, 2012 at 9:51 PM, Chris Angelico wrote: >> if bool(obj) and a==b: # Correct! >> if obj and a==b: # Incorrect! > > That still doesn't answer the question of what bool(obj) should do if > obj is not a bool, and why if can't do the exact same thing, since if, > by definition, is

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Devin Jeanpierre
On Mon, Jul 16, 2012 at 12:03 AM, Steven D'Aprano wrote: > On Sun, 15 Jul 2012 22:15:13 -0400, Devin Jeanpierre wrote: > >> For example, instead of "if stack:" or "if bool(stack):", we could use >> "if stack.isempty():". This line tells us ex

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Devin Jeanpierre
On Tue, Jul 17, 2012 at 2:25 AM, Steven D'Aprano wrote: > It already is part of the collection interface: it is spelled __nonzero__ > (Python 2) or __bool__ (Python 3), and like all dunder methods, it is > called automatically for you when you use the right syntax: You're still ignoring what I ac

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Devin Jeanpierre
On Tue, Jul 17, 2012 at 4:45 AM, Lipska the Kat wrote: > Is Python truly OO or is it just one way to use the language. I see some > documentation relating to classes but nothing on instantiation .. in fact > the documentation appears to say that classes are used in a static way e.g > ClassName.met

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Devin Jeanpierre
On Tue, Jul 17, 2012 at 1:07 PM, Terry Reedy wrote: > 'type-bondage' is the requirement to restrict function inputs and output to > one declared type, where the type declaration mechanisms are usually quite > limited. This is interesting, I hadn't expected that sort of definition. So Haskell is n

Re: Encapsulation, inheritance and polymorphism

2012-07-20 Thread Devin Jeanpierre
On Thu, Jul 19, 2012 at 5:01 PM, John Gordon wrote: >> Since the current evidence indicates the universe will just keep >> expanding, it's more of a "deep freeze death..." > > Heat death means *lack* of heat. But it doesn't mean low temperature! The term is agnostic as to what the temperatu

Re: can someone teach me this?

2012-07-21 Thread Devin Jeanpierre
On Fri, Jul 20, 2012 at 11:15 PM, hamilton wrote: > You are an idiot, or a scammer. Please be nice. -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Devin Jeanpierre
On Sat, Jul 21, 2012 at 2:25 PM, Chris Angelico wrote: > On Sun, Jul 22, 2012 at 4:16 AM, Rick Johnson > wrote: >> It was a nice run Google. We had good times and bad times. A few smiles and >> cries. >> >> LMBTFY > > So, what... you reckon Microsoft is going to be the paragon of > righteousness

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Devin Jeanpierre
On Sat, Jul 21, 2012 at 5:06 AM, Steven D'Aprano wrote: > So there is approximately 0.03 second difference per TWO MILLION > if...else blocks, or about 15 nanoseconds each. This is highly unlikely > to be the bottleneck in your code. Assuming the difference is real, and > not just measurement erro

Re: default repr?

2012-07-22 Thread Devin Jeanpierre
On Sun, Jul 22, 2012 at 8:29 PM, Chris Angelico wrote: > On Mon, Jul 23, 2012 at 10:24 AM, Steven D'Aprano > wrote: >> Not quite: they have to be an instance of that class. 8< > Hmm. I would have thought that methods were like all other functions: > they take their arguments and do code w

Re: A thread import problem

2012-07-22 Thread Devin Jeanpierre
On Sun, Jul 22, 2012 at 7:14 PM, Bruce Sherwood wrote: > (2) My hand is forced by Apple no longer supporting Carbon. Among > other aspects of this, Carbon can't be used with 64-bit Python, and > more and more Mac users of VPython want to use 64-bit Python. So there > has to be a version of VPython

Re: python package confusion

2012-07-23 Thread Devin Jeanpierre
On Mon, Jul 23, 2012 at 6:02 AM, Lipska the Kat wrote: > The PYTHONPATH ev is set to /home/lipska/python/dev/mods:. > in .bashrc Did you export it? Show us your .bashrc, or the relevant line in it exactly. (And make sure that it isn't defined multiple times). Also adding . to the import search p

Re: the meaning of rユ.......ï¾

2012-07-23 Thread Devin Jeanpierre
On Mon, Jul 23, 2012 at 9:52 AM, Henrik Faber wrote: > If you allow for UTF-8 identifiers you'll have to be horribly careful > what to include and what to exclude. Is the non-breaking space a valid > character for a identifier? Technically it's a different character than > the normal space, so why

Re: the meaning of rユ.......ï¾

2012-07-23 Thread Devin Jeanpierre
On Mon, Jul 23, 2012 at 10:40 AM, Henrik Faber wrote: > No, you misunderstood me. I didn't say people are going to write > gibberish. What I'm saying is that as a foreigner (who doesn't know most > of these characters), it can be hard to accurately choose which one is > the correct one. This is es

Re: Gender, Representativeness and Reputation in StackOverflow

2012-07-23 Thread Devin Jeanpierre
On Mon, Jul 23, 2012 at 9:30 PM, Steven D'Aprano wrote: >> Leaving aside the point that this is not directly related to Python, my >> opinion is that if the authors will not make past and future papers >> freely available, not even an abstract, they should not ask for valuable >> free data from fr

Re: What's wrong with this code?

2012-07-24 Thread Devin Jeanpierre
On Tue, Jul 24, 2012 at 2:23 AM, Mark Lawrence wrote: > strictly speaking Python doesn't have variables, it has names. This will > possibly start a flame war which, by the standards of this ng/ml, will be an > intense conflagration, hence the duck and cover. The two terms are nearly synonymous w

Re: python package confusion

2012-07-24 Thread Devin Jeanpierre
On Tue, Jul 24, 2012 at 1:38 AM, Steven D'Aprano wrote: > I don't know about a bad idea or not, but it is certainly redundant, > because Python automatically adds '' (equivalent to '.') to the very > start of the search path. No, it only does that if Python is reading commands from stdin, or if P

Re: the meaning of rユ.......ï¾

2012-07-24 Thread Devin Jeanpierre
On Mon, Jul 23, 2012 at 12:09 PM, Chris Angelico wrote: > It is, in many places. It's one of the few truly international > holidays. The next nearest, Pi Day, has two different dates (the > American and the European - of course, here in Australia, we celebrate > both). Here in Canada we celebrate

Re: from future import pass_function

2012-07-25 Thread Devin Jeanpierre
On Wed, Jul 25, 2012 at 4:40 AM, Ulrich Eckhardt wrote: > What do you think? retort: def foo(): None -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: from future import pass_function

2012-07-25 Thread Devin Jeanpierre
On Wed, Jul 25, 2012 at 12:05 PM, Chris Angelico wrote: > Simple way of making the iterator display its yielded result. I cannot > imagine any circumstance in which you'd want to map "pass" over > everything. But then, as Teresa said, I'm only one, and possibly I'm > wrong! True. But it might be

Re: from future import pass_function

2012-07-25 Thread Devin Jeanpierre
On Wed, Jul 25, 2012 at 2:14 PM, Ian Kelly wrote: > You can already use pass (or the equivalent) in a lambda. > > lambda: None This lacks my foolish consistency. -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: from future import pass_function

2012-07-26 Thread Devin Jeanpierre
On Thu, Jul 26, 2012 at 1:20 AM, Michael Hrivnak wrote: > If we want pass(), then why not break() and continue()? And also > def() and class()? for(), while(), if(), with(), we can make them all > callable objects! No, you actually can't. You omit the one control flow statement that could actu

Re: from future import pass_function

2012-07-26 Thread Devin Jeanpierre
On Thu, Jul 26, 2012 at 5:42 AM, Chris Angelico wrote: >> You omit the one control flow statement that could actually be turned >> into a function, raise. None of the rest could in Python (except >> class), and one of the rest couldn't in any language (def). > > Well, if/while/for could be functio

PyCon for students?

2012-07-27 Thread Devin Jeanpierre
Hey guys, I recently saw a post saying that PyCon for students' price was dropped to $100. If you are trying to attract students, why not move PyCon to take place during the summer? As far as I know, summer vs spring makes no difference to any members of the general working population (except for

Re: newbie question : gedit as an ide

2012-09-16 Thread Devin Jeanpierre
On Sun, Sep 16, 2012 at 7:52 AM, Mayuresh Kathe wrote: > new to the group, a quick hello to all. :-) > does anyone use gedit as an 'ide' for python development? > if yes, may i know the caveats against using 'idle', 'bpython', etc? bpython isn't an IDE, it's a good interactive interpreter. As f

Re: Java singletonMap in Python

2012-09-24 Thread Devin Jeanpierre
On Sun, Sep 23, 2012 at 7:14 PM, Mark Lawrence wrote: > Purely for fun I've been porting some code to Python and came across the > singletonMap[1]. I'm aware that there are loads of recipes on the web for > both singletons e.g.[2] and immutable dictionaries e.g.[3]. I was wondering > how to comb

Re: Article on the future of Python

2012-09-27 Thread Devin Jeanpierre
On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano wrote: > On Tue, 25 Sep 2012 09:15:00 +0100, Mark Lawrence wrote: > And a response: > > http://data.geek.nz/python-is-doing-just-fine Summary of that article: "Sure, you have all these legitimate concerns, but look, cake!" -- Devin -- http://mai

Re: #python archives?

2012-09-27 Thread Devin Jeanpierre
On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano wrote: > My google-foo is failing me. Is the #python chatroom on freenode archived > anywhere on the web? #python doesn't have a policy against quiet bots that log channel interaction, but AFAIK there are no up-to-date public logs. As evidence to t

Re: Article on the future of Python

2012-09-27 Thread Devin Jeanpierre
On Thu, Sep 27, 2012 at 10:25 AM, Steven D'Aprano wrote: > On Thu, 27 Sep 2012 08:11:13 -0400, Devin Jeanpierre wrote: > >> On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano >> wrote: >>> On Tue, 25 Sep 2012 09:15:00 +0100, Mark Lawrence wrote: And a >

Re: Article on the future of Python

2012-09-27 Thread Devin Jeanpierre
On Thu, Sep 27, 2012 at 12:45 PM, Mark Lawrence wrote: > The article Steven D'Aprano referred to is not a direct response to the > article I referred to, yet your words are written as if it were. May I ask > why? Or have I missed something? Post hoc ergo propter hoc :( -- Devin -- http://mail

Re: test

2012-09-27 Thread Devin Jeanpierre
On Thu, Sep 27, 2012 at 5:28 PM, ForeverYoung wrote: > Please ignore this post. > I am testing to see if I can post successfully. Is there a reason you can't wait until you have something to say / ask to see if it works? You're spamming a large number of inboxes with nothing. -- Devin -- http:/

Re: Article on the future of Python

2012-09-28 Thread Devin Jeanpierre
On Thu, Sep 27, 2012 at 8:59 PM, alex23 wrote: > On Sep 28, 2:17 am, Devin Jeanpierre wrote: >> Uncharitably, it's just a way of hiding one's head in the sand, >> ignoring any problems Python has by focusing on what problems it >> doesn't have. > > But

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Devin Jeanpierre
On Fri, Sep 28, 2012 at 9:58 PM, Mark Lawrence wrote: > What's the run time speed like? How much memory does it use? Shouldn't you > be using the regex module from pypi instead of the standard library re? > Guess who's borrowed the time machine? O(n), O(1), and I used RE2. -- Devin -- http://

Re: Should one always add super().__init__() to the __init__?

2012-09-29 Thread Devin Jeanpierre
On Sat, Sep 29, 2012 at 1:17 PM, Steven D'Aprano wrote: > No. Only add code that works and that you need. Arbitrarily adding calls > to the superclasses "just in case" may not work: > > > > py> class Spam(object): > ... def __init__(self, x): > ... self.x = x > ... supe

Re: fmap(), "inverse" of Python map() function

2012-10-05 Thread Devin Jeanpierre
On Fri, Oct 5, 2012 at 5:31 PM, Ian Kelly wrote: > On Fri, Oct 5, 2012 at 2:19 PM, vasudevram wrote: >> >> http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html > > Your fmap is a special case of reduce. So is map. def map(f, seq): return reduce( lambda rseq, ne

Re: fmap(), "inverse" of Python map() function

2012-10-05 Thread Devin Jeanpierre
On Fri, Oct 5, 2012 at 7:24 PM, Ian Kelly wrote: > I realize that. My point is that the function *feels* more like a > variant of reduce than of map. > >> If it's meant as a complaint, it's a poor one. > > It's not. Fair enough all around. Sorry for misunderstanding. -- Devin -- http://mail.py

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-25 Thread Devin Jeanpierre
On Thu, Oct 25, 2012 at 10:00 PM, Ed Morton wrote: > Because there is no solution - there IS no _RE_ that will match a string not > at the beginning of a line. Depending on what the OP meant, the following would both work: - r"^(?!mystring)" (the string does not occur at the beginning) - r"(?!^)

Re: a.index(float('nan')) fails

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 2:40 PM, Steven D'Aprano wrote: >> The problem isn't with the associativity, it's with the equality >> comparison. Replace "x == y" with "abs(x-y)> and all your statements fulfill people's expectations. > > O RYLY? > > Would you care to tell us which epsilon they should use

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 1:12 AM, Dan Loewenherz wrote: > It seems the topic of this thread has changed drastically from the original > message. > > 1) "while EXPR as VAR" in no way says that EXPR must be a boolean value. In > fact, a use case I've run into commonly in web development is popping

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 2:23 AM, Chris Angelico wrote: > while (client.spop("profile_ids") as profile_id) is not None: > print profile_id > > Why is everyone skirting around C-style assignment expressions as > though they're simultaneously anathema and the goal? :) Why should these two statem

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 6:03 PM, Cameron Simpson wrote: > Any doco would need to make it clear that no order of operation is > implied, so that this: > > x = 1 > y = (2 as x) + x > > does not have a defined answer; might be 2, might be 3. Just like any > other function call with side effects.

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 7:41 PM, Dan Loewenherz wrote: -- snip insanity -- > > But this is yucky. I'd much rather have something a bit more clear to the > reader. That's why I said I wanted a better iter, not some equality-overriding object strawman thing. I was thinking more like this: for

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 7:56 PM, Cameron Simpson wrote: > No. Separate _expressions_ are evaluated left to right. > > So this: > > f(1), f(2) > > calls "f(1)" first, then "f(2)". But this: > > f(1) + f(2) > > need not do so. Counter-documentation welcomed, but the doco you cite > does not defi

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 8:18 PM, Steven D'Aprano wrote: >> I would like a better iter(), rather than a better while loop. It is >> irritating to pass in functions that take arguments, and it is >> impossible to, say, pass in functions that should stop being iterated >> over when they return _eithe

Re: Immutability and Python

2012-10-29 Thread Devin Jeanpierre
On Mon, Oct 29, 2012 at 12:46 PM, Paul Rubin wrote: > andrea crotti writes: >> Also because how doi I make an immutable object in pure Python? > > Numbers in Python are already immutable. What you're really looking for > is a programming style where you don't bind any variable more than once. N

Re: What are the minimum requirements to get a job in?

2012-12-13 Thread Devin Jeanpierre
On Fri, Dec 14, 2012 at 1:13 AM, rusi wrote: > On Dec 14, 8:33 am, Dave Angel wrote: >> Do you know any one computer language thoroughly? Or just a little of >> many languages? > > There is a quote by Bruce Lee to the effect: > I am not afraid of the man who knows 10,000 kicks > I am afraid of t

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Devin Jeanpierre
On Wed, Jan 25, 2012 at 2:32 PM, Duncan Booth wrote: > The problem with your idea is that it breaks compatability with other non- > Python regular expression engines. Python didn't invent the (?...) syntax, > it originated with Perl. > > Try complaining to a Perl group instead. The Perl folks did

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Devin Jeanpierre
On Wed, Jan 25, 2012 at 12:16 PM, Rick Johnson wrote: > In particular i find the "extension notation" syntax to be woefully > inadequate. You should be able to infer the action of the extension > syntax intuitively, simply from looking at its signature. This is nice in theory. I see no reason to

Re: PyWart: Python regular expression syntax is not intuitive.

2012-01-25 Thread Devin Jeanpierre
On Wed, Jan 25, 2012 at 7:14 PM, Rick Johnson wrote: > It is germane in the fact that i believe PyParsing, re, and my new > regex module can co-exist in harmony. If all you're going to change is the parser, maybe it'd be easier to get things to coexist if parsers were pluggable in the re module.

Re: import fails in non-interactive interpreter

2012-01-25 Thread Devin Jeanpierre
On Wed, Jan 25, 2012 at 9:25 PM, Brian wrote: > Under what situations would a module be available to through the > interactive interpreter but not the non-interactive? I don't know if it matches your situation, but one such case is this: The interactive interpreter (and the interpreter with the

Re: Constraints -//- first release -//- Flexible abstract class based validation for attributes, functions and code blocks

2012-01-26 Thread Devin Jeanpierre
Ooh, runtime turing-complete dependent-types. :) I'm not sure if you're aware of the literature on this sort of thing. It's nice reading. A library such as this that's designed for it could be used for static checks as well. Probably deserves a better name than "constraintslib", that makes one th

Re: Constraints -//- first release -//- Flexible abstract class based validation for attributes, functions and code blocks

2012-01-26 Thread Devin Jeanpierre
On Thu, Jan 26, 2012 at 3:24 PM, Nathan Rice wrote: > One of the nice things about Haskell is that the language is designed > in a way that is conducive to > proving things about your code.  A side benefit of being able to prove > things about your code is that > in some cases you will be able to

Re: speaking at PyCon

2012-01-30 Thread Devin Jeanpierre
On Mon, Jan 30, 2012 at 6:48 PM, Roy Smith wrote: > Wow.  As somebody who has given plenty of talks, I can tell you this is an > awesome checklist (and most of it not specific to PyCon). > > Let me add one suggestion -- never, ever, ever, type a URL into a browser > connected to the internet in

Re: except clause syntax question

2012-01-30 Thread Devin Jeanpierre
On Mon, Jan 30, 2012 at 7:00 PM, Steven D'Aprano wrote: > On Mon, 30 Jan 2012 12:41:00 -0500, Charles Yeomans wrote: > >> To catch more than one exception type in an except block, one writes >> >> except (A, B, C) as e: >> >> I'm wondering why it was decided to match tuples, but not lists: >> >> e

Re: except clause syntax question

2012-01-31 Thread Devin Jeanpierre
On Tue, Jan 31, 2012 at 11:23 AM, Charles Yeomans wrote: > > On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote: > >> On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: >> >>> I don't think of a tuple as a container, and I don't think it a >>> misunderstanding on my part to think this. >>

Re: Disable use of pyc file with no matching py file

2012-02-01 Thread Devin Jeanpierre
On Tue, Jan 31, 2012 at 6:55 PM, Terry Reedy wrote: > Q. "How do I make my old model car do something (it cannot do)?" > A. "Get the free new model that has that feature added." > > Of course, there is a cost to giving up the old and familiar and learning > and adjusting to the new, even when it i

Re: copy on write

2012-02-01 Thread Devin Jeanpierre
On Wed, Feb 1, 2012 at 10:18 PM, John O'Hagan wrote: > On Fri, 13 Jan 2012 10:40:47 -0800 > Ethan Furman wrote: > >> Steven D'Aprano wrote: >> > Normally this is harmless, but there is one interesting little >> > glitch you can get: >> > >> t = ('a', [23]) >> t[1] += [42] >> > Traceback

Re: Disable use of pyc file with no matching py file

2012-02-01 Thread Devin Jeanpierre
On Wed, Feb 1, 2012 at 2:53 PM, Terry Reedy wrote: > And it bothers me that you imput such ignorance to me. You made what I think > was a bad analogy and I made a better one of the same type, though still > imperfect. I acknowledged that the transition will take years. Ah. It is a common attitude

Re: SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread Devin Jeanpierre
On Thu, Feb 2, 2012 at 11:30 AM, Paul Moore wrote: > Isn't CoffeeScript just a compiler to convert a cleaner syntax into > Javascript? If so, why would you need such a thing for Python, where > the syntax is already clean and simple? :-) Coffeescript is a more functional syntax. On that note, Py

Re: copy on write

2012-02-02 Thread Devin Jeanpierre
On Thu, Feb 2, 2012 at 11:28 AM, MRAB wrote: > Should failed assignment be raising TypeError? Is it really a type > error? A failed setitem should be a TypeError as much as a failed getitem should. Should 1[0] be a TypeError? -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: Common LISP-style closures with Python

2012-02-04 Thread Devin Jeanpierre
On Sat, Feb 4, 2012 at 5:58 AM, Arnaud Delobelle wrote: > I think what Chris asking is: what is the feature of Common-Lisp > closures that Python closures share but other languages don't? > > I think what he is implying is that there is no such feature.  Python > closures are no more "Common-Lisp-

Re: what is the difference between @property and method

2012-02-09 Thread Devin Jeanpierre
On Thu, Feb 9, 2012 at 3:50 AM, Zheng Li wrote: > class A(object): >@properymethod >def value1(self): > return 'value1' > >def value2(self): >return 'value2' > > what is the difference between value1 and value2. There is no such thing as @properymethod After you chang

re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

2012-02-13 Thread Devin Jeanpierre
Hey Pythonistas, Consider the regular expression "$*". Compilation fails with the exception, "sre_constants.error: nothing to repeat". Consider the regular expression "(?=$)*". As far as I know it is equivalent. It does not fail to compile. Why the inconsistency? What's going on here? -- Devin

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-14 Thread Devin Jeanpierre
On Tue, Feb 14, 2012 at 6:31 AM, Duncan Booth wrote: > Here's a clue: No flu viruses are treatable with antibiotics. Oh my god we're too late! Now they're ALL resistant! -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

2012-02-14 Thread Devin Jeanpierre
On Tue, Feb 14, 2012 at 8:20 AM, Vinay Sajip wrote: > $ is a meta character for regular expressions. Use '\$*', which does > compile. I mean for it to be a meta-character. I'm wondering why it's OK for to repeat a zero-width match if it is a zero-width assertion. -- Devin -- http://mail.python

Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

2012-02-14 Thread Devin Jeanpierre
On Tue, Feb 14, 2012 at 10:05 AM, Vlastimil Brom wrote: > However, is there any realistic usecase for repeated zero-width anchors? Maybe. There is a repeated zero-width anchor is used in the Python re test suite, which is what made me notice this. I assume that came from some actual use-case. (se

Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

2012-02-14 Thread Devin Jeanpierre
On Tue, Feb 14, 2012 at 1:05 PM, MRAB wrote: >> And yeah, even something as crazy as ()* works, but as soon as it >> becomes (a*)* it doesn't work. Weird. >> > I think it's a combination of warning the user about something that's > pointless, > as in the case of "$*", and producing a pattern which

Re: re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

2012-02-15 Thread Devin Jeanpierre
On Tue, Feb 14, 2012 at 9:08 PM, MRAB wrote: > There is one place in the re engine where it tries to avoid getting > stuck in an infinite loop because of a zero-width match, but the fix > inadvertently causes another bug. It's described in issue #1647489. Just read the issue. Interesting, didn't

Re: atexit.register in case of errors

2012-02-15 Thread Devin Jeanpierre
On Wed, Feb 15, 2012 at 8:33 AM, Mel Wilson wrote: > The usual way to do what you're asking is > > if __name__ == '__main__': >    main() >    goodbye() > > and write main so that it returns after it's done all the things it's > supposed to do.  If you've sprinkled `sys.exit()` all over your code,

Re: PyWart: Language missing maximum constant of numeric types!

2012-02-24 Thread Devin Jeanpierre
On Fri, Feb 24, 2012 at 9:25 AM, Neil Cerutti wrote: > The only time I've naively pined for such a thing is when > misapplying C idioms for finding a minimum value. > > Python provides an excellent min implementation to use instead. min can be a little inconvenient. As soon as anything complicate

Re: Python math is off by .000000000000045

2012-02-25 Thread Devin Jeanpierre
On Sat, Feb 25, 2012 at 2:08 PM, Tim Wintle wrote: > > It seems to me that there  are a great many real numbers that can be > > represented exactly by floating point numbers.  The number 1 is an > > example. > > > > I suppose that if you divide that count by the infinite count of all > > real numb

Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

2012-02-29 Thread Devin Jeanpierre
On Wed, Feb 29, 2012 at 6:43 AM, Chiron wrote: > Personally, I think this whole issue of precedence in a programming > language is over-rated.  It seems to me that grouping of any non-trivial > set of calculations should be done so as to remove any possible confusion > as to intent. Some language

Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

2012-03-01 Thread Devin Jeanpierre
On Thu, Mar 1, 2012 at 12:07 AM, Chiron wrote: > On Wed, 29 Feb 2012 23:10:48 -0500, Shmuel (Seymour J.) Metz wrote: > >> ROTF,LMAO! You obviously don't have a clue as to what Mathematics means. >> Free hint: it doesn't mean Arithmetic. You're as bigoted as Xah Lee, > > > Hmm... maybe, instead of

Re: The original command python line

2012-03-03 Thread Devin Jeanpierre
On Sun, Mar 4, 2012 at 1:20 AM, Damjan Georgievski wrote: > How come? > I'm using explicit relative imports, I thought they were the new thing? Explicit relative imports are fine. Implicit relative imports can create multiple module objects for the same source file, which breaks things like excep

Re: Porting Python to an embedded system

2012-03-04 Thread Devin Jeanpierre
On Sun, Mar 4, 2012 at 5:58 AM, Justin Drake wrote: > I am working with an ARM Cortex M3 on which I need to port Python > (without operating system). What would be my best approach? I just > need the core Python and basic I/O. How much time are you willing to budget to this? Porting something to

Re: Python is readable

2012-03-15 Thread Devin Jeanpierre
On Wed, Mar 14, 2012 at 8:27 PM, Chris Angelico wrote: > On Thu, Mar 15, 2012 at 10:54 AM, Arnaud Delobelle wrote: >> I don't know this book and there may be a pedagogical reason for the >> implementation you quote, but pairwise_sum is probably better >> implemented in Python 3.X as: >> >> def pa

Re: ANN: cmd2, an extenstion of cmd that parses its argument line

2012-03-19 Thread Devin Jeanpierre
There already is a module named cmd2: http://pypi.python.org/pypi/cmd2 -- Devin On Mon, Mar 19, 2012 at 1:11 AM, wrote: > Dear all, > > I would like to announce the first public release of cmd2, an extension of > the standard library's cmd with argument parsing, here: > https://github.com/anntz

Re: Documentation, assignment in expression.

2012-03-26 Thread Devin Jeanpierre
On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm wrote: > On 3/25/2012 15:48, Tim Chase wrote: >> >> The old curmudgeon in me likes the Pascal method of using "=" for >> equality-testing, and ":=" for assignment which feels a little closer to >> mathematical use of "=". > > > Unfortunately, ":=" means "is

Re: RE: Advise of programming one of my first programs

2012-03-27 Thread Devin Jeanpierre
On Tue, Mar 27, 2012 at 5:59 PM, Evan Driscoll wrote: >> The use of eval is dangerous if you are not *completely* sure what is >> being passed in. Try using pickle instead: >> http://docs.python.org/release/2.5.2/lib/pickle-example.html > > > Um, at least by my understanding, the use of Pickle is

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Devin Jeanpierre
On Thu, Mar 29, 2012 at 10:03 AM, Chris Angelico wrote: > You can't merge all of them without making a language that's > suboptimal at most of those tasks - probably, one that's woeful at all > of them. I mention SQL because, even if you were to unify all > programming languages, you'd still need

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Devin Jeanpierre
Agreed with your entire first chunk 100%. Woohoo! High five. :) On Thu, Mar 29, 2012 at 1:48 PM, Nathan Rice wrote: > transformations on lists of data are natural in Lisp, but graph > transformations are not, making some things awkward. Eh, earlier you make some argument towards lisp being a uni

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Devin Jeanpierre
On Thu, Mar 29, 2012 at 4:33 PM, Chris Angelico wrote: > Of course it's POSSIBLE. You can write everything in Ook if you want > to. But any attempt to merge all programming languages into one will > either: In that particular quote, I was saying that the reason that you claimed we can't merge lan

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Devin Jeanpierre
On Thu, Mar 29, 2012 at 3:50 PM, Nathan Rice wrote: > Well, a lisp-like language.  I would also argue that if you are using > macros to do anything, the thing you are trying to do should classify > as "not natural in lisp" :) You would run into disagreement. Some people feel that the lisp philoso

  1   2   3   4   >