Re: Why do Perl programmers make more money than Python programmers

2013-05-06 Thread Joshua Landau
On 6 May 2013 13:03, Steven D'Aprano wrote: > On Mon, 06 May 2013 17:30:33 +1000, Chris Angelico wrote: > > > On Mon, May 6, 2013 at 4:28 PM, Fábio Santos > > wrote: > >>> And of course, the Python Programmer's moral code is only 80 > >>> characters wide. > >> > >> No! Was it not seventy characte

Re: Help with loading file into an array

2013-05-06 Thread Joshua Landau
On 5 May 2013 07:06, peter berrett wrote: > I am trying to build a program that can find comets in a series of > astronomical images. I have already written functions to find the comet in > a series of images, the data of which is stored in embedded lists. > > The area I am having difficulty with

Re: Collision of Two Rect

2013-05-06 Thread Joshua Landau
On 4 May 2013 00:42, Ian Kelly wrote: > The other thing that is suspicious about the code you posted is that > it has two different notions of the ball's position that are not > necessarily in agreement. There is the ball_rect, and there are also > the x and y variables. > You should be caref

Fatal Python error

2013-05-29 Thread Joshua Landau
Hello all, again. Instead of revising like I'm meant to be, I've been delving into a bit of Python and I've come up with this code: class ClassWithProperty: @property def property(self): pass thingwithproperty = ClassWithProperty() def loop(): try: thingwithproperty.property except: pass loop

Re: Fatal Python error

2013-05-29 Thread Joshua Landau
On 29 May 2013 13:25, Dave Angel wrote: > On 05/29/2013 07:48 AM, Joshua Landau wrote: > >> Hello all, again. Instead of revising like I'm meant to be, I've been >> delving into a bit of Python and I've come up with this code: >> >> > To star

Re: Fatal Python error

2013-05-29 Thread Joshua Landau
On 29 May 2013 13:30, Marcel Rodrigues wrote: > > I just tried your code with similar results: it does nothing on PyPy 2.0.0-beta2 and Python 2.7.4. But on Python 3.3.1 it caused core dump. > It's a little weird but so is the code. You have defined a function that calls itself unconditionally. Thi

Re: Fatal Python error

2013-05-29 Thread Joshua Landau
On 29 May 2013 14:02, Dave Angel wrote: > On 05/29/2013 08:45 AM, Oscar Benjamin wrote: > Joshua: Avoid doing anything complex inside an exception handler. Unfortunately, Ranger (the file manager in question) wraps a lot of stuff in one big exception handler. Hence there isn't much choice. The

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Joshua Landau
On 30 May 2013 10:48, wrote: > Question: > - > Function mergeSort is called only once, but it is getting recursively > executed after the printing the last statement "print("Merging ",alist)". But > don't recursion taking place except at these places "mergeSort(lefthalf), > mergeSort(r

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Joshua Landau
On 30 May 2013 11:19, wrote: > Also, Can you please let me know how did you found out that I am using Python > 2 Interpreter. Do you have access to a Python3 interpreter? If so, try running it and your output will look like: Splitting [54, 26, 93, 17, 77, 31, 44, 55, 20] Splitting [54, 26, 9

Re: User Input

2013-05-30 Thread Joshua Landau
On 30 May 2013 15:47, Eternaltheft wrote: >> And perhaps you meant for your function to CALL drawBoard(), rather than >> returning the function object drawBoard. >> >> DaveA > > do you think it would be better if i call drawBoard? Please read http://www.catb.org/esr/faqs/smart-questions.html, or

Re: Cutting a deck of cards

2013-06-01 Thread Joshua Landau
On 31 May 2013 12:56, Lee Crocker wrote: > Why on Earth would you want to? "Cutting" a deck makes no sense in software. > Randomize the deck properly (Google "Fisher-Yates") and start dealing. > Cutting the deck will not make it any more random, True > and in fact will probably make it worse d

Re: Too many python installations. Should i remove them all and install the latest?

2013-06-03 Thread Joshua Landau
On 3 June 2013 04:18, Chris Angelico wrote: > On Mon, Jun 3, 2013 at 12:30 PM, alex23 wrote: >> On Jun 1, 10:24 am, Chris Angelico wrote: >>> Hmm. What other MUD commands have obvious Unix equivalents? >>> >>> say --> echo >>> emote --> python -c >>> attack --> sudo rm -f >> >> who --> who >> te

Re: Beginner question

2013-06-04 Thread Joshua Landau
On 4 June 2013 04:39, wrote: > Is there a more efficient way of doing this? Any help is gratly appreciated. > > > import random > def partdeux(): > print('''A man lunges at you with a knife! > Do you DUCK or PARRY?''') > option1=('duck') > option2=('parry') > optionsindex=[option1

Re: How to get an integer from a sequence of bytes

2013-06-04 Thread Joshua Landau
On 4 June 2013 14:39, Grant Edwards wrote: > On 2013-06-03, Dan Stromberg wrote: >> Today though, it would be difficult to sell a conventional (Von Neumann) >> computer that didn't have 8 bit bytes. > > There are tons (as in millions of units per month) of CPUs still being > sold in the DSP marke

Re: [RELEASED] Python 2.7.5

2013-06-04 Thread Joshua Landau
On 4 June 2013 00:12, Mark Lawrence wrote: > On 03/06/2013 23:37, Carlos Nepomuceno wrote: >> What still doesn't work in Python 3? > > http://python3wos.appspot.com/ Don't take this list too seriously - some of those do have fully working and stable Python 3 packages that just aren't in pip, like

Re: How to increment date by week?

2013-06-04 Thread Joshua Landau
On 4 June 2013 22:31, PieGuy wrote: >Starting on any day/date, I would like to create a one year list, by week > (start date could be any day of week). Having a numerical week index in > front of date, ie 1-52, would be a bonus. >ie, 1. 6/4/2013 >2. 6/11/2013 >3. 6/18

Re: Re-using copyrighted code

2013-06-10 Thread Joshua Landau
On 10 June 2013 17:29, llanitedave wrote: > However, I have yet to see an example of source code that qualifies as either > parody or satire under any standard. You should try reading Perl. -- http://mail.python.org/mailman/listinfo/python-list

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Joshua Landau
On 11 June 2013 01:11, Peter Otten <__pete...@web.de> wrote: > def partition(items, predicate=bool): > a, b = itertools.tee((predicate(item), item) for item in items) > return ((item for pred, item in a if not pred), > (item for pred, item in b if pred)) I have to tell you this

Re: "Don't rebind built-in names*" - it confuses readers

2013-06-11 Thread Joshua Landau
On 11 June 2013 01:14, Terry Jan Reedy wrote: > Many long-time posters have advised "Don't rebind built-in names*. > > For instance, open Lib/idlelib/GrepDialog.py in an editor that colorizes > Python syntax, such as Idle's editor, jump down to the bottom and read up, > and (until it is patched) f

Re: PyWart: The problem with "print"

2013-06-12 Thread Joshua Landau
On 4 June 2013 14:35, Mark Lawrence wrote: > On 04/06/2013 14:29, rusi wrote: >> The Clash of the Titans >> >> Lé jmf chârgeth with mightƴ might >> And le Mond underneath trembleth >> Now RR mounts his sturdy steed >> And the windmill yonder turneth >> > > +1 funniest poem of the week :) Week? Do

Re: My son wants me to teach him Python

2013-06-13 Thread Joshua Landau
On 13 June 2013 17:50, Tomasz Rola wrote: > Of course kids are more interesting in things painted on > screen, especially if they are colorful, move and make > sounds at that. The next step would be a simple, > interactive game. > > Which is why I would synthesize something neat yet > simple from

Re: My son wants me to teach him Python

2013-06-13 Thread Joshua Landau
On 13 June 2013 14:01, rusi wrote: > Some views of mine (controversial!). > > Python is at least two things, a language and a culture. > As a language its exceptionally dogma-neutral. > You can do OO or FP, throwaway one-off scripts or long-term system > building etc > > However as a culture it se

Re: My son wants me to teach him Python

2013-06-13 Thread Joshua Landau
I don't normally respond to trolls, but I'll make an exception here. On 14 June 2013 04:33, Rick Johnson wrote: > On Thursday, June 13, 2013 3:18:57 PM UTC-5, Joshua Landau wrote: > >> [...] >> GUI is boring. I don't give a damn about that. If I had it >>

Re: Eval of expr with 'or' and 'and' within

2013-06-14 Thread Joshua Landau
On 14 June 2013 19:37, rusi wrote: > 2. The recent responses from Robert Kern are in my view the ideal. In > summary it runs thus: > Stupid question no. 6457 from Nikos: ... > Robert : Look this up > Nikos: I dont understand > Robert: explains > Nikos: I DONTU NDERSTND > Robert: explains (repea

Re: Why 'files.py' does not print the filenames into a table format?

2013-06-15 Thread Joshua Landau
On 15 June 2013 20:51, Nick the Gr33k wrote: > On 15/6/2013 10:46 μμ, Jarrod Henry wrote: >> >> Nick, at this point, you need to hire someone to do your work for you. > > > The code is completely ready. > Some detail is missing and its not printing the files as expected. Look, Nick, A lot of peo

Re: Pattern Search Regular Expression

2013-06-15 Thread Joshua Landau
On 15 June 2013 11:18, Mark Lawrence wrote: > I tend to reach for string methods rather than an RE so will something like > this suit you? > > c:\Users\Mark\MyPython>type a.py > for s in ("In the ocean", > "On the ocean", > "By the ocean", > "In this group", >

Re: A Beginner's Doubt

2013-06-19 Thread Joshua Landau
Please be aware, Augusto, that Rick is known to be a bit... OTT. Don't take him too seriously (but he's not an idiot either). On 19 June 2013 14:58, wrote: > Hello! > 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 th

Re: A Beginner's Doubt

2013-06-19 Thread Joshua Landau
On 19 June 2013 17:39, Joel Goldstick wrote: > What is the subject that this teacher of yours teaches? > Do you know anyone who has every done any programming? > Why python? One of those questions is too easy :P. But, no, I'd actually point out that Python might *not* be the best language for th

Re: python game

2013-06-19 Thread Joshua Landau
This is prob'ly the freakiest thing I've ever run... Anyhoo, I recommend that when you post slabs of code to a mailing list you at least make it runnable for us. We don't have the images. I "fixed" it by doing: | playerImage = pygame.Surface((40, 40)) | bearImage = pygame.Surface((64, 64)) | | pla

Re: Problem with the "for" loop syntax

2013-06-19 Thread Joshua Landau
On 19 June 2013 23:53, Arturo B wrote: > Mmmm > > Ok guys, thank you > > I'm really sure that isn't a weird character, it is a space. > > My Python version is 3.3.2, I've runed this code in Python 2.7.5, but it > stills the same. > > I've done what you said but it doesn't work. > > Please Che

Re: Problem with the "for" loop syntax

2013-06-20 Thread Joshua Landau
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 far before). > > See if your editor has a show-the-matching-bracket mode. > If you suspect you failed

Re: About GIL Questions!

2013-06-20 Thread Joshua Landau
On 20 June 2013 05:13, 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 ? Chris Angelico touched on your other points, but not this as clearly; Python threads run on one thread because

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 21 June 2013 23:26, Gary Herron wrote: > On 06/21/2013 02:17 PM, Yves S. Garret wrote: >> I have the following line of code: >> log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'], >> settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider) <...> >> I was thinking of

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 14:36, Joshua Landau wrote: > message = "Item wrote to MongoDB database " Pedant's note: "Item *written* to MongoDB database" -- http://mail.python.org/mailman/listinfo/python-list

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 16:24, Rick Johnson wrote: > On Saturday, June 22, 2013 8:36:43 AM UTC-5, Joshua Landau wrote: >> message = "Item wrote to MongoDB database " >> message += "{0[MONGODB_DB]}/{0[MONGODB_COLLECTION]}".format(settings) >> log.msg(message, leve

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 14:36, Joshua Landau wrote: > My favourite way would be along the lines of: > > message = "Item wrote to MongoDB database " > message += "{0[MONGODB_DB]}/{0[MONGODB_COLLECTION]}".format(settings) > log.msg(message, level=log.DEBUG, spider=spid

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 16:55, Rick Johnson wrote: > On Saturday, June 22, 2013 10:40:24 AM UTC-5, Joshua Landau wrote: >> > Plus, your use of the format syntax is incorrect. >> Wut? > > Well what i mean exactly is not that it's illegal, i just > find the use of the

Re: n00b question on spacing

2013-06-22 Thread Joshua Landau
On 22 June 2013 18:28, Alister wrote: > On Sat, 22 Jun 2013 17:11:00 +0100, Joshua Landau wrote: > >> On 22 June 2013 16:55, Rick Johnson >> wrote: >>> On Saturday, June 22, 2013 10:40:24 AM UTC-5, Joshua Landau wrote: >>>> > Plus, your use o

Re: What's wrong with this code? (UnboundLocalError: local variable referenced before assignment)

2013-06-24 Thread Joshua Landau
Here's a little test to make sure you understand (this is one of the most confusing parts of Python's closures in my opinion): foo = "I'm foo!" def working(): print(foo) def broken(): print(foo) if False: # There's no way this could cause a problem! foo = "This will *never*

Re: What's wrong with this code? (UnboundLocalError: local variable referenced before assignment)

2013-06-24 Thread Joshua Landau
On 24 June 2013 21:12, John Gordon wrote: > Since you're new to programming, this might be a bit tricky to explain, > but I'll do my best. :-) > > The problem is that change() isn't being executed here; instead it's being > executed from within root.mainloop(), whenever the user presses button-1.

Re: Is this PEP-able? fwhile

2013-06-24 Thread Joshua Landau
On 24 June 2013 20:52, wrote: > Syntax: > > fwhile X in ListY and conditionZ: > > The following would actually exactly as: for X in ListY: > > fwhile X in ListY and True: > > fwhile would act much like 'for', but would stop if the condition after the > 'and' is no longer True. > > The motivation

Re: What's wrong with this code? (UnboundLocalError: local variable referenced before assignment)

2013-06-24 Thread Joshua Landau
On 24 June 2013 21:19, wrote: > Thank's to you all! > > Setting isWhite as global worked fine. > I'll probably be back soon with another silly question, see you then :) By the way, it's normally bad to use globals like this. When you're learning it's something you just do, though; it's fine for

Re: Is this PEP-able? fwhile

2013-06-25 Thread Joshua Landau
On 25 June 2013 00:13, Tim Chase wrote: > On 2013-06-24 23:39, Fábio Santos wrote: >> On 24 Jun 2013 23:35, "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

Re: Is this PEP-able? fwhile

2013-06-25 Thread Joshua Landau
On 24 June 2013 23:50, Chris Angelico wrote: > > In more free-form languages, I implement this by simply omitting a line-break: ... > Python could afford to lose a little rigidity here rather than gain > actual new syntax: > > for i in range(10): if i%3: > print(i) > > And there you are, the f

Re: Limit Lines of Output

2013-06-25 Thread Joshua Landau
On 25 June 2013 21:22, Bryan Britten wrote: > Ah, I always forget to mention my OS on these forums. I'm running Windows. Supposedly, Windows has "more" [http://superuser.com/questions/426226/less-or-more-in-windows], For Linux+less; this works: from subprocess import Popen, PIPE less = Popen("l

Re: class factory question

2013-06-26 Thread Joshua Landau
On 26 June 2013 15:46, Peter Otten <__pete...@web.de> wrote: > The clean way to > cope with the situation is to use a dict: > > classnames = ["Vspace", ...] > classes = {name: type(name, ...) for name in classnames} > > Then you can access the Vspace class with > > classes["Vspace"] > > If that is

Re: Limit Lines of Output

2013-06-26 Thread Joshua Landau
On 25 June 2013 22:48, Gene Heskett wrote: > On Tuesday 25 June 2013 17:47:22 Joshua Landau did opine: I did not. -- http://mail.python.org/mailman/listinfo/python-list

Re: Limit Lines of Output

2013-06-26 Thread Joshua Landau
On 26 June 2013 17:46, Steven D'Aprano wrote: > On Wed, 26 Jun 2013 16:24:56 +0100, 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. > > Unless ther

Re: Need help removing trailing zeros

2013-06-26 Thread Joshua Landau
On 26 June 2013 23:02, wrote: > Hello, i'm making a calculator and I want to be able to use decimals but I > don't like it when it comes out as ex.12.0 when it should be 12. I tried > using .rstrip("0".rstrip(".") but that never seemed to work. If anyone has a > solution please let me know, al

Re: Need help removing trailing zeros

2013-06-26 Thread Joshua Landau
On 26 June 2013 23:21, PyNoob wrote: > Sorry about that... And thanks for your help, but I don't quite understand. That's fine, but... > Would that make it off your example print("{:g}".format(1.0))? I don't understand this sentence. But, hey, I forgot to check what level you were working at --

Re: class factory question

2013-06-26 Thread Joshua Landau
On 26 June 2013 16:40, Peter Otten <__pete...@web.de> wrote: > Joshua Landau wrote: > >> I would say if a dict isn't good, there are still some cases where you >> might not want to use globals. >> >> I _might_ do: > >> # Make

Re: Limit Lines of Output

2013-06-27 Thread Joshua Landau
On 27 June 2013 00:57, Steven D'Aprano wrote: > On Wed, 26 Jun 2013 10:09:13 -0700, rusi wrote: > >> On Wednesday, June 26, 2013 8:54:56 PM UTC+5:30, Joshua Landau wrote: >>> On 25 June 2013 22:48, Gene Heskett wrote: >>> > On Tuesday 25 June 2013 17:47:22

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Joshua Landau
On 27 June 2013 13:54, Andrew Berg wrote: > I've begun writing a program with an interactive prompt, and it needs to > parse input from the user. I thought the argparse module would be > great for this, but unfortunately it insists on calling sys.exit() at any > sign of trouble instead of lettin

Re: class factory question

2013-06-27 Thread Joshua Landau
On 26 June 2013 14:09, Tim wrote: > I am extending a parser and need to create many classes that are all > subclassed from the same object (defined in an external library). When my > module is loaded I need all the classes to be created with a particular name > but the behavior is all the same

Re: ? get negative from prod(x) when x is positive integers

2013-06-28 Thread Joshua Landau
On 28 June 2013 15:38, Vincent Davis wrote: > I have a list of a list of integers. The lists are long so i cant really > show an actual example of on of the lists, but I know that they contain only > the integers 1,2,3,4. so for example. > s2 = [[1,2,2,3,2,1,4,4],[2,4,3,2,3,1]] > > I am calculatin

Re: FACTS: WHY THE PYTHON LANGUAGE FAILS.

2013-06-28 Thread Joshua Landau
On 28 June 2013 19:52, Wayne Werner wrote: > On Fri, 28 Jun 2013, 8 Dihedral wrote: > >> KIND OF BORING TO SHOW HOW THE LISP PROGRAMMING >> WAS ASSIMULATED BY THE PYTHON COMMUNITY. >> >> OF COURSE PYTHON IS A GOOD LANGUAGE FOR DEVELOPING >> ARTIFICIAL INTELEGENT ROBOT PROGRAMS NOT SO BRAIN DAM

Re: FACTS: WHY THE PYTHON LANGUAGE FAILS.

2013-06-28 Thread Joshua Landau
On 28 June 2013 20:35, Joel Goldstick wrote: > > On Fri, Jun 28, 2013 at 3:22 PM, Joshua Landau > wrote: >> >> On 28 June 2013 19:52, Wayne Werner wrote: >> > On Fri, 28 Jun 2013, 8 Dihedral wrote: >> > >> >> KIND OF BORING TO SHOW HO

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

2013-06-29 Thread Joshua Landau
On 29 June 2013 03:07, charles benoit wrote: 1) You haven't asked a question. 2) You posted your code twice. That makes it look a lot harder and longer than it really is. 3) Give us a *minimal* reproducible test case. I currently just get: %~> python2 /tmp/nd.py Traceback (most recent call la

Re: Closures in leu of pointers?

2013-06-29 Thread Joshua Landau
On 29 June 2013 20:42, Tim Chase wrote: > On 2013-06-29 19:19, Steven D'Aprano wrote: >> Nobody ever asks why Python doesn't let you sort an int, or take >> the square of a list... > > just to be ornery, you can sort an int: > i = 314159265 ''.join(sorted(str(i))) > '112345569' To be ye

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

2013-06-29 Thread Joshua Landau
On 29 June 2013 18:00, Mark Lawrence wrote: > On 29/06/2013 17:05, Joshua Landau wrote: >> > > Why this when the approach to Nick the Incompetant Greek has been to roll > out the red carpet? I am my own person, and should not be judged by the actions of others. -- http

Rough sketch of a PEP for issue2292

2013-06-29 Thread Joshua Landau
on and, I think, there are too many code blocks. So it's all liable to change. PEP: XXX Title: Additional Unpacking Generalizations Version: $Revision$ Last-Modified: $Date$ Author: Joshua Landau Discussions-To: python-id...@python.org Status: Draft Type: Standards Track Content-Type: text/x

Re: Stupid ways to spell simple code

2013-06-29 Thread Joshua Landau
On 30 June 2013 07:06, Chris Angelico wrote: > 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: [Pytho

Re: Stupid ways to spell simple code

2013-06-30 Thread Joshua Landau
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 amused, peruse the "idlelib" -- not only is the code obfuscated, it > also breaks PEP8 and t

Re: Stupid ways to spell simple code

2013-06-30 Thread Joshua Landau
On 30 June 2013 18:36, Steven D'Aprano wrote: > Pfft! Where's the challenge in that? Let's use an O(n!) algorithm for > sorting -- yes, n factorial -- AND abuse a generator expression for its > side effect. As a bonus, we use itertools, and just for the lulz, I > obfuscate as many of the names as

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

2013-06-30 Thread Joshua Landau
On 30 June 2013 20:58, Robert Kern wrote: > On 2013-06-30 18:24, Νίκος wrote: >> >> Στις 29/6/2013 8:00 μμ, ο/η Mark Lawrence έγραψε: >> >>> Why this when the approach to Nick the Incompetant Greek has been to >>> roll out the red carpet? >> >> >> Your mother is incompetent who raised a brat like

Re: indexerror: list index out of range??

2013-07-01 Thread Joshua Landau
On 29 June 2013 15:30, Mark Lawrence wrote: > > On 29/06/2013 14:44, Dave Angel wrote: >> >> Since you're using the arrogant and buggy GoogleGroups, this >> http://wiki.python.org/moin/GoogleGroupsPython. >> > Please don't make comments like this, you'll upset the Python Mailing List > Police. *d

Re: Stupid ways to spell simple code

2013-07-01 Thread Joshua Landau
On 1 July 2013 14:14, Chris Angelico wrote: > 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 t

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

2013-07-01 Thread Joshua Landau
gs in perspective, these are the people who have been insulting on this post: Mark Lawrence (once, probably without meaning to be insulting) Nikos Antoon Pardon And here are the people who have reminded them to stop: Steve Simmons Steven D'Aprano Andrew Berg Walter Hurry rusi Joshua

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

2013-07-01 Thread Joshua Landau
On 1 July 2013 18:15, Νίκος wrote: > Στις 1/7/2013 7:56 μμ, ο/η Joshua Landau έγραψε: > >> So yes, Antoon Pardon and Nikos, please stop. You are not representing >> the list. I haven't followed any of the other arguments, true, but you >> two in particular are cau

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

2013-07-01 Thread Joshua Landau
On 1 July 2013 19:29, rusi wrote: > On Monday, July 1, 2013 10:26:21 PM UTC+5:30, Joshua Landau wrote: >> So yes, Antoon Pardon and Nikos, please stop. You are not representing >> the list. > > This 'and' is type-wrong. I don't follow. >> I haven't

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

2013-07-01 Thread Joshua Landau
On 1 July 2013 20:12, Antoon Pardon wrote: > Op 01-07-13 18:56, Joshua Landau schreef: > >> >> To put things in perspective, these are the people who have been >> insulting on this post: >> >> Mark Lawrence (once, probably without meaning to be insulting) >

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

2013-07-01 Thread Joshua Landau
On 1 July 2013 20:18, Antoon Pardon wrote: > Op 01-07-13 17:33, Steven D'Aprano schreef: > >> On Mon, 01 Jul 2013 15:08:18 +0200, Antoon Pardon wrote: >> >>> Op 01-07-13 14:43, Steven D'Aprano schreef: >>> Νίκος, I am not going to wade through this long, long thread to see what problem y

Re: python adds an extra half space when reading froma string or list -- back to the question

2013-07-01 Thread Joshua Landau
On 1 July 2013 20:32, Joel Goldstick wrote: > I copied the original question so that the rant on the other thread can > continue. Let's keep this thread ontopic Thank you. I shall do the same below. Unfortunately I don't have high hopes that any progress will be made on this thread -- Charles Be

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

2013-07-01 Thread Joshua Landau
On 2 July 2013 05:34, rusi wrote: > On Monday, July 1, 2013 8:36:53 PM UTC+5:30, Neil Cerutti wrote: >> On 2013-07-01, rusi wrote: >> > 1. Kill-filing/spam-filtering are tools for spam. >> > Nikos is certainly not spamming in the sense of automated >> > sending out of cooked mail to zillions of re

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

2013-07-02 Thread Joshua Landau
On 2 July 2013 08:22, Antoon Pardon wrote: > Op 01-07-13 21:28, Joshua Landau schreef: > >> Well then you are wrong. But fine, I'll use your definition incorrect >> as it may be (when talking to you, please don't misrepresent my other >> posts). >> >&

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

2013-07-02 Thread Joshua Landau
On 2 July 2013 13:01, Antoon Pardon wrote: > Op 02-07-13 11:34, Joshua Landau schreef: > >> No it does not. I'd give you more of a counter but I actually have no >> idea how you came up with that. > Please answer the following question. If someone behaved incompetently,

Re: Python list code of conduct

2013-07-02 Thread Joshua Landau
On 2 July 2013 16:51, Steve Simmons wrote: > Erm, > > It probably isn't the best time to start this post but I was wondering... > > Does this list have a code of conduct or a netiqeutte (sp?) > statement/requirement? > > If not, should it? > > Is the membership of this list presently in the right

Re: Parsing Text file

2013-07-02 Thread Joshua Landau
On 2 July 2013 20:50, Tobiah wrote: > How do we know whether we have Sometext? > If it's really just a literal 'Sometext', then > just print that when you hit maskit. > > Otherwise: > > > for line in open('file.txt').readlines(): > > if is_sometext(line): > memory = line >

Re: Parsing Text file

2013-07-02 Thread Joshua Landau
On 2 July 2013 21:28, wrote: > Here I am looking for the line that contains: "WORK_MODE_MASK", I want to > print that line as well as the file name above it: > config/meal/governor_mode_config.h > or config/meal/components/source/ceal_PackD_kso_aic_core_config.h. > > SO the output should be som

Re: how to calculate reputation

2013-07-02 Thread Joshua Landau
On 2 July 2013 22:43, Surya Kasturi wrote: > Hi all, this seems to be quite stupid question but I am "confused".. > We set the initial value to 0, +1 for up-vote and -1 for down-vote! nice. > > I have a list of bool values True, False (True for up vote, False for > down-vote).. submitted by users.

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

2013-07-02 Thread Joshua Landau
On 2 July 2013 23:34, Ben Finney wrote: > > Joshua Landau writes: >> There is not ever a place on this list where you will need to call >> someone incompetent. > > So even if that term describes their behaviour and manner, you think > no-one should ever point it o

Re: HTML Parser

2013-07-02 Thread Joshua Landau
On 2 July 2013 18:43, wrote: > I could not use BeautifulSoup as I did not find an .exe file. Were you perhaps looking for a .exe file to install BeautifulSoup? It's quite plausible that a windows user like you might be dazzled at the idea of a .tar.gz. I suggest just using "pip install beautifu

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

2013-07-02 Thread Joshua Landau
On 3 July 2013 01:36, Ben Finney wrote: > I think we've found the root of > the disagreement. I've made my position clear and will let it rest there. Seconded. > Thanks for caring enough about this community to act in the > interest of keeping it open, considerate, and respectful. Thank you in

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

2013-07-02 Thread Joshua Landau
On 3 July 2013 01:52, Steven D'Aprano wrote: > If you are a beginner to a programming language, assume that anything > that doesn't work the way you expect is a bug in YOUR code, or YOUR > understanding, not in the language. Not just beginners. Out of the hundreds of times where I've gone "this *

Re: how to calculate reputation

2013-07-03 Thread Joshua Landau
On 2 July 2013 23:19, Surya Kasturi wrote: > > I think I didnt explain it clearly.. let me make it clear.. Yeah... I don't get it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorator help

2013-07-03 Thread Joshua Landau
On 3 July 2013 23:09, Joseph L. Casale wrote: > I have a set of methods which take args that I decorate twice, > > def wrapped(func): > def wrap(*args, **kwargs): > try: > val = func(*args, **kwargs) > # some work > except BaseException as error: >

Re: Decorator help

2013-07-03 Thread Joshua Landau
On 3 July 2013 23:19, Joshua Landau wrote: > If you don't want to do that, you'd need to use introspection of a > remarkably hacky sort. If you want that, well, it'll take a mo. After some effort I'm pretty confident that the hacky way is impossible. -- http://mail.p

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

2013-07-03 Thread Joshua Landau
On 3 July 2013 02:21, wrote: > On 07/02/2013 05:18 PM, Joshua Landau wrote: >> On 2 July 2013 23:34, Ben Finney wrote: >>[...] >>> Needless to say, I disagree with your position. There is no place for >>> baseless insults in this community; but when the

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

2013-07-03 Thread Joshua Landau
On 3 July 2013 11:01, Antoon Pardon wrote: > Op 02-07-13 15:40, Joshua Landau schreef: >> On 2 July 2013 13:01, Antoon Pardon wrote: >>> >> >> There is not ever a place on this list where you will need to call >> someone incompetent. You can explain to someone

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

2013-07-03 Thread Joshua Landau
On 4 July 2013 04:52, 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 Python 3 gained syntax for keyword-only arguments. Try "foo(1)" and it will fail -- "bar" needs to be gi

Re: Default scope of variables

2013-07-03 Thread Joshua Landau
On 4 July 2013 05:07, Chris Angelico wrote: > 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

Re: Default scope of variables

2013-07-03 Thread Joshua Landau
On 4 July 2013 05:36, Chris Angelico wrote: > 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 i

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

2013-07-03 Thread Joshua Landau
On 4 July 2013 05:47, alex23 wrote: > On 4/07/2013 2:12 PM, Joshua Landau wrote: >> >> On 4 July 2013 04:52, Maciej Dziardziel wrote: >>> >>> def foo(*args, bar=1, **kwargs): >>> pass > > >> Try "foo(1)" and it will fail -- &qu

Re: Default scope of variables

2013-07-04 Thread Joshua Landau
On 4 July 2013 17:54, Rotwang wrote: > 53*(63**100 - 1)//62 Or about 10**10**6.255 (so about 1.80M digits long). For the unicode side (Python 3, in other words) and reusing your math (ya better hope it's right!), you are talking: 97812*((97812+2020)**100 - 1)/(97812+2020-1) Or about 1

Re: Important features for editors

2013-07-04 Thread Joshua Landau
On 4 July 2013 08:32, cutems93 wrote: > I am researching on editors for my own reference. I found that each of them > has some features that other don't, but I am not sure which features are > significant/necessary for a GOOD editor. What features do you a good editor > should have? Keyboard sh

Re: Decorator help

2013-07-04 Thread Joshua Landau
On 4 July 2013 06:39, Peter Otten <__pete...@web.de> wrote: > Joshua Landau wrote: > >> On 3 July 2013 23:19, Joshua Landau wrote: >>> If you don't want to do that, you'd need to use introspection of a >>> remarkably hacky sort. If you want that, well

Re: First attempt at a Python prog (Chess)

2013-07-04 Thread Joshua Landau
Just a minor suggestion: def display_board(board): print ' a b c d e f g h' print '+---+---+---+---+---+---+---+---+' for row in range(8): for col in range(8): piece = board[row * 8 + col] if piece_type[piece] == WHITE: print '| \x1b[31;0

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

2013-07-04 Thread Joshua Landau
On 4 July 2013 12:19, Antoon Pardon wrote: > Op 04-07-13 01:40, Joshua Landau schreef: > >> Bear in mind that if the way you were acting was all in my "with >> trepidation" category, I would likely have not spoken up. I believe >> you crossed a lot further beyo

Re: Default scope of variables

2013-07-04 Thread Joshua Landau
On 5 July 2013 03:03, Dave Angel wrote: > On 07/04/2013 09:24 PM, Steven D'Aprano wrote: >> On Thu, 04 Jul 2013 17:54:20 +0100, Rotwang wrote: >>> It's perhaps worth mentioning that some non-ascii characters are allowed >>> in identifiers in Python 3, though I don't know which ones. >> >> PEP 3131

Re: Default scope of variables

2013-07-04 Thread Joshua Landau
On 5 July 2013 03:03, Dave Angel wrote: > In particular, > http://docs.python.org/3.3/reference/lexical_analysis.html#identifiers > > has a definition for id_continue that includes several interesting > categories. I expected the non-ASCII digits, but there's other stuff there, > like "nonsp

  1   2   3   4   5   >