[ANN] Komodo 7 release (Python development tools)

2012-02-09 Thread Todd Whiteman
Hello, My name is Todd. I'm the lead developer for Komodo IDE (Interactive Development Environment) and Komodo Edit (a free, open-source editor) at ActiveState. I wanted to announce that the newest version, Komodo 7, has been released: http://www.activestate.com/komodo-ide Python has

notmm 0.4.4 released

2012-02-09 Thread Etienne Robillard
Hi, I'm very happy to announce the release of the notmm toolkit version 0.4.4 Never Give Up Never Surrender available via the Python Cheeseshop! :) New features and major changes includes: . Bundled BlogEngine, LibAuthKit, LibSchevo as third-party apps in extras . Improved Cython support up

ANN: eGenix mxODBC Zope Database Adapter 2.0.2

2012-02-09 Thread eGenix Team: M.-A. Lemburg
ANNOUNCEMENT mxODBC Zope Database Adapter Version 2.0.2 for Zope and the Plone CMS Available for Zope 2.10 and later on

ANNOUNCE: PyGTK All-in-one Installer 2.24.2

2012-02-09 Thread Dieter Verfaillie
We are pleased to announce release 2.24.2 of the PyGTK All-in-one installer for Windows. More information can be found in the README file at: http://download.gnome.org/binaries/win32/pygtk/2.24/pygtk-all-in-one.README * What is it? = The PyGTK All-in-one installer provides an

Re: Cycle around a sequence

2012-02-09 Thread Peter Otten
Chris Angelico wrote: On Thu, Feb 9, 2012 at 2:55 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: If your data is humongous but only available lazily, buy more memory :) Or if you have a huge iterable and only need a small index into it, snag those first few entries into a

Re: Cycle around a sequence

2012-02-09 Thread Peter Otten
Mark Lawrence wrote: I'm looking at a way of cycling around a sequence i.e. starting at some given location in the middle of a sequence and running to the end before coming back to the beginning and running to the start place. About the best I could come up with is the following, any better

what is the difference between @property and method

2012-02-09 Thread Zheng Li
class A(object): @properymethod def value1(self): return 'value1' def value2(self): return 'value2' what is the difference between value1 and value2. -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the difference between @property and method

2012-02-09 Thread Devin Jeanpierre
On Thu, Feb 9, 2012 at 3:50 AM, Zheng Li dllizh...@gmail.com wrote: class A(object): @properymethod def value1(self): return 'value1' def value2(self): return 'value2' what is the difference between value1 and value2. There is no such thing as @properymethod

Re: Cycle around a sequence

2012-02-09 Thread Serhiy Storchaka
08.02.12 22:15, Terry Reedy написав(ла): To make a repeating rotator is only a slight adjustment: k = n - len(seq) while True: i = k while i n: yield seq[i] i += 1 for i in range(n, len(seq)): yield seq[i] while True:

Re: Cycle around a sequence

2012-02-09 Thread Chris Angelico
On Thu, Feb 9, 2012 at 7:33 PM, Peter Otten __pete...@web.de wrote: Chris Angelico wrote: def cycle(seq,n):         seq=iter(seq)         lst=[next(seq) for i in range(n)]         try:                 while True: yield next(seq)         except StopIteration:                 for i in lst:

Re: frozendict

2012-02-09 Thread Duncan Booth
Nathan Rice nathan.alexander.r...@gmail.com wrote: I put dicts in sets all the time. I just tuple the items, but that means you have to re-dict it on the way out to do anything useful with it. I am too lazy to write a frozendict or import one, but I would use it if it was a builtin. I

unicode printing on Windows

2012-02-09 Thread BlueBird
Hi, The question is not totally related to Python but there is a strong connection. Everytime that I try to debug some python programs under Windows, I encounter the issue that things printed on the console simply break the program because : 1. My windows console does not support UTF8 2. Things

Re: unicode printing on Windows

2012-02-09 Thread Andrew Berg
On 2/9/2012 4:46 AM, BlueBird wrote: Does anybody know how to fix problem 1 ? That way, I could at least deal with programs that print UTF8 on stdout. I'm pretty sure there isn't a way. cp65001 is supposed to be UTF-8, but it doesn't work in my experience (I fed it some UTF-8 demo text and I got

Re: standalone python web server

2012-02-09 Thread Thomas Bach
Rita rmorgan...@gmail.com writes: I am building a small intranet website and I would like to use Python. I was wondering if there was a easy and medium performance python based web server available. Are you going to use a framework? Most of these ship with a light web server implementation…

Re: Issue with Scrapping Data from a webpage- Noob Question

2012-02-09 Thread anon hung
Hi Fellow Pythoners, I'm trying to collect table data from an authenticated webpage (Tool) to which I have access. I will have the required data after 'click'ing a submit button on the tool homepage. When I inspect the submit button i see form action=/Tool/index.do method=POST Thus the

Read-only attribute in module

2012-02-09 Thread Mateusz Loskot
Hi, I'm implementing Python 3 extension using the Python C API. I am familiar with defining new types, implementing get/set for attributes, etc. I'm wondering, is there any mean to implement attribute in module scope which is read-only? So, the following import xyz print(xyz.flag) # OK

Re: Read-only attribute in module

2012-02-09 Thread Ben Finney
Mateusz Loskot mate...@loskot.net writes: I'm wondering, is there any mean to implement attribute in module scope which is read-only? Python is designed by and for consenting adults. Rather than restricting, instead use conventions to make your intent clear to the user of your library. So,

Re: Can not get the result of query in pymssql module of python...

2012-02-09 Thread Rod Person
On Thu, 9 Feb 2012 12:34:25 +0530 amarjeet yadav amarjeet.j...@gmail.com wrote: Hi All, This is my first post to any mailing group. I am QA engg and using python for testing automation. I need to connect with Mysql (2008) and mssql databases for executing some queries. I have

Re: standalone python web server

2012-02-09 Thread Rita
yes, I would like to use a framework. I like the twisted method the user posted. Are there any examples of it using a framework, get/post, etc..? On Thu, Feb 9, 2012 at 6:28 AM, Thomas Bach thb...@students.uni-mainz.dewrote: Rita rmorgan...@gmail.com writes: I am building a small intranet

Re: Komodo 7 release (Python development tools)

2012-02-09 Thread Rod Person
On Wed, 08 Feb 2012 16:52:50 -0500 Terry Reedy tjre...@udel.edu wrote: On 2/8/2012 3:14 PM, Todd Whiteman wrote: My name is Todd. I'm the lead developer for Komodo IDE (Interactive Development Environment) and Komodo Edit (a free, open-source editor) at ActiveState. I wanted to announce

Re: Id of methods

2012-02-09 Thread bruno.desthuilli...@gmail.com
On Feb 9, 5:06 am, Chris Angelico ros...@gmail.com wrote: On Thu, Feb 9, 2012 at 2:48 PM, Emeka emekami...@gmail.com wrote: My question is why is it that the id of Boo.daf  is different from daf's hex value in the above dict? daf is not a function, it's a special object for an unbound

Software tool for stochastic simulation as well as for the stochastic optimization

2012-02-09 Thread John Oksz
Hello Python World, I am starting work on stochastic approach. I plan to work in decision support field in environmental engineering so I will use both the stochastic simulation as well as the stochastic optimization. I would like to select the best for both approaches software tool. what you

Re: turbogears 1

2012-02-09 Thread Roy Smith
In article mailman.5566.1328763222.27778.python-l...@python.org, anon hung anonh...@gmail.com wrote: Hey guys, someone asked me to maintain his old website, trouble is, it's in python, more trouble is it's in turbogears 1. I'm not fluent in python but all right, I can learn, but this

Re: Naming convention for in-house modules (Newbie question)

2012-02-09 Thread Laurent Claessens
Here is my question: I would like to start an in-house library of small modules to import, for things like error handling/logging. That's easy enough, but is there a recommended way of naming such modules? I am concerned about avoiding name clashes with standard modules and site packages.

Re: frozendict

2012-02-09 Thread Nathan Rice
On Thu, Feb 9, 2012 at 5:33 AM, Duncan Booth duncan.booth@invalid.invalid wrote: Nathan Rice nathan.alexander.r...@gmail.com wrote: I put dicts in sets all the time.  I just tuple the items, but that means you have to re-dict it on the way out to do anything useful with it.  I am too lazy to

Re: Naming convention for in-house modules (Newbie question)

2012-02-09 Thread Arnaud Delobelle
On 9 February 2012 14:00, Laurent Claessens moky.m...@gmail.com wrote: Here is my question: I would like to start an in-house library of small modules to import, for things like error handling/logging. That's easy enough, but is there a recommended way of naming such modules? I am concerned

Re: frozendict

2012-02-09 Thread Duncan Booth
Nathan Rice nathan.alexander.r...@gmail.com wrote: On Thu, Feb 9, 2012 at 5:33 AM, Duncan Booth duncan.booth@invalid.invalid wrote: Nathan Rice nathan.alexander.r...@gmail.com wrote: I put dicts in sets all the time.  I just tuple the items, but that means you have to re-dict it on the way

Re: frozendict

2012-02-09 Thread Nathan Rice
Two dicts created from the same inputs will return items in the same arbitrary order.  As long as you don't insert or delete a key you're fine. Two dicts that contain the same keys and values may or may not return them in the same order: dict.fromkeys('ia') {'i': None, 'a': None}

ANN: eGenix mxODBC Zope Database Adapter 2.0.2

2012-02-09 Thread eGenix Team: M.-A. Lemburg
ANNOUNCEMENT mxODBC Zope Database Adapter Version 2.0.2 for Zope and the Plone CMS Available for Zope 2.10 and later on

Re: Re: what is the difference between @property and method

2012-02-09 Thread John Posner
On 2:59 PM, Devin Jeanpierre wrote: It is kind of funny that the docs don't ever explicitly say what a property is. http://docs.python.org/library/functions.html#property -- Devin Here's a writeup that does: http://wiki.python.org/moin/AlternativeDescriptionOfProperty -John --

Re: Software tool for stochastic simulation as well as for the stochastic optimization

2012-02-09 Thread Wolfgang Keller
I plan to work in decision support field in environmental engineering so I will use both the stochastic simulation as well as the stochastic optimization. I would like to select the best for both approaches software tool. what you suggest ... Matlab ... python ... something else? I have no

Re: frozendict

2012-02-09 Thread Ian Kelly
On Thu, Feb 9, 2012 at 8:19 AM, Nathan Rice nathan.alexander.r...@gmail.com wrote: As I said, two dictionaries created from the same input will be the same... That's an implementation detail, not a guarantee. It will hold for current versions of CPython but not necessarily for other Python

Re: Read-only attribute in module

2012-02-09 Thread mloskot
Ben Finney-10 wrote Mateusz Loskot lt;mateusz@gt; writes: So, the following import xyz print(xyz.flag) # OK xyz.flag = 0# error due to no write access PEP 8 lt;URL:http://www.python.org/dev/peps/pep-0008/gt; gives the style guide for Python code (strictly for the standard

Re: frozendict

2012-02-09 Thread Nathan Rice
On Thu, Feb 9, 2012 at 11:35 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, Feb 9, 2012 at 8:19 AM, Nathan Rice nathan.alexander.r...@gmail.com wrote: As I said, two dictionaries created from the same input will be the same... That's an implementation detail, not a guarantee.  It will

Re: Naming convention for in-house modules (Newbie question)

2012-02-09 Thread Laurent Claessens
This is not 100% an answer to the question, but you should read that : http://www.python.org/dev/peps/pep-0008/ The OP mentions PEP 8 in the bit of his message that you *don't* quote. Well... I've to sleep. Sorry :( Laurent -- http://mail.python.org/mailman/listinfo/python-list

Re: unicode printing on Windows

2012-02-09 Thread Terry Reedy
On 2/9/2012 5:46 AM, BlueBird wrote: Hi, The question is not totally related to Python but there is a strong connection. Everytime that I try to debug some python programs under Windows, I encounter the issue that things printed on the console simply break the program because : 1. My windows

multiple namespaces within a single module?

2012-02-09 Thread jkn
Hello there is it possible to have multiple namespaces within a single python module? I have a small app which is in three or four .py files. For various reasons I would like to (perhaps optionally) combine these into one file. I was hoping that there might be a simple mechanism that would

Re: frozendict

2012-02-09 Thread Duncan Booth
Nathan Rice nathan.alexander.r...@gmail.com wrote: As I said, two dictionaries created from the same input will be the same... 'ai' != 'ia'. If I need to hash a dict that I don't know was created in a deterministic order, I'd frozenset(thedict.items()). Fair enough, the idea scares me, but

Apparent double imports (was: Naming convention for in-house modules (Newbie question))

2012-02-09 Thread HoneyMonster
On Thu, 09 Feb 2012 14:36:52 +, Arnaud Delobelle wrote: On 9 February 2012 14:00, Laurent Claessens moky.m...@gmail.com wrote: Here is my question: I would like to start an in-house library of small modules to import, for things like error handling/logging. That's easy enough, but is

Re: Apparent double imports (was: Naming convention for in-house modules (Newbie question))

2012-02-09 Thread Ian Kelly
On Thu, Feb 9, 2012 at 11:53 AM, HoneyMonster someone@someplace.invalid wrote: One issue I have run into, which may or may not be a problem: I am finding that modules in the in-house library package sometimes have to import modules like sys and os, which are also imported by the calling

Re: Read-only attribute in module

2012-02-09 Thread Terry Reedy
On 2/9/2012 6:43 AM, Mateusz Loskot wrote: Hi, I'm implementing Python 3 extension using the Python C API. I am familiar with defining new types, implementing get/set for attributes, etc. I'm wondering, is there any mean to implement attribute in module scope which is read-only? Not that I

Re: what is the difference between @property and method

2012-02-09 Thread Terry Reedy
On 2/9/2012 10:36 AM, John Posner wrote: On 2:59 PM, Devin Jeanpierre wrote: It is kind of funny that the docs don't ever explicitly say what a property is. http://docs.python.org/library/functions.html#property -- Devin Here's a writeup that does:

Re: multiple namespaces within a single module?

2012-02-09 Thread Peter Otten
jkn wrote: is it possible to have multiple namespaces within a single python module? Unless you are abusing classes I don't think so. I have a small app which is in three or four .py files. For various reasons I would like to (perhaps optionally) combine these into one file. Rename

Re: Read-only attribute in module

2012-02-09 Thread Mark Lawrence
On 09/02/2012 11:43, Mateusz Loskot wrote: Hi, I'm implementing Python 3 extension using the Python C API. I am familiar with defining new types, implementing get/set for attributes, etc. I'm wondering, is there any mean to implement attribute in module scope which is read-only? So, the

Re: Apparent double imports (was: Naming convention for in-house modules (Newbie question))

2012-02-09 Thread HoneyMonster
On Thu, 09 Feb 2012 12:02:03 -0700, Ian Kelly wrote: On Thu, Feb 9, 2012 at 11:53 AM, HoneyMonster someone@someplace.invalid wrote: One issue I have run into, which may or may not be a problem: I am finding that modules in the in-house library package sometimes have to import modules like

Re: Apparent double imports

2012-02-09 Thread Dave Angel
On 02/09/2012 02:40 PM, HoneyMonster wrote: On Thu, 09 Feb 2012 12:02:03 -0700, Ian Kelly wrote: On Thu, Feb 9, 2012 at 11:53 AM, HoneyMonster someone@someplace.invalid wrote: One issue I have run into, which may or may not be a problem: I am finding that modules in the in-house library

Formate a number with commas

2012-02-09 Thread noydb
How do you format a number to print with commas? Some quick searching, i came up with: import locale locale.setlocale(locale.LC_ALL, ) locale.format('%d', 2348721, True) '2,348,721' I'm a perpetual novice, so just looking for better, slicker, more proper, pythonic ways to do this. Thanks!

Re: Formate a number with commas

2012-02-09 Thread Neil Cerutti
On 2012-02-09, noydb jenn.du...@gmail.com wrote: How do you format a number to print with commas? Some quick searching, i came up with: import locale locale.setlocale(locale.LC_ALL, ) locale.format('%d', 2348721, True) '2,348,721' I'm a perpetual novice, so just looking for better,

Re: Reading files in from the proper directory

2012-02-09 Thread SMac2347
On Feb 7, 3:16 pm, Peter Otten __pete...@web.de wrote: smac2...@comcast.net wrote: xls_files   = glob.glob(in_dir + *.xls) Try changing that to pattern = os.path.join(in_dir, *.xls) xls_files = glob.glob(pattern) os.path.join() inserts a (back)slash between directory and filename if

Re: Formate a number with commas

2012-02-09 Thread Peter Otten
noydb wrote: How do you format a number to print with commas? Some quick searching, i came up with: import locale locale.setlocale(locale.LC_ALL, ) locale.format('%d', 2348721, True) '2,348,721' I'm a perpetual novice, so just looking for better, slicker, more proper, pythonic

Re: Reading files in from the proper directory

2012-02-09 Thread SMac2347
On Feb 7, 3:16 pm, Peter Otten __pete...@web.de wrote: smac2...@comcast.net wrote: xls_files   = glob.glob(in_dir + *.xls) Try changing that to pattern = os.path.join(in_dir, *.xls) xls_files = glob.glob(pattern) os.path.join() inserts a (back)slash between directory and filename if

Re: Formate a number with commas

2012-02-09 Thread Chris Rebert
On Thu, Feb 9, 2012 at 12:39 PM, Peter Otten __pete...@web.de wrote: noydb wrote: How do you format a number to print with commas? Some quick searching, i came up with: import locale locale.setlocale(locale.LC_ALL, ) locale.format('%d', 2348721, True) '2,348,721' I'm a perpetual

Re: Reading files in from the proper directory

2012-02-09 Thread Peter Otten
smac2...@comcast.net wrote: On Feb 7, 3:16 pm, Peter Otten __pete...@web.de wrote: smac2...@comcast.net wrote: xls_files = glob.glob(in_dir + *.xls) Try changing that to pattern = os.path.join(in_dir, *.xls) xls_files = glob.glob(pattern) os.path.join() inserts a (back)slash between

Re: Formate a number with commas

2012-02-09 Thread Alain Ketterlin
noydb jenn.du...@gmail.com writes: How do you format a number to print with commas? import locale locale.setlocale(locale.LC_ALL, ) This sets the locale according to the environment (typically LANG---I'm talking about linux, don't know others). locale.format('%d', 2348721, True)

Re: Formate a number with commas

2012-02-09 Thread Peter Otten
Chris Rebert wrote: On Thu, Feb 9, 2012 at 12:39 PM, Peter Otten __pete...@web.de wrote: import locale locale.setlocale(locale.LC_ALL, ) 'de_DE.UTF-8' {:n}.format(1234) # locale-aware '1.234' {:,d}.format(1234) # always a comma '1,234' The latter requires Python 3.1+ and is courtesy

Re: multiple namespaces within a single module?

2012-02-09 Thread Ethan Furman
Peter Otten wrote: jkn wrote: is it possible to have multiple namespaces within a single python module? Unless you are abusing classes I don't think so. Speaking of... code class NameSpace(object): def __init__(self, globals): self.globals = globals

Re: multiple namespaces within a single module?

2012-02-09 Thread Peter Otten
Ethan Furman wrote: Peter Otten wrote: jkn wrote: is it possible to have multiple namespaces within a single python module? Unless you are abusing classes I don't think so. Speaking of... code class NameSpace(object): def __init__(self, globals): self.globals

Re: Apparent double imports

2012-02-09 Thread HoneyMonster
On Thu, 09 Feb 2012 15:05:52 -0500, Dave Angel wrote: On 02/09/2012 02:40 PM, HoneyMonster wrote: On Thu, 09 Feb 2012 12:02:03 -0700, Ian Kelly wrote: On Thu, Feb 9, 2012 at 11:53 AM, HoneyMonster someone@someplace.invalid wrote: One issue I have run into, which may or may not be a

Re: Formate a number with commas

2012-02-09 Thread Chris Rebert
On Thu, Feb 9, 2012 at 1:16 PM, Peter Otten __pete...@web.de wrote: Chris Rebert wrote: On Thu, Feb 9, 2012 at 12:39 PM, Peter Otten __pete...@web.de wrote: import locale locale.setlocale(locale.LC_ALL, ) 'de_DE.UTF-8' {:n}.format(1234) # locale-aware '1.234' {:,d}.format(1234) # always a

Re: multiple namespaces within a single module?

2012-02-09 Thread Ethan Furman
Peter Otten wrote: Hm, what about with NameSpace(globals()) as a: x = inside a! def function(): print(x) with NameSpace(globals()) as b: x = inside b! def function(): print(x) x = inside main! a.function() b.function() It would have to be `a.x = ...` and

Want to improve my code.

2012-02-09 Thread Ian
Hi all, I'm using lxml etree, and have written a routine to remove nodes in the parsed tree. Typically, I load html, and remove font tags, so I am moving the font tags children up and moving the text and tail data about. The code of the deleteElem routine is here http://snipt.org/GSoo0

Re: Formate a number with commas

2012-02-09 Thread John Posner
On 2:59 PM, noydb wrote: How do you format a number to print with commas? I would readily admit that both the locale module and format method are preferable to this regular expression, which certainly violates the readability counts dictum: r(?=\d)(?=(\d\d\d)+$) # python 2.6.6 import re

Re: multiple namespaces within a single module?

2012-02-09 Thread jkn
Hi Peter On Feb 9, 7:33 pm, Peter Otten __pete...@web.de wrote: jkn wrote:     is it possible to have multiple namespaces within a single python module? Unless you are abusing classes I don't think so. I have a small app which is in three or four .py files. For various reasons I would

Re: multiple namespaces within a single module?

2012-02-09 Thread Ethan Furman
Ethan Furman wrote: Hrm -- and functions/classes/etc would have to refer to each other that way as well inside the namespace... not sure I'm in love with that... Not sure I hate it, either. ;) Slightly more sophisticated code: code class NameSpace(object): def __init__(self,

Re: Guide to: Learning Python Decorators

2012-02-09 Thread Ian
On 09/02/2012 21:41, Aaron France wrote: How many pages is that? The amazon page conveniently left that off. There is an average of 5.1 chars per word in English, and usually about 350 words an A4 page. The 215K file is a) Compressed - typically by 60% b) Contains simple html and images as

round down to nearest number

2012-02-09 Thread noydb
How do you round down ALWAYS to nearest 100? Like, if I have number 3268, I want that rounded down to 3200. I'm doing my rounding like round(3268, -2) But, how to round DOWN? -- http://mail.python.org/mailman/listinfo/python-list

Re: round down to nearest number

2012-02-09 Thread Ian Kelly
On Thu, Feb 9, 2012 at 5:30 PM, noydb jenn.du...@gmail.com wrote: How do you round down ALWAYS to nearest 100?  Like, if I have number 3268, I want that rounded down to 3200.  I'm doing my rounding like round(3268, -2) But, how to round DOWN? 3268 // 100 * 100 3200 For more complicated

Re: Read-only attribute in module

2012-02-09 Thread Steven D'Aprano
On Thu, 09 Feb 2012 23:32:59 +1100, Ben Finney wrote: Mateusz Loskot mate...@loskot.net writes: I'm wondering, is there any mean to implement attribute in module scope which is read-only? Python is designed by and for consenting adults. Rather than restricting, instead use conventions to

Re: frozendict

2012-02-09 Thread Steven D'Aprano
On Thu, 09 Feb 2012 09:35:52 -0700, Ian Kelly wrote: On Thu, Feb 9, 2012 at 8:19 AM, Nathan Rice nathan.alexander.r...@gmail.com wrote: As I said, two dictionaries created from the same input will be the same... That's an implementation detail, not a guarantee. It will hold for current

Re: round down to nearest number

2012-02-09 Thread noydb
hmmm, okay. So how would you round UP always? Say the number is 3219, so you want 3300 returned. -- http://mail.python.org/mailman/listinfo/python-list

Re: round down to nearest number

2012-02-09 Thread Chris Kaynor
On Thu, Feb 9, 2012 at 5:23 PM, noydb jenn.du...@gmail.com wrote: hmmm, okay. So how would you round UP always? Say the number is 3219, so you want 3300 returned. You may want to look into the mathematical floor and ceiling functions[1]. Python exposes them in the math module as floor and

Re: round down to nearest number

2012-02-09 Thread Chris Kaynor
On Thu, Feb 9, 2012 at 5:40 PM, Chris Kaynor ckay...@zindagigames.comwrote: On Thu, Feb 9, 2012 at 5:23 PM, noydb jenn.du...@gmail.com wrote: hmmm, okay. So how would you round UP always? Say the number is 3219, so you want 3300 returned. You may want to look into the mathematical floor

Re: round down to nearest number

2012-02-09 Thread Chris Rebert
On Thu, Feb 9, 2012 at 5:23 PM, noydb jenn.du...@gmail.com wrote: hmmm, okay. So how would you round UP always?  Say the number is 3219, so you want 3300 returned. http://stackoverflow.com/questions/17944/how-to-round-up-the-result-of-integer-division/96921 Thus: (3219 + 99) // 100 Slight

Re: round down to nearest number

2012-02-09 Thread Ian Kelly
On Thu, Feb 9, 2012 at 6:43 PM, Chris Rebert c...@rebertia.com wrote: On Thu, Feb 9, 2012 at 5:23 PM, noydb jenn.du...@gmail.com wrote: hmmm, okay. So how would you round UP always?  Say the number is 3219, so you want 3300 returned.

Re: round down to nearest number

2012-02-09 Thread noydb
That { (3219 + 99) // 100} doesnt work if the number is other then 4 digits. (for rounding up to nearest 100): (3219 + 99)//100 33 (3289 + 99)//100 33 (328678 + 99)//100 3287 (328 + 99)//100 4 -- http://mail.python.org/mailman/listinfo/python-list

Re: frozendict

2012-02-09 Thread Nathan Rice
On Thu, Feb 9, 2012 at 8:24 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 09 Feb 2012 09:35:52 -0700, Ian Kelly wrote: On Thu, Feb 9, 2012 at 8:19 AM, Nathan Rice nathan.alexander.r...@gmail.com wrote: As I said, two dictionaries created from the same input will be

Re: Formate a number with commas

2012-02-09 Thread Terry Reedy
On 2/9/2012 5:12 PM, Chris Rebert wrote: Argh. The 2.7 docs say it was added in 2.7, but the 3.3a0 docs say it was added in 3.1 (Guido's backporting time machine messes with causality). Python 2 docs refer to Python 2. Python 3 docs refer to Python 3. So 'it' was in neither 2.6 nor 3.1.

Re: Guide to: Learning Python Decorators

2012-02-09 Thread Terry Reedy
On 2/9/2012 5:43 PM, Ian wrote: On 09/02/2012 21:41, Aaron France wrote: How many pages is that? The amazon page conveniently left that off. There is an average of 5.1 chars per word in English, and usually about 350 words an A4 page. The 215K file is a) Compressed - typically by 60% b)

Re: Read-only attribute in module

2012-02-09 Thread Terry Reedy
On 2/9/2012 8:04 PM, Steven D'Aprano wrote: Python happily violates consenting adults all over the place. We have properties, which can easily create read-only and write-once attributes. So propose that propery() work at module level, for module attributes, as well as for class attributes.

Re: round down to nearest number

2012-02-09 Thread Terry Reedy
On 2/9/2012 8:23 PM, noydb wrote: So how would you round UP always? Say the number is 3219, so you want (//100+1)*100 3400 -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: frozendict

2012-02-09 Thread Terry Reedy
On 2/9/2012 9:30 PM, Nathan Rice wrote: That day may be sooner than you think. It is very likely that in Python 3.3, dict order will be randomized on creation as a side-effect of adding a random salt to hashes to prevent a serious vulnerability in dicts. http://securitytracker.com/id/1026478

Re: round down to nearest number

2012-02-09 Thread MRAB
On 10/02/2012 02:25, noydb wrote: That { (3219 + 99) // 100} doesnt work if the number is other then 4 digits. (for rounding up to nearest 100): (3219 + 99)//100 33 (3289 + 99)//100 33 (328678 + 99)//100 3287 (328 + 99)//100 4 (3219 + 99) // 100 * 100 3300 (3289 + 99) // 100 *

Re: round down to nearest number

2012-02-09 Thread MRAB
On 10/02/2012 03:29, Terry Reedy wrote: On 2/9/2012 8:23 PM, noydb wrote: So how would you round UP always? Say the number is 3219, so you want (//100+1)*100 3400 Doing it that way doesn't always work. For example: (3400 // 100 + 1) * 100 3500 However: (3400 + 99) // 100 * 100

Re: round down to nearest number

2012-02-09 Thread Ian Kelly
On Thu, Feb 9, 2012 at 8:36 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 10/02/2012 02:25, noydb wrote: That {  (3219 + 99) // 100} doesnt work if the number is other then 4 digits. (for rounding up to nearest 100):  (3219 + 99)//100 33  (3289 + 99)//100 33  (328678 + 99)//100

Re: Guide to: Learning Python Decorators

2012-02-09 Thread sajuptpm
Hi, Thanks for replay, I am looking for PDF version of same book. Please share if you can. http://www.amazon.com/gp/product/B006ZHJSIM/ref=as_li_tf_tl?ie=UTF8tag=8012-20linkCode=as2camp=1789creative=9325creativeASIN=B006ZHJSIM -- http://mail.python.org/mailman/listinfo/python-list

Re: Common LISP-style closures with Python

2012-02-09 Thread John Nagle
On 2/3/2012 4:27 PM, Antti J Ylikoski wrote: In Python textbooks that I have read, it is usually not mentioned that we can very easily program Common LISP-style closures with Python. It is done as follows: Most dynamic languages have closures. Even Perl and Javascript have closures.

Re: frozendict

2012-02-09 Thread anon hung
I've been trying for a few days (only a little bit at a time) to come up with a way of implementing a frozendict that doesn't suck. I'm gradually converging to a solution, but I can't help but think that there's some subtlety that I'm probably missing which is why it's not already provided.

[issue13972] set and frozenset constructors don't accept multiple iterables

2012-02-09 Thread Petri Lehtinen
New submission from Petri Lehtinen pe...@digip.org: set.update() and friends accept multiple iterables. IMHO, set and frozenset constructors should, too. -- components: Interpreter Core messages: 152931 nosy: petri.lehtinen priority: normal severity: normal status: open title: set and

[issue13973] urllib.parse is imported twice in xmlrpc.client

2012-02-09 Thread Tshepang Lekhonkhobe
New submission from Tshepang Lekhonkhobe tshep...@gmail.com: urllib.parse is imported twice in xmlrpc.client, and it also breaks pep8 -- components: Library (Lib) files: duplicate-imports.patch keywords: patch messages: 152932 nosy: tshepang priority: normal severity: normal status:

[issue13974] packaging: test for set_platform()

2012-02-09 Thread Tshepang Lekhonkhobe
New submission from Tshepang Lekhonkhobe tshep...@gmail.com: slightly increases test coverage -- assignee: tarek components: Distutils2 files: test-set-platform.patch keywords: patch messages: 152933 nosy: alexis, eric.araujo, tarek, tshepang priority: normal severity: normal status:

[issue13975] packaging: change_root() test for os2

2012-02-09 Thread Tshepang Lekhonkhobe
New submission from Tshepang Lekhonkhobe tshep...@gmail.com: increases coverage a bit -- assignee: tarek components: Distutils2 files: test-change_root-in-os2.patch keywords: patch messages: 152934 nosy: alexis, eric.araujo, tarek, tshepang priority: normal severity: normal status: open

[issue13972] set and frozenset constructors don't accept multiple iterables

2012-02-09 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- nosy: +giampaolo.rodola ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13972 ___ ___

[issue6005] Bug in socket example

2012-02-09 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset aa6415d1e160 by Senthil Kumaran in branch '2.7': Fix Issue #6005: Examples in the socket library documentation use sendall, http://hg.python.org/cpython/rev/aa6415d1e160 -- nosy: +python-dev

[issue6005] Bug in socket example

2012-02-09 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 2aae44aa041a by Senthil Kumaran in branch '3.2': Fix Issue #6005: Examples in the socket library documentation use sendall, http://hg.python.org/cpython/rev/2aae44aa041a New changeset e9c3df45920e by Senthil Kumaran

[issue6005] Bug in socket example

2012-02-09 Thread Senthil Kumaran
Senthil Kumaran sent...@uthcode.com added the comment: Thanks for patches. This is fixed. -- nosy: +orsenthil resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue9021] no copy.copy problem description

2012-02-09 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 0e050b38e92b by Senthil Kumaran in branch '2.7': Issue #9021: Add an introduction to the copy module. Doc changes suggested by Terry Reedy. http://hg.python.org/cpython/rev/0e050b38e92b -- nosy: +python-dev

[issue9021] no copy.copy problem description

2012-02-09 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset a352e24b9907 by Senthil Kumaran in branch '3.2': Issue #9021 - Introduce copy module better. Doc changes suggested by Terry http://hg.python.org/cpython/rev/a352e24b9907 New changeset bf6f306ad5cf by Senthil Kumaran

[issue9021] no copy.copy problem description

2012-02-09 Thread Senthil Kumaran
Senthil Kumaran sent...@uthcode.com added the comment: Added suggested changes to the documentation. Thanks. -- resolution: - fixed stage: - committed/rejected status: open - closed type: - behavior ___ Python tracker rep...@bugs.python.org

[issue9021] no copy.copy problem description

2012-02-09 Thread anatoly techtonik
anatoly techtonik techto...@gmail.com added the comment: Perfectionist in me says that now copy.copy theory should be diluted with examples for those who can't grasp the concept of binding of variables, but the patch perfectly covers the original user story. Thanks. --

[issue13903] New shared-keys dictionary implementation

2012-02-09 Thread Mark Shannon
Changes by Mark Shannon m...@hotpy.org: Added file: http://bugs.python.org/file24465/e50db1b7ad7b.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13903 ___

  1   2   3   >