[issue33083] math.factorial accepts non-integral Decimal instances

2018-03-15 Thread John Yeung
Change by John Yeung <gallium.arsen...@gmail.com>: -- nosy: +John.Yeung ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33083> ___

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. --

[issue25735] math.factorial doc should mention integer return type

2015-11-25 Thread John Yeung
New submission from John Yeung: The math module docs state Except when explicitly noted otherwise, all return values are floats. But math.factorial isn't what I would call explicit about returning int: math.factorial(x) Return x factorial. Raises ValueError if x is not integral

[issue20987] Python for AS/400 (OS/400) is actually 2.7

2014-03-19 Thread John Yeung
New submission from John Yeung: Not sure if this is the right place to report this, but the other platforms page https://www.python.org/download/other/ says the AS/400 port by Per Gummedal is 2.5. While it's true that he did port 2.5 quite a while back, the 2.7 port has been available for 3

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 lada...@my-deja.com wrote: On Dec 6, 1:42 pm, Terry Reedy tjre...@udel.edu 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

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

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 affdfsdfds...@b.com 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

Re: importing excel data into a python matrix?

2010-09-02 Thread John Yeung
On Sep 1, 7:45 pm, Chris Rebert c...@rebertia.com wrote: On Wed, Sep 1, 2010 at 4:35 PM, patrick mcnameeking pmcnameek...@gmail.com 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.  

Re: Why Python3

2010-06-29 Thread John Yeung
On Jun 28, 1:58 pm, OKB (not okblacke) brennospamb...@nobrenspambarn.net 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.

Re: Help running Windows programs from Python

2010-05-07 Thread John Yeung
On May 7, 3:14 pm, Scott scott.freem...@gmail.com 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

Re: using python2.6 on windows without installation

2010-04-29 Thread John Yeung
On Apr 29, 4:32 pm, Terry Reedy tjre...@udel.edu 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 --

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

2010-04-20 Thread John Yeung
On Apr 20, 1:23 am, Cameron Simpson c...@zip.com.au wrote: On 19Apr2010 21:31, alex23 wuwe...@gmail.com wrote: | Cameron Simpson c...@zip.com.au wrote: |   If items(), keys(), values(), iteritems(), iterkeys(), and |   itervalues() are called with no intervening modifications to the |  

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

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 fragile and implementationy to me, as I'm sure

Re: help with Python installation

2010-02-28 Thread John Yeung
On Feb 28, 12:51 am, gujax rjngrj2...@gmail.com 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

Re: TypeError Exception in email lib

2010-02-15 Thread John Yeung
On Feb 15, 2:54 pm, BJ Swope bigbluesw...@gmail.com 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,

Re: TypeError Exception in email lib

2010-02-15 Thread John Yeung
On Feb 15, 3:59 pm, John Yeung gallium.arsen...@gmail.com 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

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

2010-01-16 Thread John Yeung
On Jan 15, 7:40 pm, W. eWatson wolftra...@invalid.com 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

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 aioe@technicalbloke.com 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

Re: combinatorics via __future__ generators

2009-12-01 Thread John Yeung
On Dec 1, 5:55 pm, Phlip phlip2...@gmail.com 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

Re: 2.6 and sys.exit()

2009-11-12 Thread John Yeung
On Nov 12, 11:22 pm, r rt8...@gmail.com wrote: On Nov 12, 10:07 pm, hetchkay hetch...@gmail.com 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:

Re: 2.6 and sys.exit()

2009-11-12 Thread John Yeung
On Nov 12, 11:32 pm, hetchkay hetch...@gmail.com 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

Re: Cpython optimization

2009-10-21 Thread John Yeung
On Oct 22, 12:28 am, John Nagle na...@animats.com 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

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

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

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

2009-10-08 Thread John Yeung
On Oct 6, 4:10 pm, Stef Mientki stef.mien...@gmail.com 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

Re: Enormous Input and Output Test

2009-10-07 Thread John Yeung
On Oct 7, 4:35 pm, Irmen de Jong irmen.nos...@xs4all.nl 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

Re: Enormous Input and Output Test

2009-10-04 Thread John Yeung
On Oct 4, 1:50 am, n00m n...@narod.ru 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=6t=4667 John --

Re: Enormous Input and Output Test

2009-10-04 Thread John Yeung
On Oct 4, 4:20 am, n00m n...@narod.ru 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,

Re: Enormous Input and Output Test

2009-10-03 Thread John Yeung
On Oct 3, 11:58 pm, n00m n...@narod.ru 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

Re: Simple if-else question

2009-09-29 Thread John Yeung
On Sep 29, 1:15 pm, Carl Banks pavlovevide...@gmail.com 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

Re: Simple if-else question

2009-09-29 Thread John Yeung
On Sep 29, 1:25 pm, MRAB pyt...@mrabarnett.plus.com 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

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 pavlovevide...@gmail.com wrote: On Sep 19, 7:22 pm, Schif Schaf schifsc...@gmail.com 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

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 paul.dibi...@navy.mil 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

Re: Evil trend report

2009-09-07 Thread John Yeung
On Sep 6, 4:27 am, Steven D'Aprano st...@remove-this- cybersource.com.au 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

Re: string find mystery

2009-09-02 Thread John Yeung
On Sep 3, 1:10 am, Helvin helvin...@gmail.com 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

Re: string find mystery

2009-09-02 Thread John Yeung
On Sep 3, 1:45 am, Sean DiZazzo half.ital...@gmail.com 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

Re: csv module and None values

2009-08-24 Thread John Yeung
On Aug 24, 1:30 pm, JKPeck jkp...@gmail.com 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

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 and the line

Re: Code formatting question: conditional expression

2009-08-18 Thread John Yeung
On Aug 18, 1:25 pm, John Posner jjpos...@optimum.net 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

Re: off topic: google groups sucks?

2009-08-17 Thread John Yeung
On Aug 17, 12:41 pm, Aaron Watters aaron.watt...@gmail.com 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!

Re: Splitting on '^' ?

2009-08-16 Thread John Yeung
On Aug 16, 1:09 pm, kj no.em...@please.post 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

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 pfeld...@verizon.net 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'

Re: Download the head of a large file?

2009-07-27 Thread John Yeung
On Jul 27, 4:38 pm, erikcw erikwickst...@gmail.com 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

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

2009-07-26 Thread John Yeung
On Jul 26, 1:13 pm, Tom tom.su...@gmx.com 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 u...@example.net 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

Re: tough-to-explain Python

2009-07-07 Thread John Yeung
On Jul 7, 5:11 pm, kj no.em...@please.post 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

Re: tough-to-explain Python

2009-07-07 Thread John Yeung
On Jul 7, 8:06 pm, Ben Finney ben+pyt...@benfinney.id.au 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

Re: question of style

2009-07-03 Thread John Yeung
On Jul 3, 4:50 pm, Paul Rubin http://phr...@nospam.invalid 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 the bugs

Re: Question about None

2009-06-13 Thread John Yeung
On Jun 13, 2:29 am, Steven D'Aprano st...@removethis.cybersource.com.au wrote: Paul LaFollette wrote: 3) (this is purely philosophical but I am curious) Would it not be more intuitive if isinstance(None, anything at all) returned true? Good grief no!!! None is an object. It has a type,

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 gallium.arsen...@gmail.com 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't make it so. I'm

Re: Question about None

2009-06-13 Thread John Yeung
On Jun 13, 5:22 pm, Rhodri James rho...@wildebst.demon.co.uk 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

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

2009-06-10 Thread John Yeung
On Jun 10, 1:52 am, Steven D'Aprano ste...@remove.this.cybersource.com.au 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 9, 8:45 pm, Mensanator mensana...@aol.com wrote: On Jun 9, 6:05 pm, Gabriel Genellina gagsl-...@yahoo.com.ar 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,

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

2009-06-09 Thread John Yeung
On Jun 9, 8:39 pm, Paul McGuire pt...@austin.rr.com 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

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

2009-06-09 Thread John Yeung
On Jun 9, 11:24 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au 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 10, 12:01 am, alex23 wuwe...@gmail.com wrote: On Jun 10, 11:32 am, John Yeung gallium.arsen...@gmail.com wrote: On Jun 9, 8:39 pm, Paul McGuire pt...@austin.rr.com wrote: Are you trying to generate a number in the range [0,n] by multiplying a random function that returns [0,1

Re: Printing list/tuple elements on separate lines

2009-06-04 Thread John Yeung
On Jun 4, 8:37 pm, Johnny Chang johnny...@gmail.com 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]

Re: What text editor is everyone using for Python

2009-05-27 Thread John Yeung
On May 27, 2:09 pm, Stef Mientki stef.mien...@gmail.com 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 I am confident

Re: What text editor is everyone using for Python

2009-05-26 Thread John Yeung
On May 26, 9:43 am, Mel mwil...@the-wire.com 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

Re: What text editor is everyone using for Python

2009-05-25 Thread John Yeung
On May 25, 4:28 pm, Roy Smith r...@panix.com 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

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 walterb...@iname.com 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

Re: Code works fine except...

2009-05-07 Thread John Yeung
On May 7, 8:32 pm, Ross ross.j...@gmail.com 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.

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 5, 10:49 am, Ross ross.j...@gmail.com 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

Re: list comprehension question

2009-05-06 Thread John Yeung
On May 5, 11:36 pm, alex23 wuwe...@gmail.com 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

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 6, 3:29 am, MRAB goo...@mrabarnett.plus.com 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

Re: Code works fine except...

2009-05-06 Thread John Yeung
On May 7, 12:30 am, Ross ross.j...@gmail.com 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

Re: Code works fine except...

2009-05-05 Thread John Yeung
On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com 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

Re: Code works fine except...

2009-05-05 Thread John Yeung
On May 5, 11:37 pm, Ross ross.j...@gmail.com wrote: On May 5, 10:33 am, MRAB goo...@mrabarnett.plus.com 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

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 10:01 am, Ross ross.j...@gmail.com 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

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 8:56 pm, Ross ross.j...@gmail.com 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

Re: Code works fine except...

2009-05-04 Thread John Yeung
On May 4, 11:01 pm, Ross ross.j...@gmail.com 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

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 10:36 pm, Ross ross.j...@gmail.com 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

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 11:29 pm, Chris Rebert c...@rebertia.com 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

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread John Yeung
On Apr 25, 2:06 am, Carl Banks pavlovevide...@gmail.com 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

Re: Lisp mentality vs. Python mentality

2009-04-25 Thread John Yeung
On Apr 25, 9:05 pm, Mark Wooding m...@distorted.org.uk wrote: Carl Banks pavlovevide...@gmail.com 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

Re: best way to compare contents of 2 lists?

2009-04-23 Thread John Yeung
Esmail ebo...@hotmail.com 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

Re: Definition of Pythonic?

2009-04-11 Thread John Yeung
On Apr 11, 10:08 am, Emmanuel Surleau emmanuel.surl...@gmail.com 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

Re: Unsupported operand types in if/else list comprehension

2009-04-10 Thread John Yeung
On Apr 10, 5:07 pm, Mike H cmh.pyt...@gmail.com 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

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 would

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. Andrew, perhaps you

Re: PyFits for Windows?

2009-03-28 Thread John Yeung
On Mar 28, 4:03 pm, Michiel Overtoom mot...@xs4all.nl 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.

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 cdal...@gmail.com 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

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

2009-03-15 Thread John Yeung
On Mar 15, 3:10 pm, Casey Webster casey...@gmail.com 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

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

2009-03-15 Thread John Yeung
On Mar 15, 6:25 pm, John Machin sjmac...@lexicon.net 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

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

2009-03-15 Thread John Yeung
On Mar 15, 7:26 pm, Chris Rebert c...@rebertia.com 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

Re: Question on periods in strings

2009-03-11 Thread John Yeung
On Mar 11, 9:42 pm, Philip Bloom pbl...@crystald.com 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

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 figured

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.