Meaning of "Add Python to environment variables"

2017-12-03 Thread John Yeung
In the custom installation options for Python 3.6, what *exactly* does "Add Python to environment variables" mean? Which environment variables are we talking about? I imagine one of them would have to be PATH. Are there any others? John Y. -- https://mail.python.org/mailman/listinfo/python-lis

Re: [pyxl] xlrd-0.8.0 .xlsx formatting_info=True not imlemented

2012-08-29 Thread John Yeung
> is there any other way to tell how many digits excel would round to > when displaying a floating point number? that's my only reason for > needing formatting_info=True. I have not personally used it, but OpenPyXL is another option for working with .xlsx files, and it might provide the formatting

Re: Multiprocessing bug, is my editor (SciTE) impeding my progress?

2011-12-06 Thread John Yeung
On Dec 6, 7:30 pm, John Ladasky wrote: > On Dec 6, 1:42 pm, Terry Reedy wrote: > > It is even possible that multiprocessing.pool has a bug > > that you ran into. > > Oh, please don't say that.  I'm no computer scientist, and > Python has been scrutinized by so many professionals.  I > couldn't ha

PEP 8 and indentation of continuation lines

2011-06-20 Thread John Yeung
Lurking on python-dev, I noticed a thread early this month (starting June 2) about possible additions to PEP 8 covering indentation of continuation lines. The recommendation was to double-indent continuation lines which are about to introduce a new suite, unless you are going to base your indentat

Ensuring symmetry in difflib.SequenceMatcher

2010-11-23 Thread John Yeung
I'm generally pleased with difflib.SequenceMatcher: It's probably not the best available string matcher out there, but it's in the standard library and I've seen worse in the wild. One thing that kind of bothers me is that it's sensitive to which argument you pick as "seq1" and which you pick as

Re: str(int_var) formatted

2010-10-29 Thread John Yeung
On Oct 29, 11:59 am, Tracubik wrote: > i've to convert integer x to string, but if x < 10, > the string have to be '0x' instead of simple 'x' > > for example: > > x = 9 > str(x) --> '09' Everyone else seems to prefer the format-based solutions, which is fine. I will give zfill a little exposure,

Re: importing excel data into a python matrix?

2010-09-01 Thread John Yeung
On Sep 1, 7:45 pm, Chris Rebert wrote: > On Wed, Sep 1, 2010 at 4:35 PM, patrick mcnameeking > > wrote: > > I'm working on a project where I have been given > > a 1000 by 1000 cell excel spreadsheet and I would > > like to be able to access the data using Python. > > Does anyone know of a way tha

Re: Why Python3

2010-06-29 Thread John Yeung
On Jun 28, 1:58 pm, "OKB (not okblacke)" wrote: > Steven D'Aprano wrote: > > For the rest of us, you can do a lot with just Python 3.1, > > with or without C modules. Whether it does *enough* to be > > considered for deployment depends on what you're deploying > > it to do. I for one would not hes

Re: Help running Windows programs from Python

2010-05-07 Thread John Yeung
On May 7, 3:14 pm, Scott wrote: > I want to write a script to automate log archiving/compressing on a > Win2003 server. I have Python 2.6 installed. I am planning to use 7- > zip for compression (because I have been using it manually for a while > now). For now all operations will be local in the

Re: using python2.6 on windows without installation

2010-04-29 Thread John Yeung
On Apr 29, 4:32 pm, Terry Reedy wrote: > > Try Movable Python - The Portable Python Distribution. > www.voidspace.org.uk/python/movpy/ You could also try Portable Python, which is somewhat newer and has 2.5, 2.6, and 3.0: http://www.portablepython.com/ John -- http://mail.python.org/mailman/

Re: dict.keys() and dict.values() are always the same order, is it?

2010-04-20 Thread John Yeung
alex23 wrote: > > > > I stand corrected. Thanks Cameron. Cameron Simpson wrote: > > > Oh, I was all ready to say what you said, but decided > > > to check the docs myself first:-) John Yeung wrote: > > I am not too comfortable relying on it.  It feels > &g

Re: Usable street address parser in Python?

2010-04-20 Thread John Yeung
My response is similar to John Roth's. It's mainly just sympathy. ;) I deal with addresses a lot, and I know that a really good parser is both rare/expensive to find and difficult to write yourself. We have commercial, USPS-certified products where I work, and even with those I've written a good

Re: dict.keys() and dict.values() are always the same order, is it?

2010-04-19 Thread John Yeung
On Apr 20, 1:23 am, Cameron Simpson wrote: > On 19Apr2010 21:31, alex23 wrote: > | Cameron Simpson wrote: > | >   If items(), keys(), values(), iteritems(), iterkeys(), and > | >   itervalues() are called with no intervening modifications to the > | >   dictionary, the lists will directly corres

Re: help with Python installation

2010-02-28 Thread John Yeung
On Feb 28, 12:51 am, gujax wrote: > I agree with you. I have a CD of Xubuntu. I tried > booting up with the CD and was impressed. I noticed > few problems with screen resolution, window size etc. Though it may be worth working out any niggling problems to switch to Linux, I don't think you should

Re: TypeError Exception in email lib

2010-02-15 Thread John Yeung
On Feb 15, 3:59 pm, John Yeung wrote: > It looks to me like you have to do something to make clean_stale_mail > more robust, rather than focusing on anything in the standard library. Let me quickly add: ...or fix whatever calls clean_stale_mail, etc. John -- http://mail.python.org/m

Re: TypeError Exception in email lib

2010-02-15 Thread John Yeung
On Feb 15, 2:54 pm, BJ Swope wrote: > def clean_stale_mail(): >     msg_date1= the_email.get('Date') >     msg_date2 = email.utils.parsedate_tz(msg_date1) >     try: >         utc_msg_date = email.utils.mktime_tz(msg_date2) >     except OverflowError: >         M.store(msg_id, '+FLAGS.SILENT', '\

Re: chr(12) Form Feed in Notepad (Windows)

2010-01-16 Thread John Yeung
On Jan 15, 7:40 pm, "W. eWatson" wrote: > I am writing a txt file. It's up to the user to print > it using Notepad or some other tool. In another response, Tim Chase suggested creating an RTF file instead of plain text. I think this is your best bet if your goal is to get page breaks with the le

Re: Perl to Python conversion

2009-12-25 Thread John Yeung
On Dec 13, 5:23 pm, martin.sch...@gmail.com (Martin Schöön) wrote: > r0g writes: > > You'll probably find the majority of code in a GUI > > app is boring window handling stuff [...] > > Also, they probably didn't make it with > > QT which is fairly different from GTK. > > Tk is what they used. We

Re: combinatorics via __future__ generators

2009-12-01 Thread John Yeung
On Dec 1, 5:55 pm, Phlip wrote: > Awesome thanks - but: > > > from itertools import imap,product > > Do we have a version for Python2.5? I have to support an older server > here; can't install a newer python on it... If you can get by with the performance of pure Python, a solution is right in th

Re: 2.6 and sys.exit()

2009-11-12 Thread John Yeung
On Nov 12, 11:32 pm, hetchkay wrote: > But I don't understand why the interpreter does not exit in 2.6 but > does exit in 2.5. Well, I do not need to understand that but I need to > know how to get the interpreter to exit in 2.6. Well, taken at face value, I would say the answer is to not use the

Re: 2.6 and sys.exit()

2009-11-12 Thread John Yeung
On Nov 12, 11:22 pm, r wrote: > On Nov 12, 10:07 pm, hetchkay wrote: > > I have the following in exit.py: > > import sys > > sys.exit(0) > > > I now try 'python -i exit.py': > > > In 2.5, the script exits as I would expect. > > > In 2.6, the following error is printed: > > > Traceback (most recen

Re: Cpython optimization

2009-10-21 Thread John Yeung
On Oct 22, 12:28 am, John Nagle wrote: >    The Shed Skin people would welcome some help. > >        http://shed-skin.blogspot.com/ People? It's one guy. It apparently started out as a Master's thesis as well. ;) I am a great admirer of the Shed Skin project, and I would be as happy as anyone

Re: a splitting headache

2009-10-21 Thread John Yeung
On Oct 21, 5:43 pm, Mensanator wrote: > >>> '01110'.split('0') > > ['', '1', '', '', '', '11', ''] > > is a perfect example. It shows the empty strings > generated from the leading and trailing delimiters, > and also that you get 3 empty strings between the > '1's, not 4. When creating docume

Re: mktime, how to handle dates before 01-01-1970 ?

2009-10-08 Thread John Yeung
On Oct 6, 4:10 pm, Stef Mientki wrote: > > thanks guys, > mx works a bit better   Another popular Python date library is dateutil: http://labix.org/python-dateutil It gives a certain amount of credit to mxDateTime (praising it but not being very clear how they are related; there is some m

Re: mktime, how to handle dates before 01-01-1970 ?

2009-10-08 Thread John Yeung
On Oct 6, 5:11 pm, Christian Heimes wrote: > Ben Finney wrote: > > If you're committed to changing the epoch anyway, I would recommend > > using http://en.wikipedia.org/wiki/Astronomical_year_numbering> > > (epoch at 4004 BCE) since it is widely used to unify dates referring to > > human history.

Re: Enormous Input and Output Test

2009-10-07 Thread John Yeung
On Oct 7, 4:35 pm, Irmen de Jong wrote: > I just got my solution accepted, it ran in 14 seconds though. Hey, that's pretty good. Until n00m instigated the most recent INOUTEST craze, the only accepted answer besides numerix's was one that barely squeaked in at 19.81s, and that result was achieve

Re: Enormous Input and Output Test

2009-10-04 Thread John Yeung
On Oct 4, 4:20 am, n00m wrote: > I've given up :-) Well, that numerix user (who already had the top Python solution) just submitted a ton of new ones to that problem, apparently trying to get a faster time. I don't think he can squeeze much more out of that stone, but unlike us, he's routinely u

Re: Enormous Input and Output Test

2009-10-04 Thread John Yeung
On Oct 4, 1:50 am, n00m wrote: > It can be not so "simple". > There can be multiple input files, > with *total* size ~30-50-80 MB. According to one of the global moderators, the 20s time limit is for each input file: https://www.spoj.pl/forum/viewtopic.php?f=6&t=4667 John -- http://mail.pyth

Re: Enormous Input and Output Test

2009-10-03 Thread John Yeung
On Oct 3, 11:58 pm, n00m wrote: > > Do you know how big the input data set actually is? > > Of course, I don't know exact size of input. > It's several MBs, I guess. And mind the fact: > their testing machines are PIII (750MHz). You know the maximum size of the input, if you can trust the problem

Re: Simple if-else question

2009-09-29 Thread John Yeung
On Sep 29, 1:25 pm, MRAB wrote: > The example that makes it clearest for me is searching > through a list for a certain item and breaking out of > the 'for' loop if I find it. If I get to the end of the > list and still haven't broken out then I haven't found > the item, and that's when the else

Re: Simple if-else question

2009-09-29 Thread John Yeung
On Sep 29, 1:15 pm, Carl Banks wrote: > Hmm, I wonder if Python should emit a warning if an else is > used on a for block with no break inside.  I don't think the > else can be invoked in any other way.  As a bonus it could > catch some cases where people mistakenly use it thinking it > will execu

Re: Am I doing this wrong? Why does this seem so clumsy (time, datetime vs. DateTime)

2009-09-19 Thread John Yeung
On Sep 19, 10:57 pm, Carl Banks wrote: > On Sep 19, 7:22 pm, Schif Schaf wrote: > > > I *wanted* to just use time.mktime(), but it wouldn't > > work unless I could specify the *complete* time tuple > > value (who would have all that handy?!). > > Was it really that hard to add a few zeros to the

Re: Using freeze.py's output and compiling in Windows

2009-09-10 Thread John Yeung
On Sep 10, 7:53 am, "Di Biase, Paul A CIV NAVAIR, 4.4" wrote: > I'd like another avenue besides using > py2exe as a bundling tool. > > This lead me to looking at freeze.py. Judging by the wiki page (http://wiki.python.org/moin/Freeze) and some other miscellaneous Googling, it would seem freeze is

Re: Evil trend report

2009-09-07 Thread John Yeung
On Sep 6, 4:27 am, Steven D'Aprano wrote: > Why aren't you including Yahoo search in your test? > (It has a much bigger market share than MSN, even > rebranded as Bing). Microsoft acquired Yahoo! at the end of July. I would think Yahoo! search is powered by Bing by now. John -- http://mail.pyt

Re: string find mystery

2009-09-02 Thread John Yeung
On Sep 3, 1:45 am, Sean DiZazzo wrote: > string.find() returns the index at which the given word is found > within the string.  If the string is not found it returns -1.  So, no > matter what you do, string.find() will evaluate to "True" It will evaluate as false if the substring is found at the

Re: string find mystery

2009-09-02 Thread John Yeung
On Sep 3, 1:10 am, Helvin wrote: >         if file_str.find('Geometry'): >         #if file_str.endswith('Data_Input_Geometry.txt'): >             print 'I found geometry' > The amazing thing is when file_str  = 'C:\Qt\SimLCM\Default > \Data_Input_Material.txt', > the first if statement if fulfill

Re: csv module and None values

2009-08-24 Thread John Yeung
On Aug 24, 5:00 pm, Peter Otten <__pete...@web.de> wrote: > If I understand you correctly the csv.writer already does > what you want: > > >>> w.writerow([1,None,2]) > 1,,2 > > just sequential commas, but that is the special treatment. > Without it the None value would be converted to a string > an

Re: csv module and None values

2009-08-24 Thread John Yeung
On Aug 24, 1:30 pm, JKPeck wrote: > I'm trying to get the csv module (Python 2.6) to write data > records like Excel.  The excel dialect isn't doing it.  The > problem is in writing None values.  I want them to result > in just sequential commas - ,, but csv treats None specially, > as the doc say

Re: Code formatting question: conditional expression

2009-08-18 Thread John Yeung
On Aug 18, 1:25 pm, John Posner wrote: > BTW, from the (admittedly few) responses to my original > post, it seems there's some sentiment that "conditional > expressions" are a non-Pythonic misfeature. Interesting ... Well, it's not like Guido was especially eager to add it in the first place. I

Re: off topic: google groups sucks?

2009-08-17 Thread John Yeung
On Aug 17, 12:41 pm, Aaron Watters wrote: > I'm having better luck now using the advanced search option > with queries like > >    gadfly group:comp.lang.python > > The "search this group" feature still needs fixing, however. Thanks, Aaron, for confirming that it's not just me! I've been noticin

Re: Splitting on '^' ?

2009-08-16 Thread John Yeung
On Aug 16, 1:09 pm, kj wrote: > And .splitlines seems to be able to handle all > "standard" end-of-line markers without any special > direction (which, ironically, strikes > me as a *little* Perlish, somehow): It's Pythonic. Universal newline-handling for text has been a staple of Python for as

Re: possible to round number and convert to string?

2009-07-31 Thread John Yeung
On Jul 31, 6:17 pm, "Dr. Phillip M. Feldman" wrote: > I'd like to be able to convert a float to a > string representation in which the number is > rounded to a specified number of digits.  If > num2str is a hypothetical function that does > this, then num2str(pi,3) would be '3.142' > (not '3.141')

Re: Download the "head" of a large file?

2009-07-27 Thread John Yeung
On Jul 27, 4:38 pm, erikcw wrote: > I'm trying to figure out how to download just the first few lines of a > large (50mb) text file form a server to save bandwidth.  Can Python do > this? > > Something like the Python equivalent of curlhttp://url.com/file.xml| > head -c 2048 urllib.urlopen gives

Re: Removing newlines from string on windows (without replacing)

2009-07-26 Thread John Yeung
On Jul 26, 1:13 pm, Tom wrote: > The thing that was messing it up was that the endlines are handled > differently on each each OS, so I changed the code to strip the > endlines to be: > >     if os.name == "nt": >         s = sauce.rstrip("\r\n") >     else: >         s = sauce.replace("\n", "")

Re: pack an integer into a string

2009-07-24 Thread John Yeung
On Jul 24, 7:16 pm, superpollo wrote: > thanks a lot, but [struct] does not work for large integers: Since the struct module is designed specifically for C-style structs, it's definitely not going to handle arbitrary-length integers on its own. You could chop up your Python (long) integer into C

Re: tough-to-explain Python

2009-07-07 Thread John Yeung
On Jul 7, 8:06 pm, Ben Finney wrote: > I have got very good results from teaching using > the analogy of “paper tags tied to physical objects” > to describe Python's references to values. Ah, I like that! I think it's better than what I used in my post (which I composed and submitted before your

Re: tough-to-explain Python

2009-07-07 Thread John Yeung
On Jul 7, 5:11 pm, kj wrote: > I don't plan to present these examples to them. > But beginners have a way of bumping into such > conundrums all on their own [...].  I doubt that > an answer of the form "don't worry your pretty > little head over this now; wait until your second > course" will do t

Re: question of style

2009-07-03 Thread John Yeung
On Jul 3, 4:50 pm, Paul Rubin wrote: > I wouldn't say Python's None is terrible, but the > programming style in which None is used as a marker > for "absent value" is genuinely a source of bugs, > requiring care when used.  Often it's easy to just > avoid it and all t

Re: Question about None

2009-06-13 Thread John Yeung
On Jun 13, 5:22 pm, "Rhodri James" wrote: > Such an understanding would be clearly wrong in the context > in which we were talking (and denotational semantics is a > branch of category theory, which is not specific to computer > science if you don't mind).  If None is nothing, then it can't > be a

Re: Perl's @foo[3,7,1,-1] ?

2009-06-13 Thread John Yeung
On Jun 13, 3:59 pm, Arnaud Delobelle wrote: > kj writes: > > Are these the most idiomatically pythonic forms?  Or am > > I missing something better? > > You're missing operator.itemgetter: > > >>> from operator import itemgetter > >>> foo = "spam & eggs" > >>> itemgetter(3, 7, 1, -1)(foo) > > ('m

Re: Question about None

2009-06-13 Thread John Yeung
On Jun 13, 1:49 pm, Paul Rubin <http://phr...@nospam.invalid> wrote: > John Yeung writes: > > Because you might want None to behave as though it were > > nothing at all. > > Sure, you might also want strings to behave as if they > were ints, but wishing doesn'

Re: Question about None

2009-06-13 Thread John Yeung
On Jun 13, 2:29 am, Steven D'Aprano wrote: > Paul LaFollette wrote: > > 3) (this is purely philosophical but I am curious) > > Would it not be more intuitive if > > isinstance(None, ) returned true? > > Good grief no!!! > > None is an object. It has a type, NoneType. It's *not* a > string, or a fl

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread John Yeung
On Jun 10, 1:52 am, Steven D'Aprano wrote: > On Tue, 09 Jun 2009 22:21:26 -0700, John Yeung wrote: > > Therefore, to me the most up-to-date docs (which say > > that uniform(a, b) returns a float in the closed > > interval [a, b]) is closer to correct than before, > &

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread John Yeung
On Jun 10, 12:01 am, alex23 wrote: > On Jun 10, 11:32 am, John Yeung wrote: > > > On Jun 9, 8:39 pm, Paul McGuire wrote: > > > Are you trying to generate a number in the > > > range [0,n] by multiplying a random function that > > > returns [0,1] * n?  If s

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread John Yeung
On Jun 9, 11:24 pm, Steven D'Aprano wrote: > On Tue, 09 Jun 2009 18:28:23 -0700, John Yeung wrote: > > The docs are now... sort of correct.  For some values of a and b, > > uniform() can never return b.  Notably, I believe uniform(0, 1) is > > equivalent to random(

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread John Yeung
On Jun 9, 8:39 pm, Paul McGuire wrote: > Are you trying to generate a number in the > range [0,n] by multiplying a random function that > returns [0,1] * n?  If so, then you want to do > this using: int(random.random()*(n+1))  This will > give equal chance of getting any number from 0 to n. Bette

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread John Yeung
On Jun 9, 8:45 pm, Mensanator wrote: > On Jun 9, 6:05 pm, "Gabriel Genellina" wrote: > > py> a+(b-a)*z < b # the expression used for uniform(a,b) > > False > > py> a+(b-a)*z > > 11.0 > > What you do with the number after it's created is not > random's concern. Mensanator, you missed Gabriel's po

Re: Printing list/tuple elements on separate lines

2009-06-04 Thread John Yeung
On Jun 4, 8:37 pm, Johnny Chang wrote: > I have a large list of strings that I am unpacking > and splitting, and I want each one to be on a new line. > > An example: > > recs = > 'asdfasdfasdfasdfasdf','asdfasdfasdfasdfasdf','asdfasdfasdfasdfasdf' > [(rec.split('f')) for rec in recs] > > output: >

Re: What text editor is everyone using for Python

2009-05-27 Thread John Yeung
On May 27, 2:09 pm, Stef Mientki wrote: > John Yeung wrote: > > > I kind of marvel at how few people complain about [SciTE's] > > Python indentation.  (I'd like to think it's because anyone > > who edits Python code in SciTE has downloaded my patch, but

Re: What text editor is everyone using for Python

2009-05-26 Thread John Yeung
On May 26, 9:43 am, Mel wrote: >  SciTE > I like one big uncomplicated window, tabbed file panes, > syntax coloring and help with indentation.  There's > nothing to it I hate.  It would be nice if > customization were easier. This is a decent summary of SciTE, but I kind of marvel at how few peo

Re: What text editor is everyone using for Python

2009-05-25 Thread John Yeung
On May 25, 4:28 pm, Roy Smith wrote: > > I'm confused.  You put emacs and vi in the same paragraph > and then expect the conversation to remain civil? :-) I know! He is really asking a lot! Ultimately, I think if you are comfortable with vi, stick with vi. There are plenty of people who are usi

Re: Is there a better way to chose a slice of a list?

2009-05-09 Thread John Yeung
On May 8, 3:03 pm, walterbyrd wrote: > This works, but it seems like there should be a better way. > > -- > week = ['sun','mon','tue','wed','thu','fri','sat'] > for day in week[week.index('tue'):week.index('fri')]: >    print day > --- I think you should provide much more

Re: Code works fine except...

2009-05-07 Thread John Yeung
On May 7, 8:32 pm, Ross wrote: > I've managed to solve the problem. If you go in > order, the discrepancy between the player with the > least amount of byes and the greatest amount of byes > is only 1. I don't mean to rain on your parade, but that's not the case for all values. For example, with

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 7, 12:30 am, Ross wrote: > > If I were to set up a dictionary that counted players used in the bye > list and only allowed players to be added to the bye list if they were > within 2 of the least used player, would this be a good approach for > managing bye selection or would using a dictio

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 6, 3:29 am, MRAB wrote: > I have the feeling that if the number of rounds is restricted then the > difference between the minimum and maximum number of byes could be 2 > because of the requirement that players shouldn't play each other more > than once, meaning that the players have to be

Re: list comprehension question

2009-05-06 Thread John Yeung
On May 5, 11:36 pm, alex23 wrote: > Apart from the presence of 'item' at the beginning of the > list comprehension as opposed to 'b.append(item)' at the > end of the for-loop, how exactly does the listcomp force > you to "bounce [..] back and forth" to follow the logic? It's precisely the fact t

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 5, 10:49 am, Ross wrote: > I'm interested to see what you did. From your description, > it sounds like I've tried what you've done, but when I > implemented my version, it took minutes to evaluate for > bigger numbers. If that isn't the case with yours, I'd be > interested in seeing your im

Re: Code works fine except...

2009-05-05 Thread John Yeung
On May 5, 11:37 pm, Ross wrote: > On May 5, 10:33 am, MRAB wrote: > > > Here's my approach (incomplete): > > FYI... I was testing your code further and discovered a strange > outcome... when there are 16 people for 7 courts, every 7th > round your code produces 4 byes instead of the correct 2 by

Re: Code works fine except...

2009-05-05 Thread John Yeung
On May 5, 1:12 am, John Yeung wrote: > [...] the problem may require bigger guns (either much better > math or much more sophisticated programming). Yes, I'm responding to myself. Well, I went ahead with the approach I mentioned earlier, generating all possible matches and then sele

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 11:01 pm, Ross wrote: > Anyways, I'm new to > programming and this has been a good learning experience. I'm glad that you've been trying, and seem to be sticking it out despite sometimes getting negative feedback here. > Next time around, I'll be sure to thoroughly comment > my code be

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 8:56 pm, Ross wrote: > Anyways, you're right that seq[0] is always evaluated. > That's why my algorithm works fine when there are odd > numbers of players in a league. It doesn't work fine for all odd numbers of players. For example, 15 players on 3 courts should result in 5 byes. Bu

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 10:01 am, Ross wrote: > The "magic numbers" that everyone is wondering about are > indeed used for spreading out the bye selection and I got > them by simply calculating a line of best fit when plotting > several courts: byes ratios. But that doesn't really help you. When you do seq[::

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 11:29 pm, Chris Rebert wrote: > Probably not the cause of the problem, but where > did the magic numbers 1.072 and 1.08 come from? It is perhaps not the most direct cause of the problem, in the sense that the magic numbers could take various values and the problem would still be there.

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 10:36 pm, Ross wrote: > def round_robin(players, rounds): [snip] > > def test_round_robin(players, rounds, courts, doubles = False): >     players = range(players) >     for week in round_robin(players,rounds,courts): [snip] First things first: I take it the call to round_robin is on

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread John Yeung
On Apr 25, 9:05 pm, Mark Wooding wrote: > Carl Banks writes: > > Graham, for his part, doesn't seem to appreciate that > > what he does is beyond hope for average people, and > > that sometimes reality requires average people to write > > programs. > > I think he understands that perfectly well.

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread John Yeung
On Apr 25, 2:06 am, Carl Banks wrote: > In answering the recent question by Mark Tarver, I think I finally hit > on why Lisp programmers are the way they are (in particular, why they > are often so hostile to the "There should only be one obvious way to > do it" Zen). I don't get that impression

Re: best way to compare contents of 2 lists?

2009-04-23 Thread John Yeung
Esmail wrote: > What is the best way to compare the *contents* of two different > lists regardless of their respective order? The lists will have > the same number of items, and be of the same type. "Best" can mean different things. Fastest? Shortest code? Most readable? > David Robinow wrote

Re: Definition of Pythonic?

2009-04-11 Thread John Yeung
On Apr 11, 10:08 am, Emmanuel Surleau wrote: > Having written a few trivial scripts in Python, I'm curious as > to how you would sum up the Pythonic philosophy of development. A couple of others have already mentioned the Zen of Python, available at the Python command prompt. I would agree with

Re: Unsupported operand types in if/else list comprehension

2009-04-10 Thread John Yeung
On Apr 10, 5:07 pm, Mike H wrote: > From playing around with other examples, I get the feeling > that Python is calculating both values (inst and '"'+inst+'"') > before selecting which one to pass to the new list. Am I right? I believe so. (I'm sure the experts here will tell you more definitive

Re: Q: "Best" book for teaching

2009-04-08 Thread John Yeung
On Apr 6, 10:37 am, grkunt...@gmail.com wrote: > I am considering teaching an "introduction to programming" > course for continuing education adults at a local community > college. These would people with no programming experience, > but I will require a reasonable facility with computers. > > What

Re: cProfile.py not found.

2009-04-04 Thread John Yeung
I believe cProfile was added in 2.5. Your best bet on 2.4 is probably the profile module. That is what the docs recommend. John -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Goes Mercurial

2009-03-31 Thread John Yeung
Lawrence D'Oliveiro and andrew cooke exchanged: > >>> So what were these "strong antipathies" towards Git, exactly? > > >> compared to what i've read on dev > >> "strong antipathies" sounds a bit over-hyped. > > > That was the phrase used by GvR. > > well if you find any, please do report back. A

Re: PyFits for Windows?

2009-03-28 Thread John Yeung
On Mar 28, 4:03 pm, Michiel Overtoom wrote: > W. eWatson wrote: > > It looks like PyFits downloads are for Linux. > > Isn't there anything available for Win (xp)? > > To install it, unpack the tar file and > type: python setup.py install" > > It looks like PyFits is platform-independent. Perhaps

Re: What's the difference between generating a value and returning a value?

2009-03-23 Thread John Yeung
On Mar 23, 6:12 pm, grocery_stocker wrote: > So what's the difference between generating a value and returning a > value? I agree with Alan's first thought, which is that no distinction was intended. In my opinion, it's especially poor form to use the term "generate" in that context when the lan

Re: How to add months to a date (datetime object)?

2009-03-15 Thread John Yeung
On Mar 15, 7:26 pm, Chris Rebert wrote: > [...] the point is that there are likewise reasonable usecases > for the other behaviors too and one should refuse to guess in > the face of ambiguity; the std lib has, merely by default in > this case, taken this to the extreme of not implementing any > o

Re: How to add months to a date (datetime object)?

2009-03-15 Thread John Yeung
On Mar 15, 6:25 pm, John Machin wrote: > A couple of issues here: > > (1) The number of days in a month is not a constant, so "a > mathematician's sense of logic" is quite irrelevant. It's relevant in the sense that some commenters on this thread seem to want to apply some semblance of mathematic

Re: How to add months to a date (datetime object)?

2009-03-15 Thread John Yeung
On Mar 15, 3:10 pm, Casey Webster wrote: > The example you give does have fairly obvious logic. But how does it > handle Feb 28th, 2009 + 3 months?  To me, there are two "obvious" > answers: May 28th, 2009 or May 31st, 2009.  The question is intent; is > Feb 28th an arbitrary day of the month, or

Re: Question on periods in strings

2009-03-11 Thread John Yeung
On Mar 11, 9:42 pm, "Philip Bloom" wrote: > #test A > #runs in 5.8 seconds. > from datetime import datetime > testvar2='9a00' > startTime = datetime.now() > filehandle=open('testwriting.txt','w') > for var in range(1000): >     filehandle.write(testvar2) > filehandle.close() > print (datetime.

Re: special editor support for indentation needed.

2008-11-16 Thread John Yeung
On Nov 15, 8:50 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > well, therein lies the rub.  I don't know lisp, > I don't know Emacs internals let alone python mode. Unfortunately, neither do I. Actually, I haven't touched Emacs since my college days, and barely remember any of it. I figure

Re: special editor support for indentation needed.

2008-11-15 Thread John Yeung
This is such a fascinating and compelling thread that it has pulled me out of lurker mode. Eric, I would like to say I also admire your initiative, but even more so your patience. You seem to handle comments of all types gracefully. Perhaps it comes from working with speech recognition so much.