Re: Rounding a number to nearest even
Thomas Dybdahl Ahle wrote: On Fri, 2008-04-11 at 03:14 -0700, bdsatish wrote: The built-in function round( ) will always round up, that is 1.5 is rounded to 2.0 and 2.5 is rounded to 3.0. If I want to round to the nearest even, that is my_round(1.5) = 2# As expected my_round(2.5) = 2# Not 3, which is an odd num I'm interested in rounding numbers of the form x.5 depending upon whether x is odd or even. Any idea about how to implement it ? This seams to work fine: evenRound = lambda f: round(f/2.)*2 [(f*.5, evenRound(f*.5)) for f in xrange(0,20)] [(0.0, 0.0),(0.5, 0.0), (1.0, 2.0), (1.5, 2.0), (2.0, 2.0), (2.5, 2.0), (3.0, 4.0), (3.5, 4.0), (4.0, 4.0), (4.5, 4.0), (5.0, 6.0), (5.5, 6.0), (6.0, 6.0), (6.5, 6.0), (7.0, 8.0), (7.5, 8.0), (8.0, 8.0), (8.5, 8.0), (9.0, 10.0), (9.5, 10.0)] No, this does not work: [(f*.25, evenRound(f*.25)) for f in xrange(0,20)] [(0.0, 0.0), (0.25, 0.0), (0.5, 0.0), (0.75, 0.0), (1.0, 2.0), (1.25, 2.0), (1.5, 2.0), (1.75, 2.0), (2.0, 2.0), (2.25, 2.0), (2.5, 2.0), (2.75, 2.0), (3.0, 4.0), (3.25, 4.0), (3.5, 4.0), (3.75, 4.0), (4.0, 4.0), (4.25, 4.0), (4.5, 4.0), (4.75, 4.0)] x.75 should be rounded up. -- Sjoerd Mullender signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Is massive spam coming from me on python lists?
On 2008-04-21 08:01, Brian Vanderburg II wrote: I've recently gotten more than too many spam messages and all say Sender: [EMAIL PROTECTED] I'm wondering if my mail list registration is now being used to spam myself and others. If so, sorry, but I'm not the one sending messages if other are getting them even though Sender seems to include my address (I'm not sure about mail headers so I don't know how From: is different than Sender:) Anyway, it seems to be a bunch of spam emails about cracks and stuff. Brian Vanderburg II That is just mailman (the mailing list software) keeping track of things. If there were a bounce, mailman can determine from the address of the bounce message (the bounce gets sent back to the Sender, not the From) which address bounced. So *all* python-list messages you get have that Sender. In other words, these spams do not come from you. -- Sjoerd Mullender -- http://mail.python.org/mailman/listinfo/python-list
Re: Is massive spam coming from me on python lists?
Torsten Bronger wrote: Hallöchen! Sjoerd Mullender writes: On 2008-04-21 08:01, Brian Vanderburg II wrote: I've recently gotten more than too many spam messages and all say Sender: [EMAIL PROTECTED] [...] That is just mailman (the mailing list software) keeping track of things. By the way, why does mailman change the Message-IDs when tunneling postings to the newsgroup? This destroys the thread structure. I have no idea. There is no setting in the mailman administration interface that I can see that influences this. Perhaps submit this as a bugreport to mailman? -- Sjoerd Mullender signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Gateway to python-list is generating bounce messages.
Grant Edwards [EMAIL PROTECTED] writes: Could whoever is responsible for the gateway that is grabbing my postings off of Usenet and e-mailing them out please fix the headers in the mail messages so that I don't get the bounce messages? While you're at it, might as well fix it for everybody else too. ;) Its a bit rude to send out mass e-mail messages with headers faked up so that the bounce messages go to somebody else. Messages you submit to the newsgroup are forwarded to the mailing list. When mail messages bounce, the MTA (Message Transfer Agent--the program that handles mail) *should* send the bounce message to whatever is in the Sender header, and only if that header does not exist, should it use the From header. Messages forwarded by the gateway get a Sender header which points back to the gateway. In other words, if a message gets bounced back to the From address, the MTA does it incorrectly. There is nothing the list administrator can do about it. You can try complaining to the postmaster of the bouncing system, but that's about it. In other words, your question in the first paragraph is already implemented and was implemented from the beginning. It is not the gateway's fault that there are systems that don't follow the standards. -- Sjoerd Mullender, python-list administrator -- http://mail.python.org/mailman/listinfo/python-list
test, please ignore
This is a test message from your mailing list administrator. Please ignore. -- Sjoerd Mullender -- http://mail.python.org/mailman/listinfo/python-list
Re: removing a post
You need to put this request to postmas...@python.org. As mailing list administrator I have no access to the archives. On 2009-09-26 05:32, Mike L wrote: hello could you remove this old post, off topic and spam http://www.mail-archive.com/python-list@python.org/msg175722.html thank you We are your photos. Share us now with Windows Live Photos. http://go.microsoft.com/?linkid=9666045 -- Sjoerd Mullender -- http://mail.python.org/mailman/listinfo/python-list
Re: regex question on .findall and \b
On 2009-07-02 18:38, Ethan Furman wrote: Greetings! My closest to successfull attempt: Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python. In [161]: re.findall('\d+','this is test a3 attempt 79') Out[161]: ['3', '79'] What I really want in just the 79, as a3 is not a decimal number, but when I add the \b word boundaries I get: In [162]: re.findall('\b\d+\b','this is test a3 attempt 79') Out[162]: [] What am I missing? ~Ethan~ Try this: re.findall(r'\b\d+\b','this is test a3 attempt 79') ['79'] The \b is a backspace, by using raw strings you get an actual backslash and b. -- Sjoerd Mullender -- http://mail.python.org/mailman/listinfo/python-list
Re: zip codes
Martin P. Hellwig wrote: Shailen wrote: Is there any Python module that helps with US and foreign zip-code lookups? I'm thinking of something that provides basic mappings of zip to cities, city to zips, etc. Since this kind of information is so often used for basic user-registration, I'm assuming functionality of this sort must be available for Python. Any suggestions will be much appreciated. There might be an associated can of worms here, for example in the Netherlands zip codes are actually copyrighted and require a license if you want to do something with them, on the other hand you get a nice SQL formatted db to use it. I don't know how this works in other countries but I imagine that it is likely to be generally the same. Also in The Netherlands, ZIP codes are much more fine-grained than in some other countries: ZIP code plus house number together are sufficient to uniquely identify an address. I.e. you don't need the street name. E.g., my work address has ZIP code 1098 XG and house number 123, so together they indicate that I work at Science Park 123, Amsterdam. In other words, a simple city - ZIP mapping is not sufficient. -- Sjoerd Mullender signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
[issue4591] uid/gid problem in os.chown
New submission from Sjoerd Mullender [EMAIL PROTECTED]: On Fedora 8 and 10 using Python 2.5.1 and 2.5.2 (64 bit): $ grep nfsnobody /etc/passwd nfsnobody:x:4294967294:4294967294:Anonymous NFS User:/var/lib/nfs:/sbin/nologin So the UID of nfsnobody is 4294967294 (-2 if viewed as signed 32-bit int). import pwd, os print pwd.getpwnam('nfsnobody').pw_uid 4294967294 os.chown('some file', pwd.getpwnam('nfsnobody').pw_uid, pwd.getpwnam('nfsnobody').pw_gid) Traceback (most recent call last): File stdin, line 1, in module OverflowError: signed integer is greater than maximum The reason for this error is that os.chown uses the i format to convert the second and third arguments. But the valued do not fit in a 32-bit signed integer. uid_t and gid_t are defined as unsigned quantities on this system. The bug does not occur on 32 bit Fedora since there the uid and gid of nfsnobody are 65534. -- components: Library (Lib) messages: 77301 nosy: sjoerd severity: normal status: open title: uid/gid problem in os.chown type: behavior versions: Python 2.5 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4591 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4591] uid/gid problem in os.chown
Sjoerd Mullender [EMAIL PROTECTED] added the comment: I'm sure you meant 2^32-2 ;-). The fix to use long doesn't seem right to me either. unsigned int is a better match with uid_t and gid_t. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4591 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7966] mhlib uses deprecated module
Sjoerd Mullender sjo...@acm.org added the comment: What's difficult about just doing: import mhlib ? That's all it takes to get the warning. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7966 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7966] mhlib does not emit deprecation warning
Sjoerd Mullender sjo...@acm.org added the comment: mhlib is not officially deprecated, if I may believe PEP 4. Therefore I do not agree with the change that was made to this bug report. As far as I am concerned, the bug remains that mhlib uses a deprecated module. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7966 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8090] PEP 4 should say something about the standard library
New submission from Sjoerd Mullender sjo...@acm.org: When a module or feature is deprecated, all uses of the deprecated module/feature should be removed from the non-deprecated part of the distribution (and, I would argue, also from the other deprecated modules). I think PEP 4 should say something to this effect. I suggest adding a sentence to the section Procedure for declaring a module deprecated, something like: The proposal MUST include patches to remove any use of the deprecated module from the standard library. -- assignee: georg.brandl components: Documentation messages: 100671 nosy: georg.brandl, sjoerd severity: normal status: open title: PEP 4 should say something about the standard library ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8090 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8090] PEP 4 should say something about the standard library
Sjoerd Mullender sjo...@acm.org added the comment: It was discussed on python-dev. It was suggested to submit a bug report on PEP 4. See http://mail.python.org/pipermail/python-dev/2010-February/097772.html. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8090 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3216] errors in msilib documentation
New submission from Sjoerd Mullender [EMAIL PROTECTED]: There are several errors in the msilib documentation. I'm sure I haven't found them all, but here are some: - add_data is documented to have two arguments. In reality it has three. - Execute on a View object is documented to have an optional argument. In reality it has a single required argument whose value may be None. - When I click on any of the references to Microsoft documentation, I get a page in Japanese. This is possibly more due to Microsoft than anything else (the links do contain en-us so it is a tad surprising). - There is extremely little information on how to actually use the module. -- assignee: georg.brandl components: Documentation messages: 68831 nosy: georg.brandl, sjoerd severity: normal status: open title: errors in msilib documentation versions: Python 2.5 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3216 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3216] errors in msilib documentation
Sjoerd Mullender [EMAIL PROTECTED] added the comment: Today the links to Microsoft documentation go to English language pages, so that part of the bug report can be skipped. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3216 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2245] aifc cannot handle unrecognised chunk type CHAN
Sjoerd Mullender sjo...@acm.org added the comment: I wrote the module 16 years ago, but haven't done anything with AIFF files for probably at least 10, so I can't really comment on the merits of the two solutions (delete _skiplist or add CHAN to _skiplist). I'm fine with either. However, the proposed patch leaves an `else: pass' which should be removed if the patch is adopted. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2245 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com