Ben Finney wrote:
> I have written a context manager to save and restore a name binding::
>
> import contextlib
>
> @contextlib.contextmanager
> def preserve_value(namespace, name):
> """ A context manager to preserve, then restore, the specified
> binding.
>
>
> On 7/29/2012 5:28 AM, Mark Lawrence wrote:
>> On 29/07/2012 06:08, Ben Finney wrote:
>>> Tim Chase writes:
>>>
[byte]
>>
>> Point taken, snag being I've never used any nix box in anger. This
>> thread reminds of the good 'ole days when I were a lad using TPU on VMS.
>> Have we got any V
On 7/29/2012 5:28 AM, Mark Lawrence wrote:
On 29/07/2012 06:08, Ben Finney wrote:
Tim Chase writes:
On Sat, Jul 28, 2012 at 6:29 PM, Mark Lawrence wrote:
I highly recommend the use of notepad++. If anyone knows of a
better text editor for Windows please let me know :)
I highly recommend n
"Adam W." wrote:
>
>You are correct about the 2 being the number of bytes written. However when I
>issue a read command I get:
>
ep.write('\x1BA')
>4
ep.read(1)
>usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_setup_async] invalid
>endpoint 0x02\n'
USB endponts only go in one
Howdy all,
I have written a context manager to save and restore a name binding::
import contextlib
@contextlib.contextmanager
def preserve_value(namespace, name):
""" A context manager to preserve, then restore, the specified binding.
:param namespace: The namesp
>> I have some long running processes that do very long simulations which
>> at the end need to write things on a database.
>>
>> At the moment sometimes there are network problems and we end up with
>> half the data on the database.
>>
>> The half-data problem is probably solved easily with sessio
On Thu, Aug 30, 2012 at 4:02 PM, Jonno wrote:
>
> Well I managed to figure out that the first traceback is the one causing
> the problem and that matplotlib/mathtext in my app is the problem.
> Now to figure out how to get mathtext working.
>
Bit more information:
I am also seeing warnings in ap
I have the same problem and couldn't find a solution. It seems that converters
can only be set programmatically?
On Thursday, August 30, 2012 6:38:27 AM UTC-4, Radha Krishna Srimanthula wrote:
> I'd like to have all timestamps in my log file to be UTC timestamp. When
> specified through code,
On Fri, Aug 31, 2012 at 9:54 AM, lucas wrote:
> oh, yeah that was perfect. got it working and it is graceful too. sorry
> about the double post, i thought i was only posting to this one.
Hehe, you're still posting to both. I don't see the duplicates myself,
but I'm sure others do. Just pick on
Hans Mulder writes:
> Next week's lesson will be: if you test it first, then paste it into a
> message for this forum, then tweak just one unimportant detail, you'll
> need to test it again.
+1 QotW
--
\“Look at it this way: Think of how stupid the average person |
`\ is, an
also, does that environment space, what i am assigning as env, have any such
common memory space or cross thread problem with simultaneous threads or
sessions?
--
http://mail.python.org/mailman/listinfo/python-list
oh, yeah that was perfect. got it working and it is graceful too. sorry about
the double post, i thought i was only posting to this one.
one final concern, if this code is running under a function in a
multi-threaded, multi-session kind of environment, does exec cross threads or
sessions? li
On Fri, Aug 31, 2012 at 8:25 AM, lucas wrote:
>> Far as I can see, you never actually called that function anywhere.
>> ChrisA
>
> doesn't the exec command call the function?
(Side point: You don't have to post to both comp.lang.python and
python-list - they mirror each other.)
What you executed
On 30Aug2012 05:51, Adam W. wrote:
| On Thursday, August 30, 2012 12:55:14 AM UTC-4, Dennis Lee Bieber wrote:
| > How many bytes did it claim to send?
|
| 11, which is what I expected. But I changed the byte value to 16
| (because I was having trouble getting single digit hex values working
|
On 30/08/2012 23:32, Ylodis wrote:
That is the question, where have I to write, and what have I to write.
My old acount was tarot-gratis, the new account is tarot-gratis-hrd.
What have I to write, where Google help says "myapp" ? Where should I write
appcfg.py update 'myapp'/
Probably where
That is the question, where have I to write, and what have I to write.
My old acount was tarot-gratis, the new account is tarot-gratis-hrd.
What have I to write, where Google help says "myapp" ? Where should I write
appcfg.py update 'myapp'/
--
http://mail.python.org/mailman/listinfo/python-lis
> Far as I can see, you never actually called that function anywhere.
> ChrisA
doesn't the exec command call the function?
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Aug 31, 2012 at 8:11 AM, lucas wrote:
> and i can see my executed function in there as a type function, and local and
> global vars, but i can not access or find "harry" or "rtn" the variables
> within the function lucas53. i do not know how to access the local variables
> within lucas
ok, i am stuck. i tried some test code attempts and i am stuck. so here is
some sample code:
xx2 = """
def lucas53():
harry = (4+16)/2
rtn = dict(harry=harry)
return rtn
"""
and then i run:
env = {}
exec xx2 in env
lst = env
and lst returns a huge dictionary of many types, some excerpt
I wrote PipeController recently to experiment with doing UNIX-style pipes in
Python.
Blog post about it:
http://jugad2.blogspot.in/2012/08/pipecontroller-v01-released-simulating.html
The blog post has a link to the downloadable PipeController source code.
It will be released under the New BSD
On Thu, Aug 30, 2012 at 3:11 PM, Jonno wrote:
> Not sure where the best place to post this is. My app uses wxpython,
> matplotlib.
> I'm running Python 2.7 on Windows 7.
> I have a script app.py that I'm trying to turn into app.exe using py2exe.
> The exe runs fine on the pc that it was compiled
On 8/30/2012 12:00 PM, Steven D'Aprano wrote:
On Thu, 30 Aug 2012 07:02:24 -0400, Roy Smith wrote:
In article <503f0e45$0$9416$c3e8da3$76491...@news.astraweb.com>,
Steven D'Aprano wrote:
The only thing which is innovative here is that instead of the Python
compiler declaring that "all stri
Not sure where the best place to post this is. My app uses wxpython,
matplotlib.
I'm running Python 2.7 on Windows 7.
I have a script app.py that I'm trying to turn into app.exe using py2exe.
The exe runs fine on the pc that it was compiled on but on another Win7
machine I get something like the fo
On 8/30/2012 9:30 AM, Oscar Benjamin wrote:
On Thu, 30 Aug 2012 09:23:03 -0400, Dave Angel wrote:
I haven't discovered why sometimes the type output shows type
instead of
class. There are other ways of defining classes, however, and
perhaps
this is using one of them. Still, it is a class,
On 8/30/2012 11:51 AM, Ylodis wrote:
Hi,
I had an old and deprecated Master/Slave (M/S) datastore
and I trying to pass its content to a new Master/Slave (M/S) datastore as is
expained here :
https://developers.google.com/appengine/docs/adminconsole/migration#Deploying_Your_New_HRD_Application
On 30 August 2012 15:11, Marco Nawijn wrote:
>
>
> Learned my lesson today. Don't assume you know something. Test it first
> ;). I have done quite some programming in Python, but did not know that
> class attributes are still local to the instances. It is also a little
> surprising I must say. I a
Playing around with mailbox.mbox, I noticed the flag get split
across Status/X-Status headers. I dug into the source and read at
[1] to see the *how* but I'm curious as to the *why*.
When I pulled up RFC-4155[2] (mbox), it didn't seem to mention
anything about the Status/X-Status stuff, and the M
I am trying to use a Google public storage that is managed in python.
I do web developement, I have very litle idea about python, english is not my
natural language and as you can see, I am very lost. I do not even now which
group cold help me.
The details of what I want to do are in the link.
On 30/08/2012 16:51, Ylodis wrote:
Hi,
I had an old and deprecated Master/Slave (M/S) datastore
and I trying to pass its content to a new Master/Slave (M/S) datastore as is
expained here :
https://developers.google.com/appengine/docs/adminconsole/migration#Deploying_Your_New_HRD_Application
Wh
On Thu, Aug 30, 2012 at 2:51 AM, wrote:
> But as soon as you introduce artificially a "latin-1"
> bottleneck, all this machinery just become useless.
How is this a bottleneck? If you removed the Latin-1 encoding
altogether and limited the flexible representation to just UCS-2 /
UCS-4, I doubt v
On Thu, 30 Aug 2012 07:02:24 -0400, Roy Smith wrote:
> In article <503f0e45$0$9416$c3e8da3$76491...@news.astraweb.com>,
> Steven D'Aprano wrote:
>
>> The only thing which is innovative here is that instead of the Python
>> compiler declaring that "all strings will be stored in UCS-2", the
>> co
Hi,
I had an old and deprecated Master/Slave (M/S) datastore
and I trying to pass its content to a new Master/Slave (M/S) datastore as is
expained here :
https://developers.google.com/appengine/docs/adminconsole/migration#Deploying_Your_New_HRD_Application
Where it say I have to :
"appcfg.py up
On 30/08/12 14:49:54, Ulrich Eckhardt wrote:
> Am 30.08.2012 13:54, schrieb boltar2003@boltar.world:
> s = os.stat(".")
> print s
>> posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L,
>> st_nlink=2, st_u
>> id=1000, st_gid=100, st_size=4096L, st_atime=1346327745,
>> st_mtime=13
On 08/26/2012 10:25 AM, Hans Mulder wrote:
The algorithm is explained at
http://docs.python.org/library/io.html#io.DEFAULT_BUFFER_SIZE
Thanks ;)
In other words: open() tries to find a suitable size by
calling os.stat(your_file).st_blksize and if that fails,
it uses io.DEFAULT_BUFFER_SIZE, wh
On 30/08/12 16:48:24, Marco Nawijn wrote:
> On Thursday, August 30, 2012 4:30:59 PM UTC+2, Dave Angel wrote:
>> On 08/30/2012 10:11 AM, Marco Nawijn wrote:
>>> On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote:
>>> Learned my lesson today. Don't assume you know something. Test
Am 30.08.2012 15:27, schrieb Marco Nawijn:
On Thursday, August 30, 2012 3:15:03 PM UTC+2, Ulrich Eckhardt wrote:
Am 30.08.2012 13:54, schrieb boltar2003@boltar.world:
What sort of object is posix.stat_result?
[...]
I guess that this is a named tuple, which is a tuple where the
attributes are
On 08/30/2012 10:48 AM, Marco Nawijn wrote:
> On Thursday, August 30, 2012 4:30:59 PM UTC+2, Dave Angel wrote:
>> On 08/30/2012 10:11 AM, Marco Nawijn wrote:
>>
>>> On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote:
>>
>>
>>
>>> Learned my lesson today. Don't assume you kn
gmail.com> writes:
>
> Pick up a random text and see the probability this
> text match the most optimized case 1 char / 1 byte,
> practically never.
Funny that you posted a text which does just that:
http://mail.python.org/pipermail/python-list/2012-August/629554.html
> In a funny way, this is
On Thursday, August 30, 2012 4:30:59 PM UTC+2, Dave Angel wrote:
> On 08/30/2012 10:11 AM, Marco Nawijn wrote:
>
> > On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote:
>
> >>
>
> >>
>
> > Learned my lesson today. Don't assume you know something. Test it first ;).
> > I have don
On 08/30/2012 10:11 AM, Marco Nawijn wrote:
> On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote:
>>
>>
> Learned my lesson today. Don't assume you know something. Test it first ;). I
> have done quite some programming in Python, but did not know that class
> attributes are still l
On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote:
> On 30/08/12 14:34:51, Marco Nawijn wrote:
>
>
>
> > Note that if you change 'd' it will change for all instances!
>
>
>
> That depends on how you change it.
>
>
>
> bobj = A()
>
> bobj.d
>
> > 'my attribute'
>
On Thu, 30 Aug 2012 09:23:03 -0400, Dave Angel wrote:
I haven't discovered why sometimes the type output shows type
instead of
class. There are other ways of defining classes, however, and
perhaps
this is using one of them. Still, it is a class, and stat() is
returning an instance of that
On Thursday, August 30, 2012 3:15:03 PM UTC+2, Ulrich Eckhardt wrote:
> Am 30.08.2012 13:54, schrieb boltar2003@boltar.world:
>
> s = os.stat(".")
>
> print s
>
> > posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2,
> > st_u
>
> > id=1000, st_gid=100, st_size
On 30/08/12 14:34:51, Marco Nawijn wrote:
> Note that if you change 'd' it will change for all instances!
That depends on how you change it.
bobj = A()
bobj.d
> 'my attribute'
>
A.d = 'oops...attribute changed'
Here you change the attribute on the class.
That will affect all ins
On Thu, 30 Aug 2012 23:06:34 +1000
Chris Angelico wrote:
>Yep, you're using Python 2. A few things are subtly different. Unless
>you have good reason not to, do consider moving to Python 3; all sorts
Noted. Thanks.
B2003
--
http://mail.python.org/mailman/listinfo/python-list
On 08/30/2012 08:50 AM, boltar2003@boltar.world wrote:
> On Thu, 30 Aug 2012 13:14:57 +0100
> MRAB wrote:
>
> If its a class , why is it when I create my own class I get a completely
> different output with print and type?
>
class foo(object):
> .. def __init__(self):
> .. pa
Am 30.08.2012 13:54, schrieb boltar2003@boltar.world:
s = os.stat(".")
print s
posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2, st_u
id=1000, st_gid=100, st_size=4096L, st_atime=1346327745, st_mtime=1346327754, st
_ctime=1346327754)
What sort of object is posix.stat_r
On Thu, Aug 30, 2012 at 10:50 PM, wrote:
> On Thu, 30 Aug 2012 13:14:57 +0100
> MRAB wrote:
>>What don't you ask Python? I'm sure you'' get something like this:
>>
>> >>> type(s)
>>
>
> Umm , no I don't.
>
type(s)
>
>
> Which isn't terrible helpful.
That's actually the same thing, except
On Thu, 30 Aug 2012 08:25:33 -0400
Dave Angel wrote:
>You can get more documentation directly from s by simply typing
>help(s) and/or help(os.stat)
I didn't know about help(). Thanks!
B2003
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday, August 30, 2012 12:55:14 AM UTC-4, Dennis Lee Bieber wrote:
>
> How many bytes did it claim to send?
>
11, which is what I expected. But I changed the byte value to 16 (because I
was having trouble getting single digit hex values working in the command) and
sent this command:
On Thu, 30 Aug 2012 13:14:57 +0100
MRAB wrote:
>On 30/08/2012 12:54, boltar2003@boltar.world wrote:
>> Hello
>>
>> I'm slowly teaching myself python so apologies if this is a dumb question.
>> but something has confused me with the os.stat() function:
>>
> s = os.stat(".")
> print s
>> pos
在 2012年8月30日星期四UTC+8下午7时54分35秒,Dave Angel写道:
> On 08/30/2012 06:55 AM, 陈伟 wrote:
>
> > when i write code like this:
>
> >
>
> > class A(object):
>
> >
>
> > d = 'it is a doc.'
>
> >
>
> >
>
> > t = A()
>
> >
>
> > print t.__class__.d
>
> > print t.d
>
> >
>
> > the outpu
On Thu, 30 Aug 2012 05:34:51 -0700 (PDT), Marco Nawijn
wrote:
If you want attributes to be local to the instance, you have to
define them in the __init__ section of the class like this:
class A(object):
def __init__(self):
d = 'my attribute'
Except that in this case you'd need to
On Thursday, August 30, 2012 12:55:25 PM UTC+2, 陈伟 wrote:
> when i write code like this:
>
>
>
> class A(object):
>
>
>
> d = 'it is a doc.'
>
>
>
>
>
> t = A()
>
>
>
> print t.__class__.d
>
> print t.d
>
>
>
> the output is same.
>
>
>
> so it means class object's
On Thu, Aug 30, 2012 at 9:54 PM, wrote:
> What sort of object is posix.stat_result? Its not a dictionary or list or a
> class object as far as I can tell. Thanks for any help.
There's some cool things you can do here. (Note that I'm testing this
on a Windows box, so it's marginally different.)
On 08/30/2012 07:54 AM, boltar2003@boltar.world wrote:
> Hello
>
> I'm slowly teaching myself python so apologies if this is a dumb question.
> but something has confused me with the os.stat() function:
>
s = os.stat(".")
print s
> posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=
On Thursday, August 30, 2012 1:54:08 PM UTC+2, (unknown) wrote:
> Hello
>
>
>
> I'm slowly teaching myself python so apologies if this is a dumb question.
>
> but something has confused me with the os.stat() function:
>
>
>
> >>> s = os.stat(".")
>
> >>> print s
>
> posix.stat_result(st_mo
In article ,
MRAB wrote:
> What don't you ask Python? I'm sure you'' get something like this:
>
> >>> type(s)
>
BTW, this points out one of the really powerful aspects of Python. The
combination of introspection and a handy interactive interpreter makes
it easy to "just ask the computer".
Am 30.08.2012 12:55, schrieb 陈伟:
class A(object):
d = 'it is a doc.'
t = A()
print t.__class__.d
print t.d
the output is same.
You could go even further:
print id(t.__class__.d)
print id(t.d)
which should show you that they are not just equal but identical.
so it means class object
On 30/08/2012 12:54, boltar2003@boltar.world wrote:
Hello
I'm slowly teaching myself python so apologies if this is a dumb question.
but something has confused me with the os.stat() function:
s = os.stat(".")
print s
posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2,
Hello
I'm slowly teaching myself python so apologies if this is a dumb question.
but something has confused me with the os.stat() function:
>>> s = os.stat(".")
>>> print s
posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2, st_u
id=1000, st_gid=100, st_size=4096L, st_atim
On 08/30/2012 06:55 AM, 陈伟 wrote:
> when i write code like this:
>
> class A(object):
>
> d = 'it is a doc.'
>
>
> t = A()
>
> print t.__class__.d
> print t.d
>
> the output is same.
>
> so it means class object's attribute is also the instance's attribute. is it
> right? i can not
On 08/29/2012 07:46 AM, Dave Angel wrote:
> On 08/29/2012 06:32 AM, levinie...@gmail.com wrote:
>
>
I was trying to point out that your question was empty (no content in
the message). Mark also apparently saw an empty message. However, now
that Dieter has responded, with apparent quotes from your
In article <503f0e45$0$9416$c3e8da3$76491...@news.astraweb.com>,
Steven D'Aprano wrote:
> The only thing which is innovative here is that instead of the Python
> compiler declaring that "all strings will be stored in UCS-2", the
> compiler chooses an implementation for each string as needed. S
when i write code like this:
class A(object):
d = 'it is a doc.'
t = A()
print t.__class__.d
print t.d
the output is same.
so it means class object's attribute is also the instance's attribute. is it
right? i can not understand it.
--
http://mail.python.org/mailman/listinfo/py
I'd like to have all timestamps in my log file to be UTC timestamp. When
specified through code, this is done as follows:
myHandler = logging.FileHandler('mylogfile.log', 'a')
formatter = logging.Formatter('%(asctime)s %(levelname)-8s
%(name)-15s:%(lineno)4s: %(message)-80s')
formatter.converter
On Thu, Aug 30, 2012 at 6:51 PM, wrote:
> Pick up a random text and see the probability this
> text match the most optimized case 1 char / 1 byte,
> practically never.
Only if you talk about a huge document. Try, instead, every string
ever used in a Python script.
Practically always.
But I'm w
Le jeudi 30 août 2012 08:55:01 UTC+2, Steven D'Aprano a écrit :
You are right.
But as soon as you introduce artificially a "latin-1"
bottleneck, all this machinery just become useless.
This flexible representation is working absurdly.
It optimizes the characters you are not using (in one
sense)
Am 29.08.2012 17:04, schrieb Franck Ditter:
I use Python 3.2.3 + Idle.
Is it possible to program test(e) which takes
an expression e and whose execution produces
at the toplevel an echo of e and the effects
and result of its evaluation ?
Yes, the key to this is using a lambda expression.
# f
On 30/08/2012 03:57, python-ex...@raf.org wrote:
hopefully the intention that xlrd not support formats in xlsx
files will change one day into an intention to support them. :-)
The intention is there, sadly the time to work on it is not.
John Machin would be the person best placed to do the wo
writes:
> Are the property Function really useful?
Someone invested time to implement/document/test it.
Thus, there are people who have use cases for it...
> Where can i use the property function?
You can use it when you have parameterless methods
which you want to access as if they were simpl
rikardhul...@gmail.com writes:
> I use logging.FileHandler (on windows) and I would like to be able to delete
> the file while the process is running and have it create the file again on
> next log event.
>
> On windows (not tried linux) this is not possible because the file is locked
> by the
On Wed, 29 Aug 2012 08:43:05 -0700, wxjmfauth wrote:
> I can hit the nail a little more.
> I have even a better idea and I'm serious.
>
> If "Python" has found a new way to cover the set of the Unicode
> characters, why not proposing it to the Unicode consortium?
Because the implementation of th
73 matches
Mail list logo