Re: Don't feed the troll...

2013-06-19 Thread Chris Angelico
On Wed, Jun 19, 2013 at 5:27 PM, Steven D'Aprano wrote: > On Wed, 19 Jun 2013 17:07:28 +1000, Chris Angelico wrote: > >> On the contrary, stereotyping is "You are-a , therefore you >> will behave in ". > > I don't think that's how stereotypes usu

Re: A certainl part of an if() structure never gets executed.

2013-06-19 Thread Chris Angelico
On Wed, Jun 19, 2013 at 6:06 PM, Dave Angel wrote: > On 06/19/2013 03:14 AM, Chris Angelico wrote: >> >> On Wed, Jun 19, 2013 at 3:42 PM, Dave Angel wrote: >>> >>> Names are *one of* the ways we specify which objects are to be used. (We >>> can >&

Re: A certainl part of an if() structure never gets executed.

2013-06-19 Thread Chris Angelico
On Wed, Jun 19, 2013 at 6:55 PM, Steven D'Aprano wrote: > On Wed, 19 Jun 2013 18:21:40 +1000, Chris Angelico wrote: > >> You can't reference an object without >> somewhere having either a name or a literal to start it off. > > True, but not necessarily a name bo

Re: A Beginner's Doubt

2013-06-19 Thread Chris Angelico
On Wed, Jun 19, 2013 at 11:58 PM, wrote: > My goal is to learn and program it by myself, as good as the time allows me. > That said, what I seek here is advice from people who definitively have more > experience than me on topics like: is it possible to develop this kind of > program in such a

Re: Idea for key parameter in all() builting, would it be feasible?

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 2:14 AM, wrote: > And the following, although the same thing really as all(xrange(10**9)), is > not as instant and will take even longer than the above. > all(map(lambda x: bool(x), xrange(10**9))) > > However if all by some chance (I don't know how this stuff works

Re: Idea for key parameter in all() builting, would it be feasible?

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 2:32 AM, wrote: >>All you need is the iterator version of map(). In Python 3, that's the >>normal map(); in Python 2, use this: > > from itertools import imap > all(imap(lambda x: bool(x), xrange(10**9))) >>False > >>It's roughly instant, like you would expect. > >

Re: A Beginner's Doubt

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 2:53 AM, Joshua Landau wrote: > Now, as I'm probably the most new programmer here I'll point out that > I don't agree with Chris when he says that: > >> One way or >> another, you will probably spend the next week writing code you thr

Re: Problem with the "for" loop syntax

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 11:02 AM, Arturo B wrote: > Fixed, the problem was in > HANGMANPICS > > I didn't open the brackets. > > Thank you guys :) General debugging tip: Syntax errors are sometimes discovered quite some way below the actual cause. The easiest way to figure out what's the real caus

Re: About GIL Questions!

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 2:13 PM, Thanatos xiao wrote: > Hey everyone! > Recently I see the python source code, but i still not understand about gil. > first, why single core quicker multi-core ? who can explan this in bottom > layery ? > second, what the different between the mult-core and the si

Re: A Beginner's Doubt

2013-06-20 Thread Chris Angelico
On Thu, Jun 20, 2013 at 1:31 AM, Rick Johnson wrote: > On Wednesday, June 19, 2013 8:58:19 AM UTC-5, augus...@gmail.com wrote: >> This is my first post in this group and the reason why I >> came across here is that, despite my complete lack of >> knowledge in the programming area, I received an or

Re: A few questiosn about encoding

2013-06-20 Thread Chris Angelico
On Fri, Jun 21, 2013 at 1:12 AM, Rick Johnson wrote: > On Thursday, June 20, 2013 9:04:50 AM UTC-5, Andrew Berg wrote: >> On 2013.06.20 08:40, Rick Johnson wrote: > >> > then what is the purpose of a Unicode Braille character set? >> Two dimensional characters can be made into 3 dimensional sh

Re: A few questiosn about encoding

2013-06-20 Thread Chris Angelico
On Thu, Jun 20, 2013 at 11:40 PM, Rick Johnson wrote: > Your generalization is analogous to explaining web browsers > as: "software that allows a user to view web pages in the > range www.*" Do you think someone could implement a web > browser from such limited specification? (if that was all > th

Re: Default Value

2013-06-20 Thread Chris Angelico
On Fri, Jun 21, 2013 at 12:49 AM, Rick Johnson wrote: > When the subroutine is completed, all inputs and local > variables are expected to be destroyed. If the programmer > wants a return value, he need simply ask. Data persistence > is not a function of subroutines! Funny, C violates your descri

Re: Idea for key parameter in all() builting, would it be feasible?

2013-06-20 Thread Chris Angelico
On Fri, Jun 21, 2013 at 12:49 AM, Russel Walker wrote: > On Thursday, June 20, 2013 12:45:27 PM UTC+2, Antoon Pardon wrote: >> Op 19-06-13 18:14, russ.po...@gmail.com schreef: >> >> > >> >> all(map(lambda x: bool(x), xrange(10**9))) >> >> Since you already have your answer, I just like to get

Re: Problem with the "for" loop syntax

2013-06-20 Thread Chris Angelico
On Thu, Jun 20, 2013 at 11:55 PM, Neil Cerutti wrote: > On 2013-06-20, Joshua Landau wrote: >> On 20 June 2013 04:11, Cameron Simpson wrote: >>> Also, opening-and-not-closing a set of brackets is almost the >>> only way in Python to make this kind of error (syntax at one >>> line, actual mistake

Re: A few questiosn about encoding

2013-06-20 Thread Chris Angelico
On Fri, Jun 21, 2013 at 2:27 AM, wrote: > And all these coding schemes have something in common, > they work all with a unique set of code points, more > precisely a unique set of encoded code points (not > the set of implemented code points (byte)). > > Just what the flexible string representati

Re: A few questiosn about encoding

2013-06-20 Thread Chris Angelico
On Fri, Jun 21, 2013 at 3:17 AM, MRAB wrote: > On 20/06/2013 17:37, Chris Angelico wrote: >> >> On Fri, Jun 21, 2013 at 2:27 AM, wrote: >>> >>> And all these coding schemes have something in common, >>> they work all with a unique set of code points,

Re: Default Value

2013-06-20 Thread Chris Angelico
On Fri, Jun 21, 2013 at 3:12 AM, rusi wrote: > Python (and all the other 'cool' languages) dont have gotchas because > someone malevolently put them there. > In most cases, the problem is seen too late and the cost of changing > entrenched code too great. > Or the problem is clear, the solution is

Re: Default Value

2013-06-21 Thread Chris Angelico
On Fri, Jun 21, 2013 at 1:16 PM, Rick Johnson wrote: > On Thursday, June 20, 2013 7:57:28 PM UTC-5, Steven D'Aprano wrote: >> Python functions are >> created *once*, when defined. The cost of building the >> function -- compiling the source code to byte code, >> assembling the pieces into a functi

Re: Default Value

2013-06-21 Thread Chris Angelico
On Sat, Jun 22, 2013 at 4:26 AM, Rick Johnson wrote: > I could cast a "virtual net" over my poor lemmings before > they jump off the cliff by throwing an exception: > > Traceback (most recent screw-up last): >Line BLAH in SCRIPT > def f(x = [None, b, [a, [4]]]): > ArgumentError: No mut

Re: Default Value

2013-06-21 Thread Chris Angelico
On Sat, Jun 22, 2013 at 11:15 AM, Rick Johnson wrote: > # Literal > py> d = {[1]:2} > Traceback (most recent call last): > File "", line 1, in > d = {[1]:2} > TypeError: unhashable type: 'list' > # Symbol > py> lst = [1] > py> d = {lst:2} > Traceback

Re: Default Value

2013-06-21 Thread Chris Angelico
On Sat, Jun 22, 2013 at 11:31 AM, Steven D'Aprano wrote: > Thinking about this, I think that the only safe thing to do in Rickython > 4000 is to prohibit putting mutable objects inside tuples. Putting a list > or a dict inside a tuple is just a bug waiting to happen! I think you're onto something

Re: Default Value

2013-06-21 Thread Chris Angelico
On Sat, Jun 22, 2013 at 11:27 AM, Ian Kelly wrote: > On Fri, Jun 21, 2013 at 7:15 PM, Steven D'Aprano > wrote: >> On Fri, 21 Jun 2013 23:49:51 +0100, MRAB wrote: >> >>> On 21/06/2013 21:44, Rick Johnson wrote: >> [...] Which in Python would be the "MutableArgumentWarning". *school-

Re: Default Value

2013-06-21 Thread Chris Angelico
On Sat, Jun 22, 2013 at 12:01 PM, Rotwang wrote: class hashablelist(list): > ... def __hash__(self): > ... return hash(tuple(self)) There's a vulnerability in that definition: >>> a=hashablelist((1,[],3)) >>> a [1, [], 3] >>> {a:1} Traceback (most recent call last): File "", l

Re: Simple I/O problem can't get solved

2013-06-22 Thread Chris Angelico
On Fri, Jun 21, 2013 at 7:15 PM, Peter Otten <__pete...@web.de> wrote: > Combining these modifications: > > for line in f: > word = line.strip() > if is_palindrome.is_palindrome(word): > print word Minor quibble: I wouldn't use the name 'word' here, unless you're expecting the file

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 1:24 AM, Rick Johnson wrote: > _fmtstr = "Item wrote to MongoDB database {0}, {1}" > msg = _fmtstr.format(_arg1, _arg2) As a general rule, I don't like separating format strings and their arguments. That's one of the more annoying costs of i18n. Keep them in a single e

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 9:28 AM, Dave Angel wrote: > On 06/22/2013 07:12 PM, Chris Angelico wrote: >> >> On Sun, Jun 23, 2013 at 1:24 AM, Rick Johnson >> wrote: >>> >>>_fmtstr = "Item wrote to MongoDB database {0}, {1}" >>>msg =

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 9:56 AM, Dave Angel wrote: > On 06/22/2013 07:37 PM, Chris Angelico wrote: >>> On the contrary, i18n should be done with config files. The format >>> string > > > **as specified in the physical program** > > >>> is the key to t

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 10:48 AM, Rick Johnson wrote: > On Saturday, June 22, 2013 6:12:50 PM UTC-5, Chris Angelico wrote: >> As a general rule, I don't like separating format strings and their >> arguments. > > Huh? Format strings don't take arguments because Pyth

Re: newbie question

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 12:39 PM, wrote: > Writing simple program asking a question with the answer being "yes"...how do > I allow the correct answer if user types Yes, yes, or YES? The thing you're looking for is case-folding, or possibly lower-casing. You should be able to find what you want

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 1:22 PM, Steven D'Aprano wrote: > On Sat, 22 Jun 2013 23:12:49 -0400, Roy Smith wrote: > >> In article <51c66455$0$2$c3e8da3$54964...@news.astraweb.com>, >> Steven D'Aprano wrote: >> >>> http://infiniteundo.com/post/25326999628/falsehoods-programmers- > believe-about-

Re: n00b question on spacing

2013-06-22 Thread Chris Angelico
On Sun, Jun 23, 2013 at 12:58 PM, Steven D'Aprano wrote: > On Sun, 23 Jun 2013 02:20:56 +0100, MRAB wrote: > >> One vs not-one isn't good enough. Some languages use the singular with >> any numbers ending in '1'. Some languages have singular, dual, and >> plural. Etc. It's surprising how inventive

Re: Is this PEP-able? fwhile

2013-06-24 Thread Chris Angelico
On Tue, Jun 25, 2013 at 5:52 AM, wrote: > (NOTE: Many people are being taught to avoid 'break' and 'continue' at all > costs... Why? Why on earth should break/continue be avoided? I think that's the solution: teach people that loops are there to be interrupted and manipulated. And then it's a s

Re: Is this PEP-able? fwhile

2013-06-24 Thread Chris Angelico
On Tue, Jun 25, 2013 at 8:30 AM, Tim Chase wrote: > On 2013-06-25 07:38, Chris Angelico wrote: >> Python has no issues with breaking out of loops, and even has >> syntax specifically to complement it (the 'else:' clause). Use >> break/continue when appropriat

Re: Is this PEP-able? fwhile

2013-06-24 Thread Chris Angelico
On Tue, Jun 25, 2013 at 8:43 AM, Ian Kelly wrote: > On Mon, Jun 24, 2013 at 4:41 PM, Fábio Santos > wrote: >> >> On 24 Jun 2013 22:29, "Ian Kelly" wrote: >>> >>> On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos >>> wrote: >>> > This can probably be best achieved by adding to the existing for loop

Re: Is this PEP-able? fwhile

2013-06-24 Thread Chris Angelico
On Tue, Jun 25, 2013 at 12:01 PM, rusi wrote: > On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote: >> On Tue, Jun 25, 2013 at 5:52 AM, <> wrote: >> >> > (NOTE: Many people are being taught to avoid 'break' and 'continue' a

Re: Looking for a name for a deployment framework...

2013-06-24 Thread Chris Rebert
alt is likewise written in Python. (Your statement seemed to imply otherwise.) Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this PEP-able? fwhile

2013-06-25 Thread Chris Angelico
On Tue, Jun 25, 2013 at 2:20 PM, Benjamin Kaplan wrote: > On Mon, Jun 24, 2013 at 8:54 PM, Chris Angelico wrote: >> On Tue, Jun 25, 2013 at 12:01 PM, rusi wrote: >>> On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote: >>>> On Tue, Jun

Re: n00b question on spacing

2013-06-25 Thread Chris Angelico
On Tue, Jun 25, 2013 at 9:19 PM, Robert Kern wrote: > There is quite a bit of Python's lexical analysis that is specified in > places other than the formal notation. That does not mean it is undefined. > It is well defined in the lexer code and the documentation. You suggest that > a "rule probabl

Re: n00b question on spacing

2013-06-25 Thread Chris Angelico
On Tue, Jun 25, 2013 at 9:59 PM, Robert Kern wrote: > On 2013-06-25 12:48, Chris Angelico wrote: >> >> On Tue, Jun 25, 2013 at 9:19 PM, Robert Kern >> wrote: >>> >>> There is quite a bit of Python's lexical analysis that is specified in >>>

Re: Inconsistency on getting arguments

2013-06-25 Thread Chris Angelico
On Wed, Jun 26, 2013 at 12:17 AM, Dave Angel wrote: > On 06/25/2013 09:55 AM, Peter Otten wrote: >> >> Marco Perniciaro wrote: >> >>> Hi, >>> I've been working with Python for a long time. >>> Yet, I came across an issue which I cannot explain. >>> >>> Recently I have a new PC (Windows 7). >>> Pre

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Chris Angelico
On Wed, Jun 26, 2013 at 3:44 AM, Ian Kelly wrote: > On Sun, Jun 23, 2013 at 1:33 PM, Antoon Pardon > wrote: >> Op 23-06-13 18:35, Steven D'Aprano schreef: >>> Please don't. This is false economy. The time you save will be trivial, >>> the overhead of inheritance is not going to be the bottleneck

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Chris Angelico
On Wed, Jun 26, 2013 at 8:25 AM, Ian Kelly wrote: > On Tue, Jun 25, 2013 at 4:17 PM, Chris Angelico wrote: >> The main problem is getting to the top/end of the call chain. Classic >> example is with __init__, but the same problem can also happen with >> other calls. Jus

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Chris Angelico
On Wed, Jun 26, 2013 at 8:27 AM, Mark Janssen wrote: > Here's how it *should* be made: the most superest, most badassed > object should take care of its children. New instances should > automatically call up the super chain (and not leave it up to the > subclasses), so that the parent classes ca

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Chris Angelico
On Wed, Jun 26, 2013 at 8:38 AM, Mark Janssen wrote: > Combining integers with sets I can make > a Rational class and have infinite-precision arithmetic, for example. Combining two integers lets you make a Rational. Python integers are already infinite-precision. Or are you actually talking of us

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Chris Angelico
On Wed, Jun 26, 2013 at 9:00 AM, Mark Janssen wrote: >> 1) That breaks the Liskov Substitution Principle. A subclass of list >> ought to fulfill the contracts of a basic list. > > We don't need LSP. I write about this on the WIkiWikiWeb where there > were many arguments documented and many hairs

Re: What is the semantics meaning of 'object'?

2013-06-26 Thread Chris Angelico
On Wed, Jun 26, 2013 at 11:07 AM, Mark Janssen wrote: Combining two integers lets you make a Rational. >>> >>> Ah, but what is going to group them together? You see you've already >>> gotten seduced. Python already uses a set to group them together -- >>> it's called a Dict and it's in ever

Re: Is this PEP-able? fwhile

2013-06-26 Thread Chris Angelico
On Wed, Jun 26, 2013 at 10:47 AM, Dennis Lee Bieber wrote: > On Tue, 25 Jun 2013 17:20:43 +1000, Neil Hodgson > declaimed the following: > >>jim...@aol.com: >> >>> Syntax: >>> fwhile X in ListY and conditionZ: >> >>There is precedent in Algol 68: >> >>for i from 0 to n while safe(i) do .. od

Re: What is the semantics meaning of 'object'?

2013-06-26 Thread Chris Angelico
On Wed, Jun 26, 2013 at 9:19 AM, Mark Janssen wrote: > Did you ever hear of the Glass Bead Game? Yeah, it's Magic: The Gathering and its counters. http://www.wizards.com/magic/magazine/Article.aspx?x=mtgcom/daily/mr195 :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: What is the semantics meaning of 'object'?

2013-06-26 Thread Chris Angelico
On Thu, Jun 27, 2013 at 1:16 AM, Rotwang wrote: > On 25/06/2013 23:57, Chris Angelico wrote: >> >> On Wed, Jun 26, 2013 at 8:38 AM, Mark Janssen >> wrote: >>> >>> Combining integers with sets I can make >>> a Rational class and have infinite-preci

Re: Limit Lines of Output

2013-06-26 Thread Chris Angelico
On Thu, Jun 27, 2013 at 1:24 AM, Joshua Landau wrote: > On 25 June 2013 22:48, Gene Heskett wrote: >> On Tuesday 25 June 2013 17:47:22 Joshua Landau did opine: > > I did not. Beg pardon? It looked like an accurate citation to me - you quoted the OP's second post, then added the line beginning "S

Re: looking for a linguistical/semiotic quote

2013-06-27 Thread Chris Angelico
On Thu, Jun 27, 2013 at 9:14 PM, rusi wrote: > I am looking for a quote > (from Whorf/Sapir/Wittgenstein/Humboldt dunno... that 'school') > > It goes something like this: > > What characterizes a language is not what we can say in it but what we must > -- like it or not -- say. I think you may b

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Chris Angelico
On Fri, Jun 28, 2013 at 8:19 AM, Grant Edwards wrote: > On 2013-06-27, Jason Swails wrote: > >> He _is_ using cmd. He's subclassed cmd.Cmd and trying to use >> argparse to handle argument parsing in the Cmd.precmd method to >> preprocess the user input. > > [...] > >> Having subclassed cmd.Cmd m

Re: indexerror: list index out of range??

2013-06-28 Thread Chris Angelico
mework assignments. Honesty won't hurt you (since we can all tell anyway), and it means we know you're trying to learn, not to cheat. And yes, there are a discouraging number of people who do try to cheat, so setting yourself apart from them is well worth it. :) Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a name for a deployment framework...

2013-06-29 Thread Chris Angelico
On Wed, Jun 26, 2013 at 9:40 PM, Roy Smith wrote: > For further hack value, require that all pull requests to the project be > done entirely in iambic pentameter: > > for host in hosts: >deploy(the_code).remote() For further hack delight, require a patch Submitted for this code restrict itsel

Re: Closures in leu of pointers?

2013-06-29 Thread Chris Angelico
On Sun, Jun 30, 2013 at 2:32 PM, Terry Reedy wrote: > On 6/29/2013 5:21 PM, Ian Kelly wrote: >> >> On Sat, Jun 29, 2013 at 2:53 PM, Terry Reedy wrote: >>> >>> # The alternative for either program or people is a 1-pass + backtracking >>> process where all understandings are kept provisional until

Re: Closures in leu of pointers?

2013-06-29 Thread Chris Angelico
On Sun, Jun 30, 2013 at 3:46 PM, Ian Kelly wrote: > On a related note, I think that generator functions should in some way > be explicitly marked as such in the declaration, rather than needing > to scan the entire function body for a yield statement to determine > whether it's a generator or not.

Stupid ways to spell simple code

2013-06-29 Thread Chris Angelico
There's a bit of a discussion on python-ideas that includes a function that raises StopIteration. It inspired me to do something stupid, just to see how easily I could do it... On Sun, Jun 30, 2013 at 3:45 PM, Nick Coghlan wrote: Re: [Python-ideas] "Iteration stopping" syntax def stop(): > .

Re: Stupid ways to spell simple code

2013-06-30 Thread Chris Angelico
On Mon, Jul 1, 2013 at 1:08 AM, Joshua Landau wrote: > On 30 June 2013 15:58, Rick Johnson wrote: >> Chris, i'm sorry, but your challenge is decades too late. If you seek >> amusement you need look no further than the Python stdlib. If you REALLY >> want to be a

Re: password protect file

2013-06-30 Thread Chris Angelico
On Mon, Jul 1, 2013 at 8:17 AM, wrote: > > i just want something simple that basicly asks for a password and then > replies to u if you are wrong nothing hevay just for learning exsperience > -- Then your task is pretty easy. Look up these things in the Python docs: * input (or raw_input if yo

Re: Stupid ways to spell simple code

2013-07-01 Thread Chris Angelico
On Mon, Jul 1, 2013 at 10:59 PM, Neil Cerutti wrote: > On 2013-06-30, Chris Angelico wrote: >> So, here's a challenge: Come up with something really simple, >> and write an insanely complicated - yet perfectly valid - way >> to achieve the same thing. Bonus p

Re: Stupid ways to spell simple code

2013-07-02 Thread Chris Angelico
On Tue, Jul 2, 2013 at 2:30 AM, Joshua Landau wrote: > Beautiful, see? Truly a work of art! I am awed. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't feed the troll...

2013-07-02 Thread Chris Angelico
On Tue, Jul 2, 2013 at 12:02 AM, wrote: > ... engaging in flame wars with trolls simply produces more > flames, hostility begets hostility ... It does. Please can these threads die quietly now? ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: python adds an extra half space when reading from a string or list

2013-07-02 Thread Chris Angelico
On Tue, Jul 2, 2013 at 5:55 PM, Antoon Pardon wrote: > Fine you give me an opportunity to point out the problems in your thinking > without giving yourself the opportunity to respond. I can live with that. And by continuing to rant, you just make other people sick of reading your posts. Please, d

Re: how to calculate reputation

2013-07-03 Thread Chris Angelico
On Wed, Jul 3, 2013 at 10:18 AM, Steven D'Aprano wrote: > It's very easy to come up with lousy algorithms for calculating > reputation, much harder to come up with good algorithms. Yes. Reminder: Don't just average your users' ratings. http://xkcd.com/937/ In fact, mere upvotes and downvotes mig

Re: DOS or not? [was Re: How to tell Script to use pythonw.exe ?]

2013-07-03 Thread Chris Angelico
On Wed, Jul 3, 2013 at 5:34 PM, Tim Golden wrote: > On 03/07/2013 02:34, Andrew Berg wrote: >> DOS is long >> dead, and is much, much different under the hood from the console >> subsystem in modern versions of Windows. > > > While this is clearly true, it's by no means unusual for people to refer

Re: Bug reports [was Re: Python list code of conduct]

2013-07-03 Thread Chris Angelico
On Wed, Jul 3, 2013 at 10:52 AM, Steven D'Aprano wrote: > A popular language like Python has been around for about 20 years. It is > in daily use by tens of thousands of people around the world. What are > the chances that you, in your first week of using Python, just happened > to stumble across

Re: python adds an extra half space when reading from a string or list

2013-07-03 Thread Chris Angelico
On Wed, Jul 3, 2013 at 7:21 PM, Antoon Pardon wrote: > Op 03-07-13 02:30, ru...@yahoo.com schreef: >> If your going to point out something negative about someone >> then do so politely. Ask yourself if you were pointing out >> incompetence to your boss (or anyone else where impoliteness >> could

Re: DOS or not? [was Re: How to tell Script to use pythonw.exe ?]

2013-07-03 Thread Chris Angelico
On Wed, Jul 3, 2013 at 10:50 PM, Tim Chase wrote: > On 2013-07-03 09:51, Tim Golden wrote: >> We can certainly agree on this. I can't count the number of emails >> I've deleted as too hot-headed in response to dismissive comments >> about Windows as a platform. Some of them, at least, appear to be

Re: [SPOILERS] Python easter eggs

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 12:03 AM, Ian Foote wrote: > import antigravity Having checked its docstring, I am now left wondering what I can do with the Munroe geohashing algorithm and if there's any way I could use that at work somehow. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is CPython 2.5 a dependency for Jython 2.5?

2013-07-03 Thread Chris Angelico
On Wed, Jul 3, 2013 at 10:55 PM, rusi wrote: > On Wednesday, July 3, 2013 5:52:12 PM UTC+5:30, Steven D'Aprano wrote: >> I'm running a box with Debian squeeze, and I just ran: >> sudo aptitude install jython >> which ended up installing Python 2.5: > > BTW trying to install jython out here gave me

Re: Bug reports [was Re: Python list code of conduct]

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 12:03 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> Of course, it's possible for there to be dark corners. But if you're >> working with those, you know it full well. The dark corners of Python >> might be in some

Re: python adds an extra half space when reading from a string or list

2013-07-03 Thread Chris Angelico
about a random boss, I wouldn't > bet any money on it. On Wed, Jul 3, 2013 at 10:31 PM, rusi wrote: > I am guessing Chris (do correct me if wrong) that you are making a > theoretical/hypothetical statement. I guess your boss is not an asshole in > matters of things like passwo

Re: python adds an extra half space when reading from a string or list

2013-07-03 Thread Chris Angelico
On Wed, Jul 3, 2013 at 8:00 PM, Νίκος wrote: > Στις 3/7/2013 12:45 μμ, ο/η Chris Angelico έγραψε: > >>> ] You have betrayed the trust of all your customers. >>> >>> Which seemed to be accepted on this list without a problem. >> >> >> If my boss

Re: Bug reports [was Re: Python list code of conduct]

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 12:23 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Thu, Jul 4, 2013 at 12:03 AM, Roy Smith wrote: >> > In article , >> > Chris Angelico wrote: >> > >> >> Of course, it's possible for

Re: python adds an extra half space when reading from a string or list

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 1:36 AM, Νίκος wrote: > I will *not* give away my root pass to anyone for any reason but i will open > a norla user account for someone if i feel like trusting him and copy my > python file to his homr dir to take alook from within. Well... well... baby steps. That's someth

Re: python adds an extra half space when reading from a string or list

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 2:47 AM, Νίκος wrote: > Στις 3/7/2013 6:44 μμ, ο/η Chris Angelico έγραψε: >> >> On Thu, Jul 4, 2013 at 1:36 AM, � wrote: >>> >>> I will *not* give away my root pass to anyone for any reason but i will >>> open >>&

Re: python adds an extra half space when reading from a string or list

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 3:07 AM, Νίκος wrote: > Στις 3/7/2013 7:53 μμ, ο/η Chris Angelico έγραψε: >> What are the file permissions (file modes) on all your home >> directories? Do you know what they mean? > > > root@nikos [~]# ls -al /home > total 88 > drwx--x--x 22

Re: Default scope of variables

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 1:27 PM, Steven D'Aprano wrote: > With respect to the Huffman coding of declarations, Javascript gets it > backwards. Locals ought to be more common, but they require more typing. > Locals are safer, better, more desirable than globals, and so it should > be easier to use lo

Re: Why this code works in python3, but not python 2:

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 1:52 PM, Maciej Dziardziel wrote: > Out of curiosity: Does anyone know why the code below is valid in python3, > but not python2: > > def foo(*args, bar=1, **kwargs): > pass Keyword-only arguments are (IIRC) a Py3-only feature. There are lots of features that don't wor

Re: Default scope of variables

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 2:30 PM, Joshua Landau wrote: > That said, I'm not too convinced. Personally, the proper way to do > what you are talking about is creating a new closure. Like: > > for i in range(100): > with new_scope(): > for i in range(100): > func(i) > func(i

Re: Default scope of variables

2013-07-03 Thread Chris Angelico
On Thu, Jul 4, 2013 at 3:32 PM, Steven D'Aprano wrote: > Accidental shadowing can be a problem, but I've never heard of anyone > saying that they were *forced* to shadow a global they needed access to. > Just pick a different name. Here's one example of shadowing that comes from a C++ project at

Re: Important features for editors

2013-07-04 Thread Chris Angelico
On Thu, Jul 4, 2013 at 7:14 PM, Νίκος wrote: > If you guys want to use it i can send you a patch for it. > I know its illegal thing to say but it will help you use it without buying > it. Considering that there are plenty of free text editors around, I don't see any reason to steal one. If you wa

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

2013-07-04 Thread Chris Angelico
On Thu, Jul 4, 2013 at 8:38 PM, Νίκος wrote: > So you are also suggesting that what gesthostbyaddr() returns is not utf-8 > encoded too? > > What character is 0xb6 anyways? It isn't. It's a byte. Bytes are not characters. http://www.joelonsoftware.com/articles/Unicode.html ChrisA -- http://mai

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

2013-07-04 Thread Chris Angelico
On Thu, Jul 4, 2013 at 9:52 PM, MRAB wrote: > On 04/07/2013 12:29, Νίκος wrote: >> >> Στις 4/7/2013 1:54 μμ, ο/η Chris Angelico έγραψε: >>> >>> On Thu, Jul 4, 2013 at 8:38 PM, � wrote: >>>> >>>> So you are also suggesting that what ge

Re: First attempt at a Python prog (Chess)

2013-07-04 Thread Chris Hinsley
On 2013-02-13 23:25:09 +, Chris Hinsley said: New to Python, which I really like BTW. First serious prog. Hope you like it. I know it needs a 'can't move if your King would be put into check' test. But the weighted value of the King piece does a surprising emergent job

Re: Default scope of variables

2013-07-04 Thread Chris Angelico
On Fri, Jul 5, 2013 at 2:38 AM, Steven D'Aprano wrote: > On Thu, 04 Jul 2013 15:47:57 +1000, Chris Angelico wrote: >> Here's one example of shadowing that comes from a C++ project at work. I >> have a class that represents a database transaction (constructing it >&g

Re: Important features for editors

2013-07-04 Thread Chris Angelico
On Fri, Jul 5, 2013 at 4:52 AM, Ferrous Cranus wrote: > Στις 4/7/2013 9:40 μμ, ο/η Grant Edwards έγραψε: > >> On 2013-07-04, ?? wrote: >>> >>> >>> If you guys want to use it i can send you a patch for it. I know its >>> illegal thing to say but it will help you use it without buying it. >

Re: Illegal suggestions on python list

2013-07-04 Thread Chris Angelico
On Fri, Jul 5, 2013 at 3:10 AM, Rustom Mody wrote: > On Thu, Jul 4, 2013 at 9:16 PM, Steven D'Aprano > wrote: >> >> Which crime is that? Presumably you mean an actual criminal felony, not a >> mere civil offence. Under which jurisdiction? >> >> If piracy is a crime, and not just a civil offence,

Re: DOS or not? [was Re: How to tell Script to use pythonw.exe ?]

2013-07-04 Thread Chris Angelico
On Fri, Jul 5, 2013 at 8:12 AM, Andrew Berg wrote: > On 2013.07.04 09:08, Wayne Werner wrote: >> powershell -ExecutionPolicy Bypass -File ... >> >> >> \o/ >> >> Microsoft "security" at it again! (reminds me a bit of just pushing >> "Cancel" to log into windows 98, I think it was) > From an MSDN pa

Re: How is this evaluated

2013-07-05 Thread Chris Angelico
On Fri, Jul 5, 2013 at 11:41 AM, Steven D'Aprano wrote: > If you know C, that's like: > > ?(condition-being-tested, value-if-true, value-if-false) Or to be precise: condition-being-tested ? value-if-true : value-if-false ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Illegal suggestions on python list

2013-07-05 Thread Chris Angelico
On Fri, Jul 5, 2013 at 4:47 PM, zoom wrote: > Probably... > > http://en.wikipedia.org/wiki/Aaron_Swartz#JSTOR Things are always more complicated than any simple Usenet post can do justice to, and it'll often come down to who has the biggest legal budget. Since he was never actually found guilty (

Re: Illegal suggestions on python list

2013-07-05 Thread Chris Angelico
On Fri, Jul 5, 2013 at 5:23 PM, Νίκος Gr33k wrote: > Chris i just wanted to offer some help to you guys because i received a lot > for help here myself. Hey guys, I really appreciate what you've done, so here's what I'll do: I'm robbing the Last National Bank on Tuesda

Re: Default scope of variables

2013-07-05 Thread Chris Angelico
On Fri, Jul 5, 2013 at 11:24 PM, Neil Cerutti wrote: > Python provides deterministic destruction with a different > feature. You mean 'with'? That's not actually destruction, it just does one of the same jobs that deterministic destruction is used for (RAII). It doesn't, for instance, have any in

Re: How to check for threads being finished?

2013-07-05 Thread Chris Angelico
On Sat, Jul 6, 2013 at 2:59 AM, Steven D'Aprano wrote: > I then block until the threads are all done: > > while any(t.isAlive() for t in threads): > pass > Using the threading module, I assume. Is there any reason you can't simply join() each thread in succession? ChrisA -- http://mail.pyth

Re: Illegal suggestions on python list

2013-07-05 Thread Chris Angelico
On Sat, Jul 6, 2013 at 2:40 PM, Joshua Landau wrote: > On 5 July 2013 08:34, Chris Angelico wrote: >> On Fri, Jul 5, 2013 at 5:23 PM, Νίκος Gr33k wrote: >>> Of course we all know that a serial/patch/keygen/crack can be found for this >>> great edit very easily on wa

Re: Geo Location extracted from visitors ip address

2013-07-06 Thread Chris Angelico
On Sat, Jul 6, 2013 at 6:01 PM, Νίκος Gr33k wrote: > Is there any way to pinpoint the visitor's exact location? Yes. You ask them to fill in a shipping address. They may still lie, or they may choose to not answer, but that's the best you're going to achieve without getting a wizard to cast Scryi

Re: Editor Ergonomics [was: Important features for editors]

2013-07-06 Thread Chris Angelico
On Sun, Jul 7, 2013 at 12:10 AM, Skip Montanaro wrote: > If you stop to > think about it, all text editors probably present similar issues for > their users. They all involve: > > * a lot of typing, > * use of modifier keys (ctrl, alt, command, etc) > * movement between the mouse and the keyboard

Re: Simple recursive sum function | what's the cause of the weird behaviour?

2013-07-06 Thread Chris Angelico
On Sat, Jul 6, 2013 at 10:37 PM, Russel Walker wrote: > This works: > - - - - - - x = [[1], [2], [3]] supersum(x) > 6 supersum(x, []) > [1, 2, 3] > > > This does not: > - - - - - - - x = [[[1], [2]], [3]] supersum(x, []) > [1, 2, 1, 2, 3] You have a problem of s

Re: Default scope of variables

2013-07-07 Thread Chris Angelico
On Sun, Jul 7, 2013 at 11:13 PM, Wayne Werner wrote: > Which you would then use like: > > > conn = create_conn() > with new_transaction(conn) as tran: > rows_affected = do_query_stuff(tran) > if rows_affected == 42: > tran.commit() Yep. There's a problem, though, when you brin

<    4   5   6   7   8   9   10   11   12   13   >