Re: __import__ with dict values

2009-03-12 Thread Lie Ryan
Gabriel Genellina wrote: En Thu, 12 Mar 2009 09:27:35 -0200, alex goretoy escribió: note i would still like to be able to do __import__("sys")."path" p = __import__("sys").path That's a convoluted way of doing: import sys p = sys.path (except that the latter one inserts "sys" in the curr

Re: urllib2.URLError:

2009-03-12 Thread Coonay
i update via http proxy cmd>set HTTP_PROXY=http://cache.mycompany.com:3128 cmd>python appcfg.py update myapp URLError: Traceback (most recent call last): File "C:\Program Files\Google\google_appengine\appcfg.py", line 60, in run_file(__file__, globals()) File "C:\Program Files\Google\g

Re: "import" not working?

2009-03-12 Thread Lie Ryan
Scott David Daniels wrote: Aahz wrote: In article , Rhodri James wrote: ... sys.path.append("C:\\DataFileTypes") My preference: sys.path.append(r"C:\DataFileTypes") This doesn't work if you need to add a trailing backslash, though. Also my preference (except, due to aging eyes and bad font

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

2009-03-12 Thread Lie Ryan
Hendrik van Rooyen wrote: "Ulrich Eckhardt" wrote: IOW, why not explicitly say what you want using keyword arguments with defaults instead of inventing an IMHO cryptic, read-only mini-language? Seriously, the problem I see with this proposal is that its aim to be as short as possible actually

Re: loop performance in global namespace (python-2.6.1)

2009-03-12 Thread Lie Ryan
John Machin wrote: On Mar 13, 2:41 am, spir wrote: Le Thu, 12 Mar 2009 11:13:33 -0400, Kent Johnson s'exprima ainsi: Because local name lookup is faster than global name lookup. Local variables are stored in an array in the stack frame and accessed by index. Global names are stored in a dict

Re: __import__ with dict values

2009-03-12 Thread Gabriel Genellina
En Thu, 12 Mar 2009 23:00:30 -0200, alex goretoy escribió: Thank you. This makes sense to me. I will go with sys.modules. Can you give me a good example how to do it getattr way? obj.attr is the same as getattr(obj, "attr") (note the quotes). This makes more sense when you don't know th

Re: unbiased benchmark

2009-03-12 Thread Lie Ryan
Martin P. Hellwig wrote: Philip Semanchuk wrote: On Mar 12, 2009, at 4:20 PM, Daniel Fetchinson wrote: Even more amazingly, it takes approximately 30% less time to say 'ruby' than to say 'python'!!! But "python" scores 55% more points than "ruby" in Scrabble, so that's understandable. It

Re: unbiased benchmark

2009-03-12 Thread Hyunchul Kim
In the system that I tested, results were different. * System was CPU: AMD Phenom(tm) 9950 Quad-Core Processor, Frequency 2600MHz, L2 cache 512KB Memory 3164MB OS: Ubuntu 8.10 When I tried this benchmark for the first time, i...@pc:~$ time python bench.py real0m0.010s user

Re: Minimilistic Python on Linux?

2009-03-12 Thread Gabriel Genellina
En Thu, 12 Mar 2009 16:52:38 -0200, Royce Wilson escribió: Thanks, much better. What exactly do I lose when I launch python without site.py? site.py completes the module search path (sys.path), adding the site-packages directory, processing .pth files, and other per-site and per-user co

Re: Minimilistic Python on Linux?

2009-03-12 Thread Gabriel Genellina
En Thu, 12 Mar 2009 20:39:47 -0200, Royce Wilson escribió: Is there a way to veiw the modules without import sys? Thanks again. sys is a builtin module. You don't add any dependency by importing it, if that's your concern. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo

Re: unbiased benchmark

2009-03-12 Thread Martin P. Hellwig
Philip Semanchuk wrote: On Mar 12, 2009, at 4:20 PM, Daniel Fetchinson wrote: Even more amazingly, it takes approximately 30% less time to say 'ruby' than to say 'python'!!! But "python" scores 55% more points than "ruby" in Scrabble, so that's understandable. It also explains why both la

Re: What happened to NASA at Python? :(

2009-03-12 Thread Mensanator
On Mar 12, 6:22 pm, "Martin v. Löwis" wrote: > > I would have thought someone would have noticed by now. Am I > > the only person who uses Windows? > > No, but perhaps the only person who still uses 2.6.0. 2.6b1, actually. I suppose I ought to get the latest version. > > Regards, > Martin -- ht

Re: from future import scope problem

2009-03-12 Thread John Machin
On Mar 13, 1:20 pm, mykhal wrote: > On Mar 13, 2:58 am, mykhal wrote: > > > > > On Mar 13, 12:46 am, Terry Reedy wrote: > > > > mykhal wrote: > > > > hi, > > > > importing from __future__ seems to have no effect when invoked in > > > > local scope using exec statement. > > > > I supposed > > > >

Re: from future import scope problem

2009-03-12 Thread mykhal
On Mar 13, 2:58 am, mykhal wrote: > On Mar 13, 12:46 am, Terry Reedy wrote: > > > > > > > mykhal wrote: > > > hi, > > > importing from __future__ seems to have no effect when invoked in > > > local scope using exec statement. > > > I supposed > > > > g = {} > > > exec 'from __future__ import divi

Re: from future import scope problem

2009-03-12 Thread mykhal
On Mar 13, 12:46 am, Terry Reedy wrote: > mykhal wrote: > > hi, > > importing from __future__ seems to have no effect when invoked in > > local scope using exec statement. > > I supposed > > > g = {} > > exec 'from __future__ import division' in g > > eval('1/2', g) > > > should yield 0.5, but it

Re: "Byte" type?

2009-03-12 Thread ajaksu
On Feb 24, 1:21 am, John Nagle wrote: >      According to PEP 3137, there should be no distinction between > the two for read purposes.  In 2.6, there is.  That's a bug. No, it's not. It's well documented: http://docs.python.org/whatsnew/2.6.html#pep-3112-byte-literals If that's not precise eno

Re: "Byte" type?

2009-03-12 Thread ajaksu
On Feb 15, 3:10 am, John Nagle wrote: > With "bytearray", the element type is considered to be "unsigned byte", > or so says PEP 3137: "The element data type is always 'B' (i.e. unsigned > byte)." > > Let's try: > > Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)]

Re: __import__ with dict values

2009-03-12 Thread alex goretoy
Gabriel, Thank you. This makes sense to me. I will go with sys.modules. Can you give me a good example how to do it getattr way? currently I am having this problem in my code. Kinda off subject, but not entirely. I set default variable in self.opt after that I import jar.properties into self.opt[

Re: Raw String Question

2009-03-12 Thread MRAB
andrew cooke wrote: MRAB wrote: [...] The other special case is with \u in a Unicode string: >>> ur"\u0041" u'A' this isn't true for 3.0: r"\u0041" '\\u0041' (there's no "u" because it's a string, not a bytes literal) and as far as i can tell, that's correct behaviour according to the d

Re: Raw String Question

2009-03-12 Thread andrew cooke
MRAB wrote: [...] > The other special case is with \u in a Unicode string: > > >>> ur"\u0041" > u'A' this isn't true for 3.0: >>> r"\u0041" '\\u0041' (there's no "u" because it's a string, not a bytes literal) and as far as i can tell, that's correct behaviour according to the docs. andrew -

Re: from future import scope problem

2009-03-12 Thread Terry Reedy
mykhal wrote: hi, importing from __future__ seems to have no effect when invoked in local scope using exec statement. I supposed g = {} exec 'from __future__ import division' in g eval('1/2', g) should yield 0.5, but it yields 0. is it OK, or a bug? Please to read the fine manual. tjr ps.

Re: Minimilistic Python on Linux?

2009-03-12 Thread Christian Heimes
Royce Wilson schrieb: > Thanks, much better. What exactly do I lose when I launch python without > site.py? Why do you want to strip Python off everything useful? A bare interpreter without the standard library isn't useful for anything. Christian -- http://mail.python.org/mailman/listinfo/pytho

Re: Raw String Question

2009-03-12 Thread MRAB
Jim Garrison wrote: Tim Chase wrote: >>> r"a\" SyntaxError: EOL while scanning string literal (, line 1) It seems the parser is interpreting the backslash as an escape character in a raw string if the backslash is the last character. Is this expected? Yep...as documented[1], "even a raw s

Re: What happened to NASA at Python? :(

2009-03-12 Thread Martin v. Löwis
> I would have thought someone would have noticed by now. Am I > the only person who uses Windows? No, but perhaps the only person who still uses 2.6.0. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Raw String Question

2009-03-12 Thread Miles
On Thu, Mar 12, 2009 at 3:28 PM, Jim Garrison wrote: > OK, I'm curious as to the reasoning behind saying that > >   When an 'r' or 'R' prefix is present, a character following a >   backslash is included in the string without change, and all >   backslashes are left in the string. > > which sounds

Re: What happened to NASA at Python? :(

2009-03-12 Thread Mensanator
On Mar 12, 3:11 pm, "Martin v. Löwis" wrote: > >>> The Python home page no longer sports a promotion from NASA. What > >>> happened, did we lose NASA. Where did they go? > >> The python.org guys just decided it would be nice to have some > >> different graphics. > > > If they were so keen on new g

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Vlastimil Brom
2009/3/12 Christian Heimes : > Vlastimil Brom wrote: >> def path_from_pardir(path): >>     return >> os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), >> os.pardir, path))) >> #  __file__ is substituted with sys.path[0] if not present >> >> real_path = path_from_pardir("txt

Re: Minimilistic Python on Linux?

2009-03-12 Thread Royce Wilson
Is there a way to veiw the modules without import sys? Thanks again. On Thu, Mar 12, 2009 at 1:52 PM, Royce Wilson wrote: > Thanks, much better. What exactly do I lose when I launch python without > site.py? > > > On Wed, Mar 11, 2009 at 10:27 PM, Gabriel Genellina < > gagsl-...@yahoo.com.ar> wr

Re: pymssql text type

2009-03-12 Thread marc wyburn
On Mar 12, 3:36 pm, a...@pythoncraft.com (Aahz) wrote: > [posted and e-mailed, please reply to group] > > In article <851ed9db-2561-48ad-b54c-95f96a7fa...@q9g2000yqc.googlegroups.com>, > marcwyburn  wrote: > > >Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the > >follwoing error

Re: Python 2.7 MSI / pywin32 snapshots [was: Windows install to custom location ...]

2009-03-12 Thread Tim Golden
Scott David Daniels wrote: Tim Golden wrote: Scott David Daniels wrote: Tim Golden wrote: ... Anyhow, at the end I have a working Python 2.7a0 running under Windows. Do you mean 3.1a0? As far as I know, 2.7a0 requires the use of the time machine, as it is expected to be 3 months out. If yo

Re: loop performance in global namespace (python-2.6.1)

2009-03-12 Thread John Machin
On Mar 13, 2:41 am, spir wrote: > Le Thu, 12 Mar 2009 11:13:33 -0400, > Kent Johnson s'exprima ainsi: > > > Because local name lookup is faster than global name lookup. Local > > variables are stored in an array in the stack frame and accessed by > > index. Global names are stored in a dict and a

Re: A tale of two execs

2009-03-12 Thread Aahz
[slowly catching up...] In article <9095ae87-c11d-4439-aeed-05533c610...@m24g2000vbp.googlegroups.com>, Carl Banks wrote: > >Distributing the interpreter doesn't look quite as silly as it did >this morning now, does it? +1 QOTW, three weeks late -- Aahz (a...@pythoncraft.com) <*>

Re: finally successful in ods with python, just one help needed.

2009-03-12 Thread John Machin
On Mar 13, 7:17 am, Krishnakant wrote: > Hello all specially John and Terry. Hello again Krishnakant, I see that you haven't had the evil spirits exorcised from your mail/ news client ... it's hijacked a thread again :-( > > I finally got my way around odfpy and could manage the spreadsheet to

Re: unbiased benchmark

2009-03-12 Thread John Machin
On Mar 13, 7:58 am, Paul Rubin wrote: > Daniel Fetchinson writes: > > Even more amazingly, it takes approximately 30% less time to say > > 'ruby' than to say 'python'!!! > > That is not a fair comparison.  Python has two more letters than > Ruby, so you are accomplis

Re: unbiased benchmark

2009-03-12 Thread Grant Edwards
On 2009-03-12, Aahz wrote: > In article , > Grant Edwards wrote: >>On 2009-03-12, Sam Ettessoc wrote: >>> >>> Dear sir, >> >>[Rather odd "benchmark" troll elided.] > > Looks more like humor than a troll... Upon re-reading the post, I think you're right. -- Grant Edwards gra

Re: unbiased benchmark

2009-03-12 Thread Paul Rubin
Daniel Fetchinson writes: > Even more amazingly, it takes approximately 30% less time to say > 'ruby' than to say 'python'!!! That is not a fair comparison. Python has two more letters than Ruby, so you are accomplishing more when you say it. -- http://mail.python.org/mailman/listinfo/python-lis

from future import scope problem

2009-03-12 Thread mykhal
hi, importing from __future__ seems to have no effect when invoked in local scope using exec statement. I supposed g = {} exec 'from __future__ import division' in g eval('1/2', g) should yield 0.5, but it yields 0. is it OK, or a bug? -- http://mail.python.org/mailman/listinfo/python-list

Re: unbiased benchmark

2009-03-12 Thread Aahz
In article , Grant Edwards wrote: >On 2009-03-12, Sam Ettessoc wrote: >> >> Dear sir, > >[Rather odd "benchmark" troll elided.] Looks more like humor than a troll... -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "All problems in computer science can be solve

Re: Getting final url when original url redirects

2009-03-12 Thread Albert Hopkins
On Thu, 2009-03-12 at 12:57 -0700, IanR wrote: > I'm processing RSS content from a # of given sources. Most of the > time the url given by the RSS feed redirects to the real URL (I'm > guessing they do this for tracking purposes) > > For example. > > This is a url that I get from and RSS feed, >

Re: Getting final url when original url redirects

2009-03-12 Thread Philip Semanchuk
On Mar 12, 2009, at 3:57 PM, IanR wrote: I'm processing RSS content from a # of given sources. Most of the time the url given by the RSS feed redirects to the real URL (I'm guessing they do this for tracking purposes) For example. This is a url that I get from and RSS feed, http://www.pheedc

Re: unbiased benchmark

2009-03-12 Thread Philip Semanchuk
On Mar 12, 2009, at 4:20 PM, Daniel Fetchinson wrote: Even more amazingly, it takes approximately 30% less time to say 'ruby' than to say 'python'!!! But "python" scores 55% more points than "ruby" in Scrabble, so that's understandable. It also explains why both languages are much better

Re: unbiased benchmark

2009-03-12 Thread Albert Hopkins
On Thu, 2009-03-12 at 13:25 -0700, Chris Rebert wrote: > On Thu, Mar 12, 2009 at 1:07 PM, Sam Ettessoc wrote: > > I would like to share a benchmark I did. The computer used was a > > 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS > > 10.5.6 and a lots of software running (a t

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Christian Heimes
Vlastimil Brom wrote: > def path_from_pardir(path): > return > os.path.realpath(os.path.normpath(os.path.join(os.path.dirname(__file__), > os.pardir, path))) > # __file__ is substituted with sys.path[0] if not present > > real_path = path_from_pardir("txt/text_1.txt") > > The above seems to

Re: question on msvcrt.dll versioning

2009-03-12 Thread Martin v. Löwis
rogerdpack wrote: > It appears from sites like > http://www.develer.com/oss/GccWinBinaries > at the bottom that at least this developer made an effort to link > against the same version of msvcrt.dll that the python exe was > compiled with [ex: vc2008 -> msvcr90.dll]. Is this pain necessary? It d

Re: unbiased benchmark

2009-03-12 Thread Chris Rebert
On Thu, Mar 12, 2009 at 1:07 PM, Sam Ettessoc wrote: > I would like to share a benchmark I did. The computer used was a > 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS > 10.5.6 and a lots of software running (a typical developer > workstation). > > Python benchmark: > HAMBUR

finally successful in ods with python, just one help needed.

2009-03-12 Thread Krishnakant
Hello all specially John and Terry. I finally got my way around odfpy and could manage the spreadsheet to some extent. However I now have a small but unexpected problem. I would be very happy if some one could help me understand why is the text not getting centered in the spreadsheet I create.

Re: unbiased benchmark

2009-03-12 Thread Daniel Fetchinson
> Dear sir, > > I would like to share a benchmark I did. The computer used was a > 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS > 10.5.6 and a lots of software running (a typical developer > workstation). > > Python benchmark: > HAMBURGUESA:benchmark sam$ echo 1+1 > bench.py

Re: unbiased benchmark

2009-03-12 Thread Grant Edwards
On 2009-03-12, Sam Ettessoc wrote: > Dear sir, [Rather odd "benchmark" troll elided.] > Sam Ettessoc > p.s. I have no affiliation with ruby or python devloppement team. A fact for which I'm sure both communities are grateful. -- Grant Edwards grante Yow! I feel

Re: What happened to NASA at Python? :(

2009-03-12 Thread Martin v. Löwis
>>> The Python home page no longer sports a promotion from NASA. What >>> happened, did we lose NASA. Where did they go? >> The python.org guys just decided it would be nice to have some >> different graphics. > > If they were so keen on new graphics, why did 2.6 revert > to the same icons that 2.

Re: Raw String Question

2009-03-12 Thread Albert Hopkins
> > Yep...as documented[1], "even a raw string cannot end in an odd number > > of backslashes". > > So how do you explain this? > > >>> r'a\'b' > "a\\'b" That doesn't "end in an odd number of backslashes." Python is __repr__esenting a raw string as a "regular" string. Literally they

unbiased benchmark

2009-03-12 Thread Sam Ettessoc
Dear sir, I would like to share a benchmark I did. The computer used was a 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS 10.5.6 and a lots of software running (a typical developer workstation). Python benchmark: HAMBURGUESA:benchmark sam$ echo 1+1 > bench.py HAMBURGUESA:ben

Getting final url when original url redirects

2009-03-12 Thread IanR
I'm processing RSS content from a # of given sources. Most of the time the url given by the RSS feed redirects to the real URL (I'm guessing they do this for tracking purposes) For example. This is a url that I get from and RSS feed, http://www.pheedcontent.com/click.phdo?i=d22e9bc7641aab8a05665

Re: Raw String Question

2009-03-12 Thread Jim Garrison
Tim Chase wrote: >>> r"a\" SyntaxError: EOL while scanning string literal (, line 1) It seems the parser is interpreting the backslash as an escape character in a raw string if the backslash is the last character. Is this expected? Yep...as documented[1], "even a raw string cannot end in a

Re: Raw String Question

2009-03-12 Thread Duncan Booth
Jim Garrison wrote: > OK, I'm curious as to the reasoning behind saying that > > When an 'r' or 'R' prefix is present, a character following a > backslash is included in the string without change, and all > backslashes are left in the string. > > which sounds reasonable, but then sa

Re: cross platform accessing paths (windows, linux ...)

2009-03-12 Thread Vlastimil Brom
> On Thu, Mar 12, 2009 at 8:10 AM, Vlastimil Brom > wrote: >> >> Hi all, >> I'd like to ask for some advice on how to acomplish file access in a >> cross platform way. >> ... >> Any hints or comments are much appreciated; thanks in advance! >> >> regards, >>   Vlasta 2009/3/12 Mike Mazurek : > Y

RE: Question on periods in strings

2009-03-12 Thread Philip Bloom
Thanks. I now know the cause of this, the suggestion to fling it in a few languages made it obvious. All of them were sharing the issue. Specifically that Trend MicroOffice Scan was the stalling factor, which was significantly boosting write times and if the write had any periods it would sen

Re: Raw String Question

2009-03-12 Thread Nick Craig-Wood
Jim Garrison wrote: > >>> r"a\b" >'a\\b' > >>> r"a\" >SyntaxError: EOL while scanning string literal (, line 1) > >>> r"a\ " >'a\\ ' > >>> r"a\"" >'a\\"' > > It seems the parser is interpreting the backslash as an escape > character in a raw string if the backslash is th

Re: Raw String Question

2009-03-12 Thread Jim Garrison
Tim Chase wrote: >>> r"a\" SyntaxError: EOL while scanning string literal (, line 1) It seems the parser is interpreting the backslash as an escape character in a raw string if the backslash is the last character. Is this expected? Yep...as documented[1], "even a raw string cannot end in a

Re: What happened to NASA at Python? :(

2009-03-12 Thread r
On Mar 12, 3:31 am, Michele Simionato wrote: > That's pretty much impossible. I am sure NASA uses all programming > languages in existence, > plus probably many internal ones we never heard of. True but... >>> all([NASA.does_endorse(lang) for lang in NASA['languages']]) False As the code sugge

Re: loop performance in global namespace (python-2.6.1)

2009-03-12 Thread Scott David Daniels
Poor Yorick wrote: In the following snippet, the loop in the global namespace takes twice as long as the loop in the function namespace. Why? Locals are known to have no outside interaction, and so are not looked up by name. your code could have a thread that did, global counter

Re: loop performance in global namespace (python-2.6.1)

2009-03-12 Thread Duncan Booth
Poor Yorick wrote: > In the following snippet, the loop in the global namespace takes twice > as long as the loop in the function namespace. Why? > Accessing global variables is generally slower than accessing local variables. Locals are effectively stored in a vector so the bytecode can go s

Re: Minimilistic Python on Linux?

2009-03-12 Thread Royce Wilson
Thanks, much better. What exactly do I lose when I launch python without site.py? On Wed, Mar 11, 2009 at 10:27 PM, Gabriel Genellina wrote: > En Thu, 12 Mar 2009 00:41:18 -0200, Royce Wilson > escribió: > >> On Wed, Mar 11, 2009 at 9:33 PM, Royce Wilson wrote: >> >> Thanks for the quick respo

Re: Building python 64-bit on OS 10.5?

2009-03-12 Thread Ned Deily
In article <15e4667e0903121005v74d8e971ve57add393cf90...@mail.gmail.com>, > I've two questions: > > 1) I've been trying to building python as a 64-bit version on OS 10.5. > I'm not too familiar with building python from scratch, and a number of > basic attempts made from piecing together things

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

2009-03-12 Thread Scott David Daniels
Raymond Hettinger wrote: <... a generally interesting PEP...> Missing from this PEP: output below the decimal point. show results for something like: format(12345.54321, "15,.5f") --> ' 12,345.543,21' Explain the interaction on sizes and lengths (which numbers are digits, which are length [

Re: Raw String Question

2009-03-12 Thread Tim Chase
>>> r"a\" SyntaxError: EOL while scanning string literal (, line 1) It seems the parser is interpreting the backslash as an escape character in a raw string if the backslash is the last character. Is this expected? Yep...as documented[1], "even a raw string cannot end in an odd number of b

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

2009-03-12 Thread Paul Rubin
Raymond Hettinger writes: > I found the Common Lisp spec for this and added it to the PEP. Ah, cool, I simultaneously looked for it and posted about it. -- http://mail.python.org/mailman/listinfo/python-list

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

2009-03-12 Thread Paul Rubin
Raymond Hettinger writes: > In my quick research, it looks like many languages offer > nothing more than the usual C style % formatting and defer > the rest for a local aware module. Hendrik van Rooyen's mention of Cobol's "picture" (aka PIC) specifications might be added to the list. Cautionary

Re: __import__ with dict values

2009-03-12 Thread Gabriel Genellina
En Thu, 12 Mar 2009 09:27:35 -0200, alex goretoy escribió: note i would still like to be able to do __import__("sys")."path" p = __import__("sys").path That's a convoluted way of doing: import sys p = sys.path (except that the latter one inserts "sys" in the current namespace) maybe if

Raw String Question

2009-03-12 Thread Jim Garrison
I'm an experienced Perl developer learning Python, but I seem to be missing something about raw strings. Here's a transcript of a Python shell session: Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more infor

Re: Python 2.7 MSI / pywin32 snapshots [was: Windows install to custom location ...]

2009-03-12 Thread Scott David Daniels
Tim Golden wrote: Scott David Daniels wrote: Tim Golden wrote: ... Anyhow, at the end I have a working Python 2.7a0 running under Windows. Do you mean 3.1a0? As far as I know, 2.7a0 requires the use of the time machine, as it is expected to be 3 months out. If you do get an installer built,

Re: "import" not working?

2009-03-12 Thread Scott David Daniels
Aahz wrote: In article , Rhodri James wrote: ... sys.path.append("C:\\DataFileTypes") My preference: sys.path.append(r"C:\DataFileTypes") This doesn't work if you need to add a trailing backslash, though. Also my preference (except, due to aging eyes and bad fonts, I prefer single quotes un

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

2009-03-12 Thread Raymond Hettinger
[Paul Rubin] > I think Common Lisp has a feature for formatting thousands. I found the Common Lisp spec for this and added it to the PEP. Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: "Byte" type?

2009-03-12 Thread Scott David Daniels
John Nagle wrote: Martin v. Löwis wrote: Please don't call something dumb that you don't fully understand ...- do you have to convert twice? Depends on how you write your code. If you use the bytearray type (which John didn't, despite his apparent believe that he did), then no conversion a

Re: PythonWin, python thread and PostQuitMessage?

2009-03-12 Thread Gabriel Genellina
En Thu, 12 Mar 2009 07:21:35 -0200, escribió: I'm not so much involved in any Windows programming however I needed to write a client for the Windows platform. I have this very simple question which I've been unable to answer. I'm listening for keyboard strokes using the pyhook library. I'm doin

Re: Candidate for a new itertool

2009-03-12 Thread pruebauno
On Mar 7, 8:47 pm, Raymond Hettinger wrote: > The existing groupby() itertool works great when every element in a > group has the same key, but it is not so handy when groups are > determined by boundary conditions. > > For edge-triggered events, we need to convert a boundary-event > predicate to

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

2009-03-12 Thread Jason Scheirer
On Mar 10, 3:34 pm, bdb112 wrote: > Q1/ I run a standard python ditribution with ipython and readline > under cygwin.  The tab filename completion works fine in the OS (bash > shell) as expected, and tab filename completion at the ipython command > line works, but with MS style path separators (ba

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Luis Zarrabeitia
On Thursday 12 March 2009 07:45:55 am Dotan Cohen wrote: > I do not think that is the best way to go about learning Python. Why > learn an arguably depreciating version when the new version is > available. Because it is not only the language that matters, you also need the libraries to accomplis

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

2009-03-12 Thread Raymond Hettinger
[Paul Rubin] > It would be nice if the PEP included a comparison between the proposed > scheme and how it is done in other programs and languages. Good idea. I'm hoping that people will post those here. In my quick research, it looks like many languages offer nothing more than the usual C style %

PyCon Update

2009-03-12 Thread Raymond Hettinger
As of today, we still have rooms at the Hyatt. If you haven't registered yet and want to attend, it is not sold out. http://us.pycon.org/2009/ Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: python contextmanagers and ruby blocks

2009-03-12 Thread Aahz
In article , Alia K wrote: >Aahz wrote: >> >> Longer answer: the way in Python to achieve the full power of Ruby >> blocks is to write a function. > >You are most likely right... there is probably no need to introduce >ruby-like blocks to python where iteration comes naturally with list >comprehe

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

2009-03-12 Thread Paul Rubin
Raymond Hettinger writes: > FWIW, posted a cleaned-up version of the proposal at > http://www.python.org/dev/peps/pep-0378/ It would be nice if the PEP included a comparison between the proposed scheme and how it is done in other programs and languages. For example, I think Common Lisp has a f

Python/Django forum-building software Snap/SCT, any reviews?

2009-03-12 Thread John Crawford
I'm looking for good open-source software for forums. There is a *lot* out there, for instance Lussumo's Vanilla gets good reviews, but most are PHP-based, and I would obviously prefer to use Python, with or without Django. Two packages that are Django-based that I have found, are Snap and SCT.

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

2009-03-12 Thread Raymond Hettinger
On Mar 12, 7:51 am, prueba...@latinmail.com wrote: > On Mar 12, 3:30 am, Raymond Hettinger wrote: > > > > > If anyone here is interested, here is a proposal I posted on the > > python-ideas list. > > > The idea is to make numbering formatting a little easier with the new > > format() builtin > > i

Re: Input data from .txt file and object array problem

2009-03-12 Thread SamuelXiao
On Mar 12, 11:17 pm, Piet van Oostrum wrote: > > SamuelXiao (S) wrote: > >S> I want to input data by using pickle > >S> First of all, I have a database.txt > >S> The content is like: > >S> AAA,aaalink > >S> BBB,bbblink > >S> CCC,ccclink > >S> ...,... > >S> AAA,BBB,CCC is Language name, and aa

Re: how to assert that method accepts specific types

2009-03-12 Thread Aahz
In article <3f26a2f1-94cf-4083-9bda-7076959ad...@k19g2000yqg.googlegroups.com>, Darren Dale wrote: > >class Test(object): >@accepts(int) >def check(self, obj): >print obj > >t = Test() >t.check(1) > >but now I want Test.check to accept an instance of Test as well. Does >anyone kno

Re: "import" not working?

2009-03-12 Thread Aahz
In article , Rhodri James wrote: > >Just so that we're clear, this is a *really* *bad* habit to get into. >Not appending to sys.path, though that isn't often a good idea, but >failing to escape your backslashes. This works because '\D' happens >not to be a valid escape sequence: if your directory

Re: pymssql text type

2009-03-12 Thread Aahz
[posted and e-mailed, please reply to group] In article <851ed9db-2561-48ad-b54c-95f96a7fa...@q9g2000yqc.googlegroups.com>, marc wyburn wrote: >Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the >follwoing error. > >(, OperationalError("SQL Server >message 102, severity 15, st

question on msvcrt.dll versioning

2009-03-12 Thread rogerdpack
It appears from sites like http://www.develer.com/oss/GccWinBinaries at the bottom that at least this developer made an effort to link against the same version of msvcrt.dll that the python exe was compiled with [ex: vc2008 -> msvcr90.dll]. Is this pain necessary? Are there known drawbacks to not

Re: Killing subservient threads

2009-03-12 Thread Aahz
In article , Christian Heimes wrote: >Gabriel Genellina wrote: >> >> 1) make the child window set a flag in the thread (let's say, >> t.terminate = True). And make the polling thread check the flag >> periodically (you possibly already have a loop there - just break the >> loop when you detect th

Re: Input data from .txt file and object array problem

2009-03-12 Thread Piet van Oostrum
> SamuelXiao (S) wrote: >S> I want to input data by using pickle >S> First of all, I have a database.txt >S> The content is like: >S> AAA,aaalink >S> BBB,bbblink >S> CCC,ccclink >S> ...,... >S> AAA,BBB,CCC is Language name, and aaalink,bbblink,ccclink is their >S> respective link. >S> I wan

default shelve on linux corrupts, does different DB system help?

2009-03-12 Thread Paul Sijben
I have the problem that my shelve(s) sometimes corrupt (looks like it has after python has run out of threads). I am using the default shelve so on linux I get the dbhash version. Is there a different DB type I can choose that is known to be more resilient? And if so, what is the elegant way of do

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

2009-03-12 Thread pruebauno
On Mar 12, 3:30 am, Raymond Hettinger wrote: > If anyone here is interested, here is a proposal I posted on the > python-ideas list. > > The idea is to make numbering formatting a little easier with the new > format() builtin > in Py2.6 and Py3.0:  http://docs.python.org/library/string.html#format

Re: How to send an email with GMail in Python from Windows

2009-03-12 Thread gordyt
Howdy Avinash, Here is a simple example for you. from smtplib import SMTP HOST = "smtp.gmail.com" PORT = 587 ACCOUNT = ""# put your gmail email account here PASSWORD = "" # put your gmail email password here def send_email(to_addrs, subject, msg): server = SMTP(HOST,PORT) s

Re: How to send an email with GMail in Python from Windows

2009-03-12 Thread dorzey
You might want to try - http://libgmail.sourceforge.net/. This is a Python binding for GMail; I've used it a little and it did the job for me. Dorzey -- http://mail.python.org/mailman/listinfo/python-list

How to send an email with GMail in Python from Windows

2009-03-12 Thread ∂ √ ¡ ŋ ∂ ♪ ђ
Hi Can somebody help me with sending an email using Python from GMail Here's what I tried but it fails always. import smtplib import base64 smtpserver = 'smtp.gmail.com' AUTHREQUIRED = 0 # if you need to use SMTP AUTH set to 1 s

Re: Stopping SocketServer on Python 2.5

2009-03-12 Thread David George
On 2009-03-12 08:03:06 +, "Mark Tolonen" said: "Falcolas" wrote in message news:1b6a95a4-5680-442e-8ad0-47aa9ea08...@w1g2000prk.googlegroups.com... On Mar 11, 1:11 pm, David George wrote: Again, problem here is the issue of being unable to kill the server while it's waiting on a reque

Re: NameError: name 'execfile' is not defined

2009-03-12 Thread Henrik Bechmann
On Mar 12, 3:15 am, Gary Herron wrote: > Henrik Bechmann wrote: > > Newbie issue: > > > I downloadedhttp://www.python.org/download/releases/3.0.1/(windows > > insaller), opened the interpreter, wrote a print "Hello World" program > > in helloworld.py, and in the interpreter typed > > > execfile("h

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Henrik Bechmann
On Mar 12, 7:45 am, Dotan Cohen wrote: > > Welcome to the list.  As a newbie myself, I ran into the Python3 vrs > > 2.6 issue.  May I suggest starting with 2.6?  There is many more books > > and internet stuff you can learn with in 2.6 - and the examples will > > work. As Garry wrote, once you und

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Paul Boddie
On 12 Mar, 12:45, Dotan Cohen wrote: > [starting with 2.6] > I do not think that is the best way to go about learning Python. Why > learn an arguably depreciating version when the new version is > available. I agree that there are not many tutorial written for Python > 3 however there are enough

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

2009-03-12 Thread John Machin
On Mar 12, 9:56 pm, Raymond Hettinger wrote: > [Ulrich Eckhardt] > > > IOW, why not explicitly say what you want using keyword arguments with > > defaults instead of inventing an IMHO cryptic, read-only mini-language? > > That makes sense to me but I don't think that's the way the format() > built

  1   2   >