Re: Style question - defining immutable class data members

2009-03-15 Thread Gary Herron
John Posner wrote: Matthew Woodcraft said: I doubt it's because anyone particularly wanted this behaviour; it just falls out of the way '+=' is defined. At the point where 'inst.x += 1' is compiled, Python doesn't know whether 'inst.x' is going to turn out to be a class attribute or an inst

Re: VMware and pywin32 error...

2009-03-15 Thread dash
Joshua Kugler schrieb: dot wrote: has anyone experience with installing Python and pywin32 to Windows XP Pro running in a VMware environment? At the end of installing pywin32 I get following error: Traceback (most recent

Re: VMware and pywin32 error...

2009-03-15 Thread dash
Joshua Kugler schrieb: dot wrote: has anyone experience with installing Python and pywin32 to Windows XP Pro running in a VMware environment? At the end of installing pywin32 I get following error: Traceback (most recent

Re: VMware and pywin32 error...

2009-03-15 Thread dash
Joshua Kugler schrieb: dot wrote: has anyone experience with installing Python and pywin32 to Windows XP Pro running in a VMware environment? At the end of installing pywin32 I get following error: Traceback (most recent

Re: Problem while copying a file from a remote filer

2009-03-15 Thread Chris Rebert
On Sun, Mar 15, 2009 at 10:24 PM, venutaurus...@gmail.com wrote: > Hi all, >      I have to write an application which does a move and copy of a > file from a remote machine to the local machine. I tried something > like: > > file = ur"venuwin2008\\C\\4Folders\\Folder02\\Folder002\ > \TextFile

Re: PyWin32 for Python 3.x

2009-03-15 Thread John Machin
On Mar 16, 7:27 am, Tim Golden wrote: [snip] > people take to categorise their packages appropriately. It > could well be the case that a number of packages will work > in Python 3.x without modification but their entry probably > won't reflect that unless their maintainer's gone to the > troubl

Re: setattr() on "object" instance

2009-03-15 Thread Ahmad Syukri b
On Mar 16, 1:21 pm, Sean DiZazzo wrote: > Why is it that you can setattr() on an instance of a class that > inherits from "object", but you can't on an instance of "object" > itself? > > >>> o = object() > >>> setattr(o, "x", 1000) > > Traceback (most recent call last): >   File "", line 1, in >

Problem while copying a file from a remote filer

2009-03-15 Thread venutaurus...@gmail.com
Hi all, I have to write an application which does a move and copy of a file from a remote machine to the local machine. I tried something like: file = ur"venuwin2008\\C\\4Folders\\Folder02\\Folder002\ \TextFile_06.txt" dest = "C:\\test" shutil.copy(file,dest) But it is throwing an error

Re: Style question - defining immutable class data members

2009-03-15 Thread Gary Herron
John Posner wrote: (My apologies if the thread has already covered this.) I believe I understand the WHAT in this situation, but I don't understand the WHY ... Given this class definition: class Cls(object): x = 345 ... I observe the following, using IDLE 2.6.1: inst = Cls() Cls.

Re: PyWin32 for Python 3.x

2009-03-15 Thread John Nagle
Tim Golden wrote: John Nagle wrote: Well, of some other packages I use: MySQLdb: "Python versions 2.3-2.5 are supported." Ref: http://sourceforge.net/projects/mysql-python M2Crypto: Latest version is for Python 2.6. Ref: http://chandlerproject.org/bin/view/Projects/Me

Re: Integer arithmetic in hardware descriptions

2009-03-15 Thread bearophileHUGS
JanC: > In most "modern" Pascal dialects the overflow checks can be (locally) > enabled or disabled with compiler directives in the source code, I think that was possible in somewhat older versions of Pascal-like languages too (like old Delphi versions, and maybe TurboPascals too). >so the "spee

Re: multiprocessing.sharedctypes and built-in locks

2009-03-15 Thread Ahmad Syukri b
On Mar 15, 6:19 am, Aaron Brady wrote: > > Your code hung on my machine.  The call to 'main()' should be in an > 'if __name__' block: > > if __name__== '__main__': >     main() > > Is it possible you are just seeing the effects of the non-atomic > '__iadd__' operation?  That is, the value is read,

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

2009-03-15 Thread John Machin
On Mar 16, 3:08 pm, a...@pythoncraft.com (Aahz) wrote: > In article , > Roy Smith   wrote: > > >In article , > > Chris Rebert wrote: > > >> Besides your behavior, one could equally well argue that a 31st repeat > >> on months without a 31st should just be dropped, or that it should > >> carry over

setattr() on "object" instance

2009-03-15 Thread Sean DiZazzo
Why is it that you can setattr() on an instance of a class that inherits from "object", but you can't on an instance of "object" itself? >>> o = object() >>> setattr(o, "x", 1000) Traceback (most recent call last): File "", line 1, in AttributeError: 'object' object has no attribute 'x' >>> cl

Re: how to repeat function definitions less

2009-03-15 Thread alex goretoy
what is I just set "colors": self.opt['arg_opts_options']['imp_colors'] then they are both pointing to the same place, correct? -Alex Goretoy http://www.goretoy.com On Sun, Mar 15, 2009 at 11:16 PM, alex goretoy wrote: > i did this because this will read colors into a nested variable > > How

Re: how to repeat function definitions less

2009-03-15 Thread alex goretoy
i did this because this will read colors into a nested variable How would i make this work the way you suggest? I already have it working now :) Not able to set to dict value with setattr, how to do this too(sorry if off subject)? I can set it like this: for i in self.opt['p

Re: Why does Python not return first line?

2009-03-15 Thread John Machin
On Mar 16, 11:25 am, Gilles Ganault wrote: > On Mon, 16 Mar 2009 01:14:00 +0100, Gilles Ganault > wrote: > > >I'm stuck at why Python doesn't return the first line in this simple > >regex > > Found it: Python does extract the token, but displaying it requires > removing hidden chars: > > = >

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

2009-03-15 Thread Aahz
In article , Roy Smith wrote: >In article , > Chris Rebert wrote: >> >> Besides your behavior, one could equally well argue that a 31st repeat >> on months without a 31st should just be dropped, or that it should >> carry over onto the 1st of the next month (ignoring the complications >> of Febr

Re: Style question - defining immutable class data members

2009-03-15 Thread Tim Wintle
On Mon, 2009-03-16 at 04:02 +, Tim Wintle wrote: > On Sun, 2009-03-15 at 10:39 -0700, John Posner wrote: Doh, reply out of thread there - I meant to reply to Rhodi's comment further down. > Is there any actual advantage to self.attribute picking up > Class.attribute instead of raising a NameEr

Re: Style question - defining immutable class data members

2009-03-15 Thread Tim Wintle
On Sun, 2009-03-15 at 10:39 -0700, John Posner wrote: > (My apologies if the thread has already covered this.) I believe I understand > the WHAT in this situation, but I don't understand the WHY ... > Is there a beneficial effect of silently creating the instance attribute, > which outweighs the

Re: PyPy Progress (and Psyco)

2009-03-15 Thread JanC
andrew cooke wrote: > Fuzzyman wrote: >> On Mar 15, 3:46 pm, Gerhard Häring wrote: > [...] >>> Me too. I doubt it, though. From an outside view, the project seems to >>> lack focus. To me, it looks like a research platform, and producing a >>> successor to CPython seems to be just one out of a do

Re: Integer arithmetic in hardware descriptions

2009-03-15 Thread JanC
bearophileh...@lycos.com wrote: > Some C# designers come from Pascal (where overflow is considered an > important thing), and they have added to dotnet ways to find when an > overflow occurs, globally in a program, locally in a piece of code, or > even in a single part of an expression. This is mu

Re: Style question - defining immutable class data members

2009-03-15 Thread Rhodri James
On Sun, 15 Mar 2009 23:26:04 -, Aaron Brady wrote: On Mar 15, 1:50 pm, "Rhodri James" wrote: On Sun, 15 Mar 2009 17:55:25 -, Aaron Brady   wrote: > On Mar 15, 12:39 pm, John Posner wrote: >> (My apologies if the thread has already covered this.) I believe I   >> understand the WH

Re: Style question - defining immutable class data members

2009-03-15 Thread John Posner
Earlier, I said: > I'll look into what the standard Python doc set says on this > matter. > RTFM, in section "Augmented assignment statements" of python301.chm: --- For targets which are attribute references, the initial value is retrieved with a getattr() and the result is assigned with a se

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-15 Thread MRAB
Rhodri James wrote: On Sun, 15 Mar 2009 19:00:43 -, MRAB wrote: Rhodri James wrote: [snip] Frankly, I'd much rather fix the locale system and extend the format syntax to override the default locale. Perhaps something like financial = Locale(group_sep=",", grouping=[3]) print("my nu

Re: Style question - defining immutable class data members

2009-03-15 Thread R. David Murray
John Posner wrote: > Summary: I no longer suspect that "Python is broken". I *do* think that > there's a situation that is potentially quite confusing: > > * In the statement "self.x = self.x + 1", the two "self.x" names can > sometimes refer to different objects. But this is fundamental to Py

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-15 Thread Rhodri James
On Sun, 15 Mar 2009 19:00:43 -, MRAB wrote: Rhodri James wrote: [snip] Frankly, I'd much rather fix the locale system and extend the format syntax to override the default locale. Perhaps something like financial = Locale(group_sep=",", grouping=[3]) print("my number is {0:10n:finan

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-15 Thread Tim Rowe
2009/3/14 Hendrik van Rooyen : > No account seems to be taken of the fact that the locale approach > is a global one that forces uniformity on everything done on a PC > or by a user. Not so. Under .NET, for instance, the global settings will give you a default CultureInfo class, but you can creat

Re: [ActivePython 2.5.1.1] Why does Python not return first line?

2009-03-15 Thread Benjamin Kaplan
On Sun, Mar 15, 2009 at 8:14 PM, Gilles Ganault wrote: > Hello > > I'm stuck at why Python doesn't return the first line in this simple > regex: > > === > response = "Address :\r\t\t\r\t\t\t3 Abbey Road, > St Johns Wood \r\t\t\tLondon, NW8 9AY\t\t" > > re_address = re.compile('Address > :

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: [ActivePython 2.5.1.1] Why does Python not return first line?

2009-03-15 Thread Gilles Ganault
On Mon, 16 Mar 2009 01:14:00 +0100, Gilles Ganault wrote: >I'm stuck at why Python doesn't return the first line in this simple >regex Found it: Python does extract the token, but displaying it requires removing hidden chars: = response = "Address :\r\t\t\r\t\t\t3 Abbey Road, St Johns Wood \

[ActivePython 2.5.1.1] Why does Python not return first line?

2009-03-15 Thread Gilles Ganault
Hello I'm stuck at why Python doesn't return the first line in this simple regex: === response = "Address :\r\t\t\r\t\t\t3 Abbey Road, St Johns Wood \r\t\t\tLondon, NW8 9AY\t\t" re_address = re.compile('Address :.+?(.+?)',re.I | re.S | re.M) address = re_address.search(response) if addr

Re: Correct URL encoding

2009-03-15 Thread mattia
Il Sun, 15 Mar 2009 17:05:16 -0700, Chris Rebert ha scritto: > On Sun, Mar 15, 2009 at 4:54 PM, gervaz wrote: >> On Mar 16, 12:38 am, Graham Breed wrote: >>> mattia wrote: >>> > I'm using urlopen in order to download some web pages. I've always >>> > to replace some characters that are in the ur

Re: Correct URL encoding

2009-03-15 Thread Chris Rebert
On Sun, Mar 15, 2009 at 4:54 PM, gervaz wrote: > On Mar 16, 12:38 am, Graham Breed wrote: >> mattia wrote: >> > I'm using urlopen in order to download some web pages. I've always to >> > replace some characters that are in the url, so I've come up with: >> > url.replace("|", "%7C").replace("/", "

Re: Correct URL encoding

2009-03-15 Thread gervaz
On Mar 16, 12:38 am, Graham Breed wrote: > mattia wrote: > > I'm using urlopen in order to download some web pages. I've always to > > replace some characters that are in the url, so I've come up with: > > url.replace("|", "%7C").replace("/", "%2F").replace(" ", "+").replace > > (":", "%3A") > > T

Re: tkinter: loading file before entering mainloop

2009-03-15 Thread John McMonagle
Peter Billam wrote: > On 2009-03-14, Peter Otten <__pete...@web.de> wrote: >> Well, I don't know where the ymid[...] values come from. If you can >> guarantee that ymid[track_num] - ymid[track_num-1] > 50 at some point >> you could reschedule loadFile() from within loadFile() and return >> immediat

is there an easy way to parse a nested list ?

2009-03-15 Thread Stef Mientki
hello, I need to parse a nested list, given as a string, like this line = " A [ B [ C+2 ] + 3 ] " ( I probably can do it with find, but I guess that's not the most elegant way, besides recusrion is not my strongest point) which should be parsed so I get an list from inner to outer side (d

Re: how to repeat function definitions less

2009-03-15 Thread MRAB
alex goretoy wrote: ok now for the final result, i decided to split options out to a separate dict of lists, does this look right to every one, I currently have error somewhere else in my code so can't test this right now, Is this a good method to do this? or is there another option? [snip]

Re: Correct URL encoding

2009-03-15 Thread Graham Breed
mattia wrote: I'm using urlopen in order to download some web pages. I've always to replace some characters that are in the url, so I've come up with: url.replace("|", "%7C").replace("/", "%2F").replace(" ", "+").replace (":", "%3A") There isn't a better way of doing this? Yeah, shame there's

[ANN] pxyser --- python xml serialization (beta release 0.1).

2009-03-15 Thread Daniel Molina Wegener
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 pxyser --- python xml serialization (beta release 0.1). pyxser is a C written extension that serializes/deserializes python objects in XML format. It uses a DTD to create a valid XML tree under UTF-8 encoding. the project web page is at: http://pr

Re: can error messages be improved or can they be overridden ?

2009-03-15 Thread andrew cooke
rdmur...@bitdance.com wrote: > "andrew cooke" wrote: >> rdmur...@bitdance.com wrote: >> [...] >> > (You know, I really ought to revisit that routine and make it part >> > of my standard development toolbox.) >> >> please post it > > OK. I dug it up, cut out the stuff that was specific to the

Re: Style question - defining immutable class data members

2009-03-15 Thread Aaron Brady
On Mar 15, 1:50 pm, "Rhodri James" wrote: > On Sun, 15 Mar 2009 17:55:25 -, Aaron Brady   > wrote: > > > On Mar 15, 12:39 pm, John Posner wrote: > >> (My apologies if the thread has already covered this.) I believe I   > >> understand the WHAT in this situation, but I don't understand the WH

Re: Correct URL encoding

2009-03-15 Thread Chris Rebert
On Sun, Mar 15, 2009 at 4:21 PM, mattia wrote: > I'm using urlopen in order to download some web pages. I've always to > replace some characters that are in the url, so I've come up with: > url.replace("|", "%7C").replace("/", "%2F").replace(" ", "+").replace > (":", "%3A") > There isn't a better

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

2009-03-15 Thread Chris Rebert
On Sun, Mar 15, 2009 at 4:17 PM, Steve Holden wrote: > Roy Smith wrote: >> In article <49bd3ab8$0$510$bed64...@news.gradwell.net>, tinn...@isbd.co.uk >> wrote: >> >>> I have a date in the form of a datetime object and I want to add (for >>> example) three months to it.  At the moment I can't see a

Correct URL encoding

2009-03-15 Thread mattia
I'm using urlopen in order to download some web pages. I've always to replace some characters that are in the url, so I've come up with: url.replace("|", "%7C").replace("/", "%2F").replace(" ", "+").replace (":", "%3A") There isn't a better way of doing this? -- http://mail.python.org/mailman/list

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

2009-03-15 Thread Steve Holden
Roy Smith wrote: > In article <49bd3ab8$0$510$bed64...@news.gradwell.net>, tinn...@isbd.co.uk > wrote: > >> I have a date in the form of a datetime object and I want to add (for >> example) three months to it. At the moment I can't see any very >> obvious way of doing this. I need something lik

Re: can error messages be improved or can they be overridden ?

2009-03-15 Thread Stef Mientki
thanks RDM, I finally had a case where I really needed it, so it tried, works perfect, except the marked lines should be indented 1 more. cheers, Stef rdmur...@bitdance.com wrote: "andrew cooke" wrote: rdmur...@bitdance.com wrote: [...] (You know, I really ought to revisit that routin

Re: Style question - defining immutable class data members

2009-03-15 Thread John Posner
Matthew Woodcraft said: > I doubt it's because anyone particularly wanted this > behaviour; it just > falls out of the way '+=' is defined. > > At the point where 'inst.x += 1' is compiled, > Python doesn't know > whether 'inst.x' is going to turn out to be a class > attribute or an > instance a

Re: Get pixel colors from images in Python 3

2009-03-15 Thread Tim Roberts
Cro wrote: > >As the title sais, i am trying to extract pixel colors from images, in >Python 3. >... >Can anyone suggest how to do that ? >The bigger problem is that i need to extract pixel colors for many >types of images : JPEG, PNG, BMP, GIF. For this, i might need >different codecs... I am not

Re: PyWin32 for Python 3.x

2009-03-15 Thread Mark Hammond
On 16/03/2009 6:05 AM, John Nagle wrote: Tim Golden wrote: John Nagle wrote: Any idea when PyWin32 will be available for Python 3.x? John Nagle Release 213 is out already: http://sourceforge.net/project/showfiles.php?group_id=78018&package_id=79063&release_id=661475 I think it's still con

Re: how to repeat function definitions less

2009-03-15 Thread alex goretoy
ok now for the final result, i decided to split options out to a separate dict of lists, does this look right to every one, I currently have error somewhere else in my code so can't test this right now, Is this a good method to do this? or is there another option? self.opt={} self.

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

2009-03-15 Thread John Machin
On Mar 16, 6:55 am, John Yeung wrote: > 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;

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

2009-03-15 Thread John Machin
On Mar 16, 7:30 am, Roy Smith wrote: > In article , >  Chris Rebert wrote: > > > Which makes some sense considering a month can range from 28-31 days, > > which would make the delta oddly fuzzy. > > BTW, what date is "One month after August 10, 1752"?  Extra points if you > refuse the answer the

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

2009-03-15 Thread CM
On Mar 15, 1:28 pm, tinn...@isbd.co.uk wrote: > I have a date in the form of a datetime object and I want to add (for > example) three months to it.  At the moment I can't see any very > obvious way of doing this.  I need something like:- > >     myDate = datetime.date.today() >     inc = datetime.

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

2009-03-15 Thread Roy Smith
In article , Chris Rebert wrote: > Not that that date could even be represented by most programs since > it's before 1970. Talk about recentism! :-) > I've always wondered how historians using computers deal with that > limitation... The unix time format it well known for being extremely limit

Re: Style question - defining immutable class data members

2009-03-15 Thread R. David Murray
M R A Barnett wrote: > Aaron Brady wrote: > [snip] > > However, in my (opined) interpretation, 'list.append(...) is an in- > > place operation' is a factual error. In-place operations -also- > > rebind their 'argument' (FLOBW for lack of better words). 'append' is > > a by-side-effect operation.

Re: ipython / vs \ in readline on MS Windows (and ipython help grepper)

2009-03-15 Thread Tim Roberts
Jason Scheirer wrote: > >Cygwin does not magically change the platform you are on, the fact >that you are on Windows is hard-coded into the Python.exe binary. Look >for references to os.path.sep in IPython. Windows does let you use >forward slashes as path separators, though, so I am not entirely

Re: Style question - defining immutable class data members

2009-03-15 Thread Bruno Desthuilliers
John Posner a écrit : (My apologies if the thread has already covered this.) I believe I understand the WHAT in this situation, but I don't understand the WHY ... Given this class definition: class Cls(object): x = 345 ... I observe the following, using IDLE 2.6.1: inst = Cls() Cls.x is inst

Re: Style question - defining immutable class data members

2009-03-15 Thread Matthew Woodcraft
"Rhodri James" writes: > But do you, though? The only occasion I can think of that I'd want > the search to go past the instance is this "auto-initialisation", > and frankly I'd rather do that in an __init__ anyway. Perhaps > static methods or class methods work that way, I don't know how > the

Re: Style question - defining immutable class data members

2009-03-15 Thread Bruno Desthuilliers
Rhodri James a écrit : On Sun, 15 Mar 2009 17:55:25 -, Aaron Brady wrote: On Mar 15, 12:39 pm, John Posner wrote: (snip) Is there a beneficial effect of silently creating the instance attribute, which outweighs the detrimental effects: (1) inconsistency, (2) the "surprising" decoupli

Re: Style question - defining immutable class data members

2009-03-15 Thread Matthew Woodcraft
John Posner writes: > My question is ... WHY does the interpreter silently create the > instance attribute at this point, causing a "surprising decoupling" > from the class attribute? WHY doesn't the interpreter behave as it > would with a simple, non-instance variable: > > python > Python 2

Re: how to repeat function definitions less

2009-03-15 Thread alex goretoy
this is the final result of the args i will be parsing for now d={ "site_name":["s","sn","site",'sites','site_name','site_names'], "jar_name":["j","jn","jar",'jars','jar_name','jar_names'], "file_name":["f","fn",'file','files','filename','filenames','file_name','fi

Re: PyPy Progress (and Psyco)

2009-03-15 Thread andrew cooke
Fuzzyman wrote: > On Mar 15, 3:46 pm, Gerhard Häring wrote: [...] >> Me too. I doubt it, though. From an outside view, the project seems to >> lack focus. To me, it looks like a research platform, and producing a >> successor to CPython seems to be just one out of a dozen projects. [...] > Well, I

Re: Set overlapping

2009-03-15 Thread Chris Rebert
On Sun, Mar 15, 2009 at 1:41 PM, mattia wrote: > How can I determine the common values found in two differents sets and > then assign this values? > E.g. > dayset = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] > monthset = ["Jan", "Feb", "Apr", "May", "Jun", "Jul", "Aug", "Sep", > "Oct", "Nov

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

2009-03-15 Thread Chris Rebert
On Sun, Mar 15, 2009 at 1:30 PM, Roy Smith wrote: > In article , >  Chris Rebert wrote: > >> Which makes some sense considering a month can range from 28-31 days, >> which would make the delta oddly fuzzy. > > BTW, what date is "One month after August 10, 1752"?  Extra points if you > refuse the

Set overlapping

2009-03-15 Thread mattia
How can I determine the common values found in two differents sets and then assign this values? E.g. dayset = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] monthset = ["Jan", "Feb", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] this are the "fixed and standard" sets. Then I

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

2009-03-15 Thread Roy Smith
In article , Chris Rebert wrote: > Which makes some sense considering a month can range from 28-31 days, > which would make the delta oddly fuzzy. BTW, what date is "One month after August 10, 1752"? Extra points if you refuse the answer the question on the grounds that it's incompletely spe

Re: how to repeat function definitions less

2009-03-15 Thread alex goretoy
Michele I tried your way but I dont seem to have a good grasp on the concept yet, will read up more for now I think I will try to make it work same way as colors only with decorator as def inside def instead of @, that doesn't make sense quite yet -Alex Goretoy http://www.goretoy.com On Sun, M

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

2009-03-15 Thread Roy Smith
In article , Chris Rebert wrote: > Besides your behavior, one could equally well argue that a 31st repeat > on months without a 31st should just be dropped, or that it should > carry over onto the 1st of the next month (ignoring the complications > of February). Which behavior one needs is compl

Re: PyWin32 for Python 3.x

2009-03-15 Thread Tim Golden
John Nagle wrote: Well, of some other packages I use: MySQLdb: "Python versions 2.3-2.5 are supported." Ref: http://sourceforge.net/projects/mysql-python M2Crypto: Latest version is for Python 2.6. Ref: http://chandlerproject.org/bin/view/Projects/MeTooCrypto Somebody

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

2009-03-15 Thread Roy Smith
In article <49bd4252$0$512$bed64...@news.gradwell.net>, tinn...@isbd.co.uk wrote: > > Well, before you can "add three months" to something, you need to explain > > what that means. > [...] > No, it's perfectly possible applying simple logic. I didn't say it was not possible. I just said that

Re: PyWin32 for Python 3.x

2009-03-15 Thread John Nagle
Tim Golden wrote: John Nagle wrote: That "wizard" won't even install unless Python 3.0 is "in the registry", which apparently means "installed as the default Python". No, it just means "installed somewhere". I have 6 different versions of Python installed on this box. The choice of which is

Re: how to repeat function definitions less

2009-03-15 Thread alex goretoy
this is what I did to define all my color functions by color name, but I am still going to need a good solution for args #import functions by color name into current namespace > for color in self.colors.keys(): > setattr(self, color,lambda x,y=color,z="INFO": > self._he

ANN: OpenOpt 0.23 - free numerical optimization framework

2009-03-15 Thread dmitrey
Hi all, OpenOpt 0.23, a free numerical optimization framework (license: BSD) with some own solvers and connections to tens of 3rd party ones, has been released. Our new homepage: http://openopt.org Introduction to the framework: http://openopt.org/Foreword All release details are here: http://op

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: Is this type of forward referencing possible?

2009-03-15 Thread Kooks are people too
On Mar 15, 9:22 am, Miles wrote: >(I > suspect the OP neglected to point out that A and B likely both inherit > from db.Model). > -Miles yes, I did neglect to state that A and B inherit from db.Model. -- http://mail.python.org/mailman/listinfo/python-list

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

2009-03-15 Thread Casey Webster
On Mar 15, 2:00 pm, tinn...@isbd.co.uk wrote: > No, it's perfectly possible applying simple logic.  My reminder > program manages it perfectly well.  I have, for example, two sets of > three monthly reminders. > >     One starts on Jan 19th and repeats three monthly, that means Jan >     19th, Apri

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-15 Thread MRAB
Rhodri James wrote: [snip] Frankly, I'd much rather fix the locale system and extend the format syntax to override the default locale. Perhaps something like financial = Locale(group_sep=",", grouping=[3]) print("my number is {0:10n:financial}".format(1234567)) It's hard to think of a way

Re: PyPy Progress (and Psyco)

2009-03-15 Thread Fuzzyman
On Mar 15, 3:46 pm, Gerhard Häring wrote: > andrew cooke wrote: > > This looks very promising - > >http://www.voidspace.org.uk/python/weblog/arch_d7_2009_03_14.shtml#e1063 > > > I am really looking forwards to PyPy having a final release.  I hope it > > happens. > > Me too. I doubt it, though. Fro

Re: Style question - defining immutable class data members

2009-03-15 Thread Rhodri James
On Sun, 15 Mar 2009 17:55:25 -, Aaron Brady wrote: On Mar 15, 12:39 pm, John Posner wrote: (My apologies if the thread has already covered this.) I believe I understand the WHAT in this situation, but I don't understand the WHY ... [snip] My question is ... WHY does the interprete

Re: PyWin32 for Python 3.x

2009-03-15 Thread Tim Golden
John Nagle wrote: That "wizard" won't even install unless Python 3.0 is "in the registry", which apparently means "installed as the default Python". No, it just means "installed somewhere". I have 6 different versions of Python installed on this box. The choice of which is "the default" is m

Re: PyWin32 for Python 3.x

2009-03-15 Thread John Nagle
Tim Golden wrote: John Nagle wrote: Any idea when PyWin32 will be available for Python 3.x? John Nagle Release 213 is out already: http://sourceforge.net/project/showfiles.php?group_id=78018&package_id=79063&release_id=661475 I think it's still considered a little bit

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-15 Thread Rhodri James
On Sat, 14 Mar 2009 08:20:21 -, Hendrik van Rooyen wrote: "Tim Rowe" wrote: 8< - . If "Finance users and non-professional programmers find the locale approach to be frustrating, arcane and non-obvious" then by all

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

2009-03-15 Thread Ned Deily
In article <49bd42ac$0$512$bed64...@news.gradwell.net>, tinn...@isbd.co.uk wrote: > I was just hoping there was some calendar object in Python which could > do all that for me (I need the handling of 31st and February etc.) Whatever your requirement, chances are dateutil will be of help:

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

2009-03-15 Thread Chris Rebert
On Sun, Mar 15, 2009 at 11:00 AM, wrote: > Roy Smith wrote: >> In article <49bd3ab8$0$510$bed64...@news.gradwell.net>, tinn...@isbd.co.uk >> wrote: >> >> > I have a date in the form of a datetime object and I want to add (for >> > example) three months to it.  At the moment I can't see any very

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

2009-03-15 Thread Andre Engels
On Sun, Mar 15, 2009 at 7:00 PM, wrote: > Roy Smith wrote: >> In article <49bd3ab8$0$510$bed64...@news.gradwell.net>, tinn...@isbd.co.uk >> wrote: >> >> > I have a date in the form of a datetime object and I want to add (for >> > example) three months to it.  At the moment I can't see any very >

Re: how to repeat function definitions less

2009-03-15 Thread alex goretoy
this means i have to check if d[i] is list or dict and iterate over properties -Alex Goretoy http://www.goretoy.com On Sun, Mar 15, 2009 at 1:03 PM, alex goretoy wrote: > I will also actually need to nest it like so > > d={ >"site_name":["s","site",' >> >> sites','site_name','site_names'],

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

2009-03-15 Thread tinnews
Chris Rebert wrote: > On Sun, Mar 15, 2009 at 10:28 AM, wrote: > > I have a date in the form of a datetime object and I want to add (for > > example) three months to it.  At the moment I can't see any very > > obvious way of doing this.  I need something like:- > > > >    myDate = datetime.date.

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

2009-03-15 Thread tinnews
Roy Smith wrote: > In article <49bd3ab8$0$510$bed64...@news.gradwell.net>, tinn...@isbd.co.uk > wrote: > > > I have a date in the form of a datetime object and I want to add (for > > example) three months to it. At the moment I can't see any very > > obvious way of doing this. I need something

Re: how to repeat function definitions less

2009-03-15 Thread alex goretoy
I will also actually need to nest it like so d={ "site_name":["s","site",' > > sites','site_name','site_names'], >"jar_name":["j","jar",'jars','jar_name','jar_names'], "options":{ "src_name":["ss","src","source"], "mod_name":['m',"mod",'mods',"module","modules"], } -Al

Re: Style question - defining immutable class data members

2009-03-15 Thread Aaron Brady
On Mar 15, 12:39 pm, John Posner wrote: > (My apologies if the thread has already covered this.) I believe I understand > the WHAT in this situation, but I don't understand the WHY ... > > Given this class definition: > >   class Cls(object): >       x = 345 > > ... I observe the following, using

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

2009-03-15 Thread Roy Smith
In article <49bd3ab8$0$510$bed64...@news.gradwell.net>, tinn...@isbd.co.uk wrote: > I have a date in the form of a datetime object and I want to add (for > example) three months to it. At the moment I can't see any very > obvious way of doing this. I need something like:- > > myDate = date

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

2009-03-15 Thread Vlastimil Brom
2009/3/15 : > I have a date in the form of a datetime object and I want to add (for > example) three months to it.  At the moment I can't see any very > obvious way of doing this.  I need something like:- > >    myDate = datetime.date.today() >    inc = datetime.timedelta(months=3) >    myDate +=

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

2009-03-15 Thread Chris Rebert
On Sun, Mar 15, 2009 at 10:28 AM, wrote: > I have a date in the form of a datetime object and I want to add (for > example) three months to it.  At the moment I can't see any very > obvious way of doing this.  I need something like:- > >    myDate = datetime.date.today() >    inc = datetime.timed

Re: Style question - defining immutable class data members

2009-03-15 Thread John Posner
(My apologies if the thread has already covered this.) I believe I understand the WHAT in this situation, but I don't understand the WHY ... Given this class definition: class Cls(object): x = 345 ... I observe the following, using IDLE 2.6.1: >>> inst = Cls() >>> Cls.x is inst.x True

Re: Style question - defining immutable class data members

2009-03-15 Thread M R A Barnett
Aaron Brady wrote: [snip] However, in my (opined) interpretation, 'list.append(...) is an in- place operation' is a factual error. In-place operations -also- rebind their 'argument' (FLOBW for lack of better words). 'append' is a by-side-effect operation. However colloquially it's mostly accur

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

2009-03-15 Thread tinnews
I have a date in the form of a datetime object and I want to add (for example) three months to it. At the moment I can't see any very obvious way of doing this. I need something like:- myDate = datetime.date.today() inc = datetime.timedelta(months=3) myDate += inc but, of course, ti

Re: Style question - defining immutable class data members

2009-03-15 Thread Aaron Brady
On Mar 15, 8:56 am, "Rhodri James" wrote: > On Sun, 15 Mar 2009 13:26:17 -, Matthew Woodcraft   > > wrote: > > [snip Gary Herron's explanation of instance attribute lookup > falling back to class attribute lookup] > > > It seems clear to me that Maxim understood all this when he asked his > >

Re: Style question - defining immutable class data members

2009-03-15 Thread Bruno Desthuilliers
Maxim Khitrov a écrit : On Sat, Mar 14, 2009 at 2:07 PM, Gary Herron wrote: Maxim Khitrov wrote: Very simple question on the preferred coding style. I frequently write classes that have some data members initialized to immutable values. For example: class Test(object): def __init__(self):

  1   2   >