Girish, 23.07.2010 08:54:
Is ter a way to change default encoding in py 2.5 ?
Yes, but it's highly discouraged. If you tell us why you want to do it, we
may be able to point to a better way to get what you want.
Stefan
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 22 Jul 2010 22:24:39 -0700, march wrote:
> Steven, thank you for your reply.
>
> It is true that I didn't read the document with enough carefulness. some
> of my questions are answered in the page I post the link of. Some are
> not.
> But the documentation is poor. You need to read throu
[Fix top posting]
On Jul 23, 12:07 pm, Steven D'Aprano wrote:
On Thu, 22 Jul 2010 20:18:43 -0700, march wrote:
Hi, guys.
As a regular user of python, I am often annoyed by the fact that the
official python docementation is too short and too simple to satisfy my
requirement.
Python is a
On Thu, Jul 22, 2010 at 10:24 PM, march wrote:
> Steven, thank you for your reply.
>
> It is true that I didn't read the document with enough carefulness.
> some of my questions are answered in the page I post the link of. Some
> are not.
>
> But the documentation is poor. You need to read through
On Thu, 22 Jul 2010 22:47:11 -0400, wheres pythonmonks wrote:
> Thanks for pointing out that swap (and my swap2) don't work everywhere
> -- is there a way to get it to work inside functions?
Not in CPython. In IronPython or Jython, maybe, I don't know enough about
them. But even if you got it to
On Fri, 23 Jul 2010 09:18:47 +0200, Stefan Behnel wrote:
> Girish, 23.07.2010 08:54:
>> Is ter a way to change default encoding in py 2.5 ?
>
> Yes, but it's highly discouraged. If you tell us why you want to do it,
> we may be able to point to a better way to get what you want.
I think it is di
On Fri, 23 Jul 2010 08:20:03 +0100, Mark Lawrence wrote:
> [Fix top posting]
While you were fixing the top posting, did you bother to trim any
unnecessary quoting? Let me scroll down and see...
... why no, no you didn't.
I'm not a religious man, but the verse about the mote in your brother's
Hi,
I use non-blocking io to check for timeouts. Sometimes I get EAGAIN (Resource
temporarily unavailable)
on write(). My working code looks like this. But I am unsure how many bytes
have been written to the
pipe if I get an EAGAIN IOError. Up to now I retry with the same chunk.
If I get EAGAIN
On Thu, 22 Jul 2010 21:23:05 -0700, Stephen Hansen wrote:
> On 7/22/10 7:47 PM, wheres pythonmonks wrote:
[...]
>> The truth is that I don't intend to use these approaches in anything
>> serious. However, I've been known to do some metaprogramming from time
>> to time.
>
> Depending on how you d
Has any python liberary can make a folder to .nsi file?
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Funny... just spent some time with timeit:
I wonder why I am passing in strings if the callback overhead is so light...
More funny: it looks like inline (not passed in) lambdas can cause
python to be more efficient!
>>> import random
>>> d = [ (['A','B'][random.randint(0,1)],x,random.gauss(0,1))
Steven D'Aprano wrote:
> On Thu, 22 Jul 2010 22:47:11 -0400, wheres pythonmonks wrote:
>
>> Thanks for pointing out that swap (and my swap2) don't work everywhere
>> -- is there a way to get it to work inside functions?
Consider languages where you can easily write a swap function (or any other
I am having some problems with unicode from json.
This is the error I get
UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in
position 61: ordinal not in range(128)
I have kind of developped this but obviously it's not nice, any better
ideas?
try:
text=texts[
On Fri, 23 Jul 2010 03:14:11 -0700, dirknbr wrote:
> I am having some problems with unicode from json.
>
> This is the error I get
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in
> position 61: ordinal not in range(128)
>
> I have kind of developped this but obviously it
On Fri, Jul 23, 2010 at 3:14 AM, dirknbr wrote:
> I am having some problems with unicode from json.
>
> This is the error I get
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in
> position 61: ordinal not in range(128)
Please include the full Traceback and the actual code th
To give a bit of context. I am using twython which is a wrapper for
the JSON API
search=twitter.searchTwitter(s,rpp=100,page=str(it),result_type='recent',lang='en')
for u in search[u'results']:
ids.append(u[u'id'])
texts.append(u[u'text'])
This is where texts com
wheres pythonmonks wrote:
> Funny... just spent some time with timeit:
>
> I wonder why I am passing in strings if the callback overhead is so
> light...
>
> More funny: it looks like inline (not passed in) lambdas can cause
> python to be more efficient!
import random
d = [ (['A','B'
Duncan Booth wrote:
Consider languages where you can easily write a swap function (or any other
function that updates its arguments). e.g. consider C or C#.
For C your function must take pointers to the variables, so when you call
swap you have to make this explicit by taking the address of
wheres pythonmonks wrote:
Funny... just spent some time with timeit:
I wonder why I am passing in strings if the callback overhead is so light...
More funny: it looks like inline (not passed in) lambdas can cause
python to be more efficient!
import random
d = (['A','B'][random.randint(0,1)
On 22 Jul., 22:25, Ian wrote:
> Hi Karsten,
>
> On 22/07/2010 12:03, Karsten Wutzke wrote:> What is it I'm missing?
>
> I think you are making it more complicated than it really is.
>
> The visitor pattern is about bringing all the little bits that would
> otherwise be scattered all over
> many no
In article <16a7e301-2e85-47eb-971e-79acc4e07...@b35g2000yqi.
googlegroups.com>, gnuist...@gmail.com says...
>This makes some sense. He replied on the newsgroup in a lengthy
post
>that there are sufficient resources out there giving hint that
no one
>need help me out. Then I was called "lazy" in
> I think it is discouraged because it *will* break things in the standard
> library and builtins. It's discouraged in the same way that pouring sugar
> into the petrol tank of your car is discouraged.
Mythbusters have tested this urban legend. In their test the engine run
better with sugar. [1]
Christian Heimes, 23.07.2010 15:26:
I think it is discouraged because it *will* break things in the standard
library and builtins. It's discouraged in the same way that pouring sugar
into the petrol tank of your car is discouraged.
Mythbusters have tested this urban legend. In their test the en
On 2010-07-23, Steven D'Aprano wrote:
> On Thu, 22 Jul 2010 20:18:43 -0700, march wrote:
>
>> Hi, guys.
>>
>> As a regular user of python, I am often annoyed by the fact that the
>> official python docementation is too short and too simple to satisfy my
>> requirement.
>
> Python is a volunteer e
On Fri, 23 Jul 2010 14:26:27 +, Grant Edwards wrote:
>>> What if the peer close the socket?
>>
>> You will get an exception,
>
> Nope. You read a value of "".
Thank you for the correction.
>> just like the Fine Manual says.
>
> If it does say that, it needs to be fixed.
No, I apparentl
On 7/23/10 12:44 AM, Tim Roberts wrote:
I wouldn't use os.system with grep and evaluate the return code. Instead
I'd use subprocess.Popen("file") and read the text output of the
commdn directly. By parsing that string, I can extract all kinds of
interesting information.
Small correction: subp
On Jul 23, 9:49 am, Steven D'Aprano wrote:
> On Fri, 23 Jul 2010 14:26:27 +, Grant Edwards wrote:
> > If it does say that, it needs to be fixed.
>
> No, I apparently just made it up.
Yes and i'll bet you've *never* just "made up" anything to scaffold
your arguments? . Since this trait is one
On Sat, Jul 24, 2010 at 1:42 AM, rantingrick wrote:
> In the land of the blind, the one eyed man is king! ;-)
RIck, your comments don't really help the situation. Really.
--
-- James Mills
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list
On 7/23/10 2:05 AM, Steven D'Aprano wrote:
> On Thu, 22 Jul 2010 21:23:05 -0700, Stephen Hansen wrote:
>
>> On 7/22/10 7:47 PM, wheres pythonmonks wrote:
> [...]
>>> The truth is that I don't intend to use these approaches in anything
>>> serious. However, I've been known to do some metaprogrammi
On 07/23/2010 12:56 PM, dirknbr wrote:
> To give a bit of context. I am using twython which is a wrapper for
> the JSON API
>
>
> search=twitter.searchTwitter(s,rpp=100,page=str(it),result_type='recent',lang='en')
> for u in search[u'results']:
> ids.append(u[u'id'])
>
How can I calculate how much time is between now and the next 2:30
am? Naturally I want the system to worry about leap years, etc.
Thanks,
Jim
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-07-23, Jim wrote:
> How can I calculate how much time is between now and the next
> 2:30 am? Naturally I want the system to worry about leap
> years, etc.
You need the datetime module. Specifically, a datetime and
timedelta object.
--
Neil Cerutti
--
http://mail.python.org/mailman/lis
On 07/23/2010 12:34 AM, wheres pythonmonks wrote:
> 2. Is there a better way to loopup by id? I'm not very familiar with
> sys.exc_info, but creating the id->name hash each time seems like
> overkill.
I just had the most horrendous idea. Really, looking up objects by ID,
or even swapping two obj
On 07/23/2010 07:13 PM, Thomas Jollans wrote:
> On 07/23/2010 12:34 AM, wheres pythonmonks wrote:
>> 2. Is there a better way to loopup by id? I'm not very familiar with
>> sys.exc_info, but creating the id->name hash each time seems like
>> overkill.
>
> I just had the most horrendous idea. Rea
I was playing around with Python functions returning functions and the
scope rules for variables, and encountered this weird behavior that I
can't figure out.
Why does f1() leave x unbound, but f2() does not?
def f1():
x = 0
def g():
x += 1
return x
return g1
def f2()
On Fri, Jul 23, 2010 at 11:30 AM, SeanMon wrote:
>
> I was playing around with Python functions returning functions and the
> scope rules for variables, and encountered this weird behavior that I
> can't figure out.
>
> Why does f1() leave x unbound, but f2() does not?
>
> def f1():
> x = 0
>
Title Portable LISP interpreter
Creator/Author Cox, L.A. Jr. ; Taylor, W.P.
Publication Date1978 May 31
OSTI Identifier OSTI ID: 7017786
Report Number(s)UCRL-52417
DOE Contract Number W-7405-ENG-48
Resource Type Technical Report
Research OrgCalifornia Univ., Livermore (
Thanks; I'll have a look, and a think.
Jim
--
http://mail.python.org/mailman/listinfo/python-list
SeanMon wrote:
I was playing around with Python functions returning functions and the
scope rules for variables, and encountered this weird behavior that I
can't figure out.
Why does f1() leave x unbound, but f2() does not?
def f1():
x = 0
def g():
x += 1
return x
re
I have some very simple use cases[1] for adding some version control
capabilities to a product I'm working on. My product uses simple, text
(UTF-8) based scripts that are independent of one another. I would like
to "version control" these scripts on behalf of my users. By version
control, I mean *v
On 07/23/2010 10:35 PM, pyt...@bdurham.com wrote:
> 1. Use an existing version control utility. There are lots of options
> here(!), any recommendations on a light weight, open source one that
> xcopy installs under Windows with lots of command line options?
You could just go with Mercurial, you k
On Fri, 23 Jul 2010 15:10:16 +0200, francogrex
wrote:
>Unfortunately many so-called experts in the field look down
>on newbies and mistreat them (in any programming language forum),
>forgetting in the process that they were also at a certain time
>newbies until some gentle and nice enough teache
On Wed, Jul 21, 2010 at 9:47 AM, Daniel Stutzbach <
dan...@stutzbachenterprises.com> wrote:
> What's new?
> ---
>
> - blist.sort() is now *substantially* faster than list.sort() when using
> int or float keys (O(n) vs. O(n log n))
> - The sortedset, sortedlist, and sorteddict types have be
On Fri, 23 Jul 2010 10:45:32 +0200, Thomas Guettler wrote:
> I use non-blocking io to check for timeouts. Sometimes I get EAGAIN
> (Resource temporarily unavailable) on write(). My working code looks
> like this. But I am unsure how many bytes have been written to the pipe
> if I get an EAGAIN IOE
On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
> Don't write bare excepts, always catch the error you want and nothing
> else.
That advice would make more sense if it was possible to know which
exceptions could be raised. In practice, that isn't possible, as the
documentation seldom
On Fri, Jul 23, 2010 at 2:46 PM, Nobody wrote:
> On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
>
>> Don't write bare excepts, always catch the error you want and nothing
>> else.
>
> That advice would make more sense if it was possible to know which
> exceptions could be raised. In pr
On 07/23/2010 11:46 PM, Nobody wrote:
> On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
>
>> Don't write bare excepts, always catch the error you want and nothing
>> else.
>
> That advice would make more sense if it was possible to know which
> exceptions could be raised. In practice,
On 7/23/2010 4:10 AM, Steven D'Aprano wrote:
Using exec or friends to avoid the overhead of function calls is like
pushing your car to work to avoid the overhead of having to get in and
out of the car.
And, of course, exec *is* a function call (explicitly in 3.x, but
somewhere also in the inn
Jesus in the Glorious Qur'an -- The True Message of Jesus Christ
The Qur’an tells us a lot of wonderful things about Jesus. As a
result, believers in the Qur’an love Jesus, honour him, and believe in
him. In fact, no Muslim can be a Muslim unless he or she believes in
Jesus, on whom be peace.
On 7/23/2010 2:30 PM, SeanMon wrote:
I was playing around with Python functions returning functions and the
scope rules for variables, and encountered this weird behavior that I
can't figure out.
Why does f1() leave x unbound, but f2() does not?
def f1():
x = 0
def g():
In 3.x, add
On 7/23/2010 5:46 PM, Nobody wrote:
On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
Don't write bare excepts, always catch the error you want and nothing
else.
That advice would make more sense if it was possible to know which
exceptions could be raised. In practice, that isn't pos
Neil Cerutti writes:
> On 2010-07-23, Jim wrote:
>> How can I calculate how much time is between now and the next
>> 2:30 am? Naturally I want the system to worry about leap
>> years, etc.
>
> You need the datetime module. Specifically, a datetime and
> timedelta object.
Although it sounds lik
> Your case could be handled by something like:
>
> from datetime import datetime
> from dateutil.relativedelta import relativedelta
>
> target = datetime.now() + relativedelta(days=+1, hour=2, minute=30,
> second=0, microsecond=0)
> rem
Thank you again to everyone; I greatly appreciate the help. I ended
with essentially what Christian advised and it seems to work fine.
FWIW, below is the rouine (I couldn't figure out how to do it without
the kludgy x variable). The background is that this is a Django
context processor that makes
Hey Everyone,
I had a question, programming sockets, what are the things that would
degrade performance and what steps could help in a performance boost?
I would also appreciate being pointed to some formal documentation or
article.
I am new to this.
Warm regards,
Nav
--
http://mail.pyth
In message <7j8w5tylmw@rapun.sel.cam.ac.uk>, Matthew Vernon wrote:
> Is there a more idiomatic way of loading in a configuration file
> that's python code ...
Is it really a good idea to have a configuration language that’s Turing-
complete?
--
http://mail.python.org/mailman/listinfo/python-
In message , Tim Harig wrote:
> On 2010-07-05, Lawrence D'Oliveiro
> wrote:
>>
>> I’ve never come across any system where you could string together
>> multiple GUI apps, or even multiple GUI operations in the same app, in
>> any sensible or effective way at all. GUIs just aren???t designed to wor
In message , Robert Kern
wrote:
> There are also utilities for mounting ISOs directly without burning them
> to a physical disk.
You need special utilities to do this??
--
http://mail.python.org/mailman/listinfo/python-list
In message , Michael
Torrie wrote:
> While it's possible to set up pipes and spawn programs in parallel to
> operate on the pipes, in practice it's simpler to tell subprocess.Popen
> to use a shell and then just rely on Bash's very nice syntax for setting
> up the pipeline.
Just be careful about
On 7/23/10 7:08 PM, Lawrence D'Oliveiro wrote:
In message, Robert Kern
wrote:
There are also utilities for mounting ISOs directly without burning them
to a physical disk.
You need special utilities to do this??
On at least some versions of Windows, Yes.
--
Robert Kern
"I have come to beli
Jim wrote:
Thank you again to everyone; I greatly appreciate the help. I ended
with essentially what Christian advised and it seems to work fine.
FWIW, below is the rouine (I couldn't figure out how to do it without
the kludgy x variable). The background is that this is a Django
context process
Lawrence D'Oliveiro writes:
> In message <7j8w5tylmw@rapun.sel.cam.ac.uk>, Matthew Vernon wrote:
>
> > Is there a more idiomatic way of loading in a configuration file
> > that's python code ...
>
> Is it really a good idea to have a configuration language that’s Turing-
> complete?
I think
Navkirat Singh wrote:
Hey Everyone,
I had a question, programming sockets, what are the things that would
degrade performance and what steps could help in a performance boost? I
would also appreciate being pointed to some formal documentation or
article.
I am new to this.
Interleaving pro
Thanks for the info : ). I will look into it ! Right now I am having a
strange problem. I am trying to use cookies and the import function
returns an error:
I am using python 3:
from http import cookies
importError: No module named http
Is it my configuration or has something changed since
TL;DR: if you want to stay sane, don't inherit two classes that share
same inheritance graph
I recently got puzzled by a bug from a legacy lib (ClientForm)
which have this code:
class ParseError(sgmllib.SGMLParseError,
HTMLParser.HTMLParseError,
):
On Fri, 23 Jul 2010 09:22:16 -0700, Stephen Hansen wrote:
> On 7/23/10 2:05 AM, Steven D'Aprano wrote:
>> On Thu, 22 Jul 2010 21:23:05 -0700, Stephen Hansen wrote:
>>
>>> On 7/22/10 7:47 PM, wheres pythonmonks wrote:
>> [...]
The truth is that I don't intend to use these approaches in anythi
Navkirat Singh wrote:
Thanks for the info : ). I will look into it ! Right now I am having a
strange problem. I am trying to use cookies and the import function
returns an error:
I am using python 3:
from http import cookies
*importError:* No module named http
Is it my configuration or has
On 2010-07-24, Lawrence D'Oliveiro wrote:
> In message , Robert Kern
> wrote:
>
>> There are also utilities for mounting ISOs directly without burning
>> them to a physical disk.
>
> You need special utilities to do this??
Not if the OS and VFS are competently designed. In Linux all you need
to
On Fri, 23 Jul 2010 22:46:46 +0100, Nobody wrote:
> On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
>
>> Don't write bare excepts, always catch the error you want and nothing
>> else.
>
> That advice would make more sense if it was possible to know which
> exceptions could be raised.
On Fri, 23 Jul 2010 22:42:28 -0400, Rolando Espinoza La Fuente wrote:
> TL;DR: if you want to stay sane, don't inherit two classes that share
> same inheritance graph
>
> I recently got puzzled by a bug from a legacy lib (ClientForm) which
> have this code:
[...]
> Finally everything make sense.
Are there any documents about multiple versionsof Python coexisting in
the same OS ( Windows in my case ) and what pitfalls to look out for ? I
have already run into a number of them. I installed Python 2.7 and 3.1.2
into completely folders, but immediately ran into serious problems
executing a
On Fri, Jul 23, 2010 at 7:42 PM, Rolando Espinoza La Fuente
wrote:
> TL;DR: if you want to stay sane, don't inherit two classes that share
> same inheritance graph
>
> I recently got puzzled by a bug from a legacy lib (ClientForm)
> which have this code:
>
> class ParseError(sgmllib.SGMLParseEr
On Jul 23, 12:06 pm, Emmy Noether wrote:
> Title Portable LISP interpreter
> Creator/Author Cox, L.A. Jr. ; Taylor, W.P.
> Publication Date 1978 May 31
> OSTI Identifier OSTI ID: 7017786
> Report Number(s) UCRL-52417
> DOE Contract Number W-7405-ENG-48
> Resource Type Techni
On Fri, Jul 23, 2010 at 2:15 PM, Thomas Guettler wrote:
> Hi,
>
> I use non-blocking io to check for timeouts. Sometimes I get EAGAIN (Resource
> temporarily unavailable)
> on write(). My working code looks like this. But I am unsure how many bytes
> have been written to the
> pipe if I get an E
On Sat, Jul 24, 2010 at 12:28 AM, Benjamin Kaplan
wrote:
[...]
>
> And second, not to in any way diminish the work you did tracing out
> the inheritance tree and working through the inheritance, but Python
> has easier ways of doing it :)
>
BBar.__mro__
> (, , 'exceptions.RuntimeError'>, ,
On 2010-07-24, Lawrence D'Oliveiro wrote:
> In message , Tim Harig wrote:
>
>> On 2010-07-05, Lawrence D'Oliveiro
>> wrote:
>>>
>>> I???ve never come across any system where you could string together
>>> multiple GUI apps, or even multiple GUI operations in the same app, in
>>> any sensible or ef
On Jul 24, 4:42 am, Rolando Espinoza La Fuente
wrote:
> Finally everything make sense. And make think about be careful when
> doing multiple inheritance.
>
> Any thoughts?
>
> ~Rolando
I am not fond of multiple inheritance either and I wrote at length
about the dangers of it. If you do not know i
I am having the hardest time trying to find documentation on proper
use of the 'as' keyword (aside from . I initially thought that I would
be allowed to do something such as:
import shared.util as util
The as statement seems to be causing a lot of ''module' object has no
attribute'. Is it safe to
78 matches
Mail list logo