En Thu, 04 Jun 2009 22:18:24 -0300, Ron Garret
escribió:
Python 2.6.2 on OS X 10.5.7:
[...@mickey:~]$ echo $LANG
en_US.UTF-8
[...@mickey:~]$ cat frob.py
#!/usr/bin/env python
print u'\u03BB'
[...@mickey:~]$ ./frob.py
ª
[...@mickey:~]$ ./frob.py > foo
Traceback (most recent call last):
Fil
In article ,
Lawrence D'Oliveiro wrote:
> In message , Ron
> Garret wrote:
>
> > Python 2.6.2 on OS X 10.5.7:
>
> Same result, Python 2.6.1-3 on Debian Unstable. My $LANG is en_NZ.UTF-8.
>
> > ... I always thought one of the fundamental
> > invariants of unix processes was that there's no wa
Ron Garret writes:
> Python 2.6.2 on OS X 10.5.7:
>
> [...@mickey:~]$ echo $LANG
> en_US.UTF-8
> [...@mickey:~]$ cat frob.py
> #!/usr/bin/env python
> print u'\u03BB'
>
> [...@mickey:~]$ ./frob.py
> ª
> [...@mickey:~]$ ./frob.py > foo
> Traceback (most recent call last):
> File "./frob.py",
Ben Finney writes:
> You achieve this by one of two methods:
Failed to update this statement after an edit. That should be “by
following this method”.
--
\ “I used to be a proofreader for a skywriting company.” —Steven |
`\Wri
On Thu, 04 Jun 2009 18:24:48 -0700, Zac Burns wrote:
> The section of code below, which simply gets the __file__ attribute of
> the imported modules, takes more than 1/3 of the total startup time.
How do you know? What are you using to time it?
[...]
> From once python starts and loads the main
On Thu, Jun 4, 2009 at 10:06 PM, Ben Finney
> wrote:
> Ron Garret writes:
>
> > Python 2.6.2 on OS X 10.5.7:
> >
> > [...@mickey:~]$ echo $LANG
> > en_US.UTF-8
> > [...@mickey:~]$ cat frob.py
> > #!/usr/bin/env python
> > print u'\u03BB'
> >
> > [...@mickey:~]$ ./frob.py
> > ª
> > [...@mickey:~]
In article
<77e831100906041718k4b4f54d9v29729449c50f...@mail.gmail.com>,
Vincent Davis wrote:
> On Thu, Jun 4, 2009 at 1:41 PM, Ned Deily wrote:
>[...]
> > $ /opt/local/bin/python2.5
> > Python 2.5.4 (r254:67916, May 4 2009, 01:40:08)
> > [GCC 4.0.1 (Apple Inc. build 5490)] on darwin
> > Type
En Thu, 04 Jun 2009 22:24:48 -0300, Zac Burns escribió:
The section of code below, which simply gets the __file__ attribute of
the imported modules, takes more than 1/3 of the total startup time.
Given that many modules are complicated and even have dynamic
population this figure seems very hig
On Jun 5, 1:18 am, Carl Banks wrote:
> It's really the only sane way to handle it, odd though it may seem in
> this narrow case. In Python nested functions have to be able to
> reference the current value of a variable because of use cases like
> this:
>
> def func():
> def printx():
>
On Thu, 04 Jun 2009 18:26:49 -0700, chad wrote:
> Let's say I have a list of 5 files. Now lets say that one of the files
> reads nude333.txt instead of nude3.txt. When this happens, the program
> generates an error and quits. What I want it to do is just skip over the
> bad file and continue on wi
On Fri, 05 Jun 2009 02:21:07 +, Steven D'Aprano wrote:
> You corrected this to:
>
> for module in sys.modules.itervalues():
>try:
>path = module.__file__
>except (AttributeError, ImportError):
>return
>
> (1) You're not importing anything insid
Hey guys, try using urlretrieve() in Python 3.0.1 on the following
URL:
http://softlayer.dl.sourceforge.net/sourceforge/wxwindows/wxMSW-2.8.10.zip
Have it save the ZIP to any destination directory. For me, this only
downloads about 40KB before it stops without any error at all. Any
reason why thi
Zac Burns wrote:
The section of code below, which simply gets the __file__ attribute of
the imported modules, takes more than 1/3 of the total startup time.
Given that many modules are complicated and even have dynamic
population this figure seems very high to me. it would seem very high
if one j
In article ,
Ron Garret wrote:
> Python 2.6.2 on OS X 10.5.7:
>
> [...@mickey:~]$ echo $LANG
> en_US.UTF-8
> [...@mickey:~]$ cat frob.py
> #!/usr/bin/env python
> print u'\u03BB'
>
> [...@mickey:~]$ ./frob.py
> ª
> [...@mickey:~]$ ./frob.py > foo
> Traceback (most recent call last):
> File
In article <89d21aec-5d39-4d1f-91b9-776da3506...@i6g2000yqj.googlegroups.com>,
Jonathan Nelson wrote:
>
>I'm trying to add a feedreader element to my django project. I'm
>using Mark Pilgrim's great feedparser library. I've used it before
>without any problems. I'm getting a TypeError I can't f
Steven D'Aprano REMOVE.THIS.cybersource.com.au> writes:
>
> On Fri, 05 Jun 2009 02:21:07 +, Steven D'Aprano wrote:
>
> > You corrected this to:
> >
> > for module in sys.modules.itervalues():
> >try:
> >path = module.__file__
> >except (AttributeError, Impor
This might be a off topic but this also seemed like a good place to ask.
I have an application (several) I would like to develop. Parts of it I
can do but parts I would like to outsource. I am thinking mostly of
outsourcing most of my django (or similar) work and otherwise have
some custom classes
On Jun 4, 7:36 pm, Steven D'Aprano
wrote:
> On Thu, 04 Jun 2009 18:26:49 -0700, chad wrote:
> > Let's say I have a list of 5 files. Now lets say that one of the files
> > reads nude333.txt instead of nude3.txt. When this happens, the program
> > generates an error and quits. What I want it to do i
Scott David Daniels wrote:
[snipped]
When you evaluate a lambda expression, the default args are evaluated,
but the expression inside the lambda body is not. When you apply that
evaluated lambda expression, the expression inside the lambda body is
is evaluated and returned.
But that's not real
On Thu, 04 Jun 2009 09:47:05 -0700, Mensanator wrote:
> After all, everybody knows that for m items taken n at a time, the
> counts are
>
> perm w/repl = m**n
> comb w/repl = (m+n-1)!/(n!(m-1)!)
> perm wo/repl = m!/(m-n)!
> comb wo/repl = m!/(n!(m-n)!)
"Everybody" knows? Be careful with those
Ned Deily writes:
> $ python2.6 -c 'import sys; print sys.stdout.encoding, \
> sys.stdout.isatty()'
> UTF-8 True
> $ python2.6 -c 'import sys; print sys.stdout.encoding, \
> sys.stdout.isatty()' > foo ; cat foo
> None False
So shouldn't the second case also detect UTF-8? The filesystem knows
i
Lawrence D'Oliveiro wrote:
In message , Allen
Fowler wrote:
1) Do you use virtualpython?
No idea what that is.
2) How do you load the modules in your lib directory?
At the beginning of my scripts, I have a sequence like
test_mode = False # True for testing, False for
Carl Banks wrote:
The way to handle the issue you are seeing is to create a new scope
with a variable the remains at the value you want to close upon:
create_const_function(value):
def func():
return value
c =create_const_function(i) for i in range(11, 16))
Or you can do it the sl
Suppose I have two lists, list_a and list_b, and I want to iterate
over both as if they were a single list. E.g. I could write:
for x in list_a:
foo(x)
for x in list_b:
foo(x)
But is there a less cumbersome way to achieve this? I'm thinking
of something in the same vein as Perl's:
fo
On Thu, Jun 4, 2009 at 9:07 PM, kj wrote:
>
>
> Suppose I have two lists, list_a and list_b, and I want to iterate
> over both as if they were a single list. E.g. I could write:
>
> for x in list_a:
> foo(x)
> for x in list_b:
> foo(x)
>
> But is there a less cumbersome way to achieve this?
On Wed, 03 Jun 2009 01:00:15 +0200, Stef Mientki wrote:
> Sorry,
> but I realy don't understand the difference between the documents on my
> desk and a python file in a subpath.
Let's say you have a file called "parrot", containing some arbitrary data.
You read it with open('parrot').read(), and
Chris Rebert writes:
> On Thu, Jun 4, 2009 at 9:07 PM, kj wrote:
> >
> >
> > Suppose I have two lists, list_a and list_b, and I want to iterate
> > over both as if they were a single list.
[…]
> Just add the lists together.
>
> for x in list_a + list_b:
> foo(x)
Which, more precisely, crea
"willgun" wrote in message
news:h08c5e$au...@news.cn99.com...
By the way ,what does 'best regards' means at the end of a mail?
I think 恭祝 may be a good translation.
-Mark
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 4, 8:37 pm, Johnny Chang wrote:
> I have a large list of strings that I am unpacking
> and splitting, and I want each one to be on a new line.
>
> An example:
>
> recs =
> 'asdfasdfasdfasdfasdf','asdfasdfasdfasdfasdf','asdfasdfasdfasdfasdf'
> [(rec.split('f')) for rec in recs]
>
> output:
>
>> I have a large list of strings that I am unpacking
>> and splitting, and I want each one to be on a new line.
>>
>> An example:
>>
>> recs =
>> 'asdfasdfasdfasdfasdf','asdfasdfasdfasdfasdf','asdfasdfasdfasdfasdf'
>> [(rec.split('f')) for rec in recs]
>>
>> output:
>>
>> [['asd', 'asd', 'asd', 'a
In article <05937a34-5490-4b31-9f07-a319b44dd...@r33g2000yqn.googlegroups.com>,
Michele Simionato wrote:
>
>Actually, in Scheme one would have to fight to define
>a list comprehension (more in general loops) working as
>in Python: the natural definition works as the OP wants. See
>http://www.arti
kj wrote:
> Suppose I have two lists, list_a and list_b, and I want to iterate
> over both as if they were a single list. E.g. I could write:
>
> for x in list_a:
> foo(x)
> for x in list_b:
> foo(x)
>
> But is there a less cumbersome way to achieve this?
Take a look at the itertools mo
In message , Dave Angel
wrote:
> Rather than editing the source files at install time, consider just
> using an environment variable in your testing environment, which would
> be missing in production environment.
I'd still need to define that environment variable in a wrapper script,
which mea
In message , Gabriel
Genellina wrote:
> Python knows the terminal encoding (or at least can make a good guess),
> but a file may use *any* encoding you want, completely unrelated to your
> terminal settings.
It should still respect your localization settings, though.
--
http://mail.python.org/
In message
<4f4f3e86-170a-4ad9-934d-4fa5b7d23...@n4g2000vba.googlegroups.com>, monogeo
wrote:
> I am able to use PAMIE 2.0 to automate IE7's File Download dialog, but
> the same approach/code fails on IE8.
I don't understand why you need to automate a GUI front-end, meant for human
use, to a f
In message , Jean-Paul
Calderone wrote:
> On Thu, 04 Jun 2009 21:33:13 +1200, Lawrence D'Oliveiro
> wrote:
>
>>In message , Allen
>>Fowler wrote:
>>
>>> I was hoping to keep the dev layout as close to deployment possible.
>>
>>Completely different purposes. For example, the actual production dat
Amit Gupta schrieb:
> Hi,
>
> I have been using ctype.cdll to load a library, but I am unable to
> figure out how to load multiple libraries that depends on each other.
> E.g. I have two libraries A.so and B.so. A.so has some undefined
> references, and those symbols are defined in B.so.
>
> When
In article <4a28903b.4020...@sweetapp.com>,
Brian Quinlan wrote:
> Scott David Daniels wrote:
> [snipped]
> > When you evaluate a lambda expression, the default args are evaluated,
> > but the expression inside the lambda body is not. When you apply that
> > evaluated lambda expression, the expr
On Jun 3, 11:50 pm, Xah Lee wrote:
> Of interest:
> • The Complexity And Tedium of Software Engineering
> http://xahlee.org/UnixResource_dir/writ/programer_frustration.html
Addendum:
The point in these short examples is not about software bugs or
problems. It illustrates, how seemingly trivial
On Jun 4, 10:25�pm, Steven D'Aprano
wrote:
> On Thu, 04 Jun 2009 09:47:05 -0700, Mensanator wrote:
> > After all, everybody knows that for m items taken n at a time, the
> > counts are
>
> > perm �w/repl = m**n
> > comb �w/repl = (m+n-1)!/(n!(m-1)!)
> > perm wo/repl = m!/(m-n)!
> > comb wo/repl =
"Gabriel Genellina" writes:
> Python knows the terminal encoding (or at least can make a good
> guess), but a file may use *any* encoding you want, completely
> unrelated to your terminal settings.
It may, yes, and the programmer is free to specify any encoding.
> So when stdout is redirected,
In message , Brian
Quinlan wrote:
>>>> c = (lambda : i for i in range(11, 16))
>>>> d = list(c)
>>>> for q in d:
>...print(q())
>...
>15
>15
>15
>15
>15
Try
>>> c = ((lambda i : lambda : i)(i) for i in range(11, 16))
>>> d = list(c)
>>
101 - 142 of 142 matches
Mail list logo