Actually, the command given "ps axH" uses H which shows threads as if they
were processes. If you check the pid of these "processes," you would find
that they are all equivalent.
On Fri, Jan 30, 2009 at 9:56 AM, Alejandro wrote:
> On Jan 30, 4:00 am, Ove Svensson wrote:
> > Pidis a process iden
I think issue here is that you're invoking a system call (using either the
subprocess module or os.popen*) from your threads. Those *are* external
processes and will show up under pstree since they have a parent process. If
you're using subprocess.Popen() the object that is returned has an attribut
Very well written response! Thanks Sturla
On Tue, Feb 17, 2009 at 10:50 AM, sturlamolden wrote:
> On 16 Feb, 10:34, rushen...@gmail.com wrote:
>
> > And the story begins here. As i search on the net, I have found that
> > because of the natural characteristics of python such as GIL, we are
> >
A comma is what generates a tuple. It's not the parenthesis;)
http://docs.python.org/library/stdtypes.html#typesseq
"A single item tuple must have a trailing comma, such as (d,)."
On Thu, Feb 19, 2009 at 3:57 PM, alex goretoy
wrote:
> Thank you for clerification Christian,
> when using trailing
I'm pretty sure that Foo is getting replaced once you import Foo, why not
pass the Foo() object to bar's go? I'm sure there are other ways, but yes,
circular imports are indeed evil.
On Thu, Feb 26, 2009 at 5:13 PM, Chris Rebert wrote:
> On Thu, Feb 26, 2009 at 1:48 PM, Jesse Aldridge
> wrote:
Not sure I understand what is self.P, but look at the __getitem__ and
__setitem__ overloads
--Sent from my iPhone
On Apr 23, 2009, at 7:10 PM, Stef Mientki
wrote:
hello,
I've a program where you can connect snippets of code (which I call
a "Brick") together to create a program.
To mak
Developing on a machine with a 2.6.5 kernel, which unfortunately, is not
blessed with inotify and we do not have FAM. I was wondering if there are
pre-built extensions ( a few google searches turned up fruitless) that
utilize fcntl properly and allow for siginfo_t struct support when
attempting to
Here's something that I came up with so far, I'm having some issues with
segfaulting, if I want to pass a struct member by ref in ctypes(see below),
if not, I just get a
"Real-time signal 0" sent back to me.
Any ideas?
#!/usr/bin/env python import os, sys, re
try: import fcntl
except ImportError
action.sa_mask)*(position_in_sigaction)
rc = __clib.sigemptyset(byref(act))
Thanks!
Mahmoud
On Thu, Apr 30, 2009 at 7:33 PM, Philip wrote:
>
> ma gmail.com> writes:
>
> >
> >
> >
> >
> > Here's something that I came up with so far, I'm having
If I have this struct in C:
struct spam {
int ham;
char foo;
};
if I have this declaration:
struct spam s_;
If I wanted to pass a reference to a function of s_'s foo character, I
can do something like this:
somefunc(&s_.foo)
How do I do the same thing in ctypes?
ctypes.addressof(s_) +
ctypes.byref() does not work for struct members.
Try it out.
class s(ctypes.Structure):
_fields_ = [('x',ctypes.c_int)]
a = s()
ctypes.byref(a.x) //this won't work.
On Fri, May 1, 2009 at 2:28 PM, CTO wrote:
> ctypes.byref()
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
with this before?
I attached my latest copy. Any insight is appreciated.
On Thu, Apr 30, 2009 at 7:37 PM, ma wrote:
> I attached a clean copy of the .py file in case others couldn't read
> it in their emails.
> I'll try that and let you know how SIGRTMIN+1 goes!
> What a
This isn't list comprehension, but it's something to keep in mind:
b = filter(lambda x: None not in x, input_list)
On Sat, May 2, 2009 at 10:25 PM, CTO wrote:
> On May 2, 10:13 pm, Ross wrote:
> > I'm trying to set up a simple filter using a list comprehension. If I
> > have a list of tuples,
void *si_addr;
int si_status;
int si_band;
} siginfo_t;
Thanks,
Mahmoud
On Fri, May 1, 2009 at 3:08 PM, ma wrote:
>
> According to man signal,
> "The default action for an unhandled real-time signal is to terminate
> the receiving process."
>
>
Sure, I'll send you the source files when I get a chance!
--Sent from my iPhone
On May 6, 2009, at 4:03 PM, Philip wrote:
ma gmail.com> writes:
Ok! So, I decided to write a C-extension instead of using ctypes...
This works beautifully. Now, I want to release this to the public
You have to wait until IO is ready. In Unix, we accomplish this with
fcntl and the default signal SIGIO, I am not sure how you would do
this in Windows.
On Mon, May 11, 2009 at 9:51 AM, justind wrote:
> Hello,
>
> I'm using http://code.activestate.com/recipes/156178/ to watch a
> folder in windo
A really great use for try/except/else would be if an object is
implementing its own __getitem__ method, so you would have something
like this:
class SomeObj(object):
def __getitem__(self, key):
try:
#sometype of assertion here based on key type
That's great to know! Thanks for that explanation, I am refactoring
something and I was going to make ample use of assertion as I thought
it was the same as C's assertion without the NDEBUG flag.
On Thu, May 14, 2009 at 1:03 AM, Steven D'Aprano
wrote:
> On Thu, 14 May 2009
http://web.archive.org/web/20071105095205/www.jorendorff.com/articles/python/path/
On Thu, May 21, 2009 at 4:10 PM, Kay Schluehr wrote:
> On 21 Mai, 21:43, Jorge Vargas wrote:
> > Hello.
> >
> > Anyone knows what is the problem with this package? apparently the
> > author's site is down which
Try out PyChart, it's a very complete and has a great interface. I use
it to generate statistics for some of our production machines:
http://home.gna.org/pychart/
On Wed, Jun 3, 2009 at 1:28 PM, Esmail wrote:
> Gökhan SEVER wrote:
>>
>> I don't know how easy to use pygame or pyOpenGL for data ani
import os
if os.path.islink('symbolic_link'):
print "hello."
Cheers,
Mahmoud Abdelkader
On Oct 28, 2009, at 11:19 PM, Peng Yu wrote:
'symbolic_link' is a symbolic link in the current directory. I run
'python main.py', but it does not return me anything. I want to check
if a file is a sym
Has anyone come across a decent python API wrapper for TWiki? I'm trying to
automate some reports and logs to automatically post, create topics, and
re-arrange a few things on our TWiki, but my googleFu has failed me :(
I did find an interesting module in Perl,
http://cpanratings.perl.org/dist/WWW
filter(lambda x: x, your_list)
On Wed, Jul 8, 2009 at 10:44 AM, Daniel Austria wrote:
> Hi python - hackers,
>
> just one question. How can i remove all 0 values in a list? Sure - i
> can loop over it, but that s not a neat style. list.remove() will
> only remove the first occurence. Doing that
Hi, all.
pySerial is probably "the solution" for serial port programming.
Physical serial port is dead on PC but USB-to-Serial give it a second
life. Serial port stuff won't interest end users at all. But it is
still used in the EE world and so on. Arduino uses it to upload
programs. Sensors may u
A bit more context.
If visiting z.cn (Amazon China), one can see that there are plenty of
new (published in 2010 or later) books on QBASIC, Visual Basic, Visual
Foxpro.
This is weird, if one want to do development legally these tools won't
be a option for new programmers.
However, I also like to
Hi, list.
I hope this is not a duplicate of older question. If so, drop me a
link is enough.
I've used Python here and there, just for the sweet libraries though.
For the core language, I have mixed feeling. On one hand, I find that
Python has some sweet feature that is quite useful. On the othe
On Thu, May 30, 2013 at 8:24 AM, Dan Stromberg wrote:
> I'm finding it kind of hard to imagine not finding Python's syntax and
> semantics pretty graceful.
>
> About the only thing I don't like is:
>
>var = 1,
>
> That binds var to a tuple (singleton) value, instead of 1.
>
> Oh, and method de
I've already mailed the author, waiting for reply.
For Windows people, downloading a exe get you pySerial 2.5, which
list_ports and miniterm feature seems not included. To use 2.6,
download the tar.gz and use standard "setup.py install" to install it
(assume you have .py associated) . There is no
On Thu, May 30, 2013 at 2:18 PM, Steven D'Aprano
wrote:
> Which people? "People" can discuss any rubbish they like. For many
> reasons, tkinter will not be replaced. For the standard library, it is a
> good, stable, powerful but not cutting-edge GUI library. If you don't
> like it, you can install
On Fri, May 31, 2013 at 1:28 AM, Chris Angelico wrote:
> for (int i=0;i {
> //do something with foo[i]
> }
This is interesting!
--
http://mail.python.org/mailman/listinfo/python-list
functional VS imperative?
mechanical thinking VS mathematical thinking?
Sounds interesting.
--
http://mail.python.org/mailman/listinfo/python-list
e know if you have any suggestions, ideas
> to this rant.
>
> Thanks!
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Best wishes,
Jason Ma
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I am using Python2.
For the following snippet,
http://ideone.com/i36pKO
I'd suppose the dummy_func would be invoked, but seems not.
Indeed, heapq.heapify does invoke cmp_lt per here:
https://hg.python.org/cpython/file/2.7/Lib/heapq.py#l136
So why this way of monkey patching failed?
Reg
Hi,
Given a = [1, 2]
a.extend(a) makes a = [1,2, 1,2]
One might guess a.extend(a) would turn into an infinite loop. It turns out
here Python first gets all the items of `a' and then append them to `a', so the
infinite loop is avoided.
My question is, is there any doc on the behavior of thing
Hi,
In the pep,
https://www.python.org/dev/peps/pep-0492/#examples-of-await-expressions
It is said,
await await coro() is SyntaxError, instead, we should use await (await coro())
Why? because of await is not left-associative?
also, for
await -coro() , it should be written as, await (-coro
Hi,
I wanna simulate C style integer division in Python3.
So far what I've got is:
# a, b = 3, 4
import math
result = float(a) / b
if result > 0:
result = math.floor(result)
else:
result = math.ceil(result)
I found it's too laborious. Any quick way?
--
吾輩は猫である。ホームーページはhttps://introo.me
2014-11-28 9:26 GMT+08:00 Seymore4Head :
> def __str__(self):
> s = "Hand contains "
> for x in self.hand:
> s = s + str(x) + " "
> return s
>
> This is part of a Hand class. I need a hand for the dealer and a hand
> for the player.
> dealer=Hand()
> player=
2014-11-28 13:00 GMT+08:00 Chris Angelico :
> On Fri, Nov 28, 2014 at 2:04 PM, Shiyao Ma wrote:
>> What if it's in the local namespace of a function or method? IDK, try
>> to get that thing first.
>
Sure enough. I will even avoid using "id" as it's dependent
2014-11-29 11:36 GMT+08:00 Chris Angelico :
> You can use id() on any object. You are guaranteed to get back an
> integer which is both stable and unique among all ids of objects that
> exist at the same time as the one you called it on. For as long as the
> object continues to exist, that number *
within function:
>
> >>> def myfunc():
> x = ([1, 2], [3, 4], [5, 6])
> L = []
> [L.extend(i) for i in x]
> print(L)
>
> >>>myfunc()
> [1, 2, 3, 4, 5, 6]
This is also so true, as you are print the var 'L'.
>
> The q
n, based on what information a thread is formed?
--
Shiyao Ma
http://introo.me
--
https://mail.python.org/mailman/listinfo/python-list
.. else:
> ... print "BYE"
> ...
so see here: https://bpaste.net/show/d2f1cf66a492 . It prints "HI"
/me always wishes code is sent without others doing some extra formatting
before testing.
Hope that helps.
--
Shiyao Ma
http://introo.me
--
https://mail.python.org/mailman/listinfo/python-list
oop with ', 9.5367431640625e-07)
('B, finish a loop with ', 9.5367431640625e-07)
...
"""
We can see that the first iteration of B ends rather slow, 8.7 seconds here.
Why? I am curious about the internals, what's happening under the hood that
makes this happen?
Thanks in advance!
--
Shiyao Ma
http://introo.me
--
https://mail.python.org/mailman/listinfo/python-list
One thing to note, the logic of using "in" is not of concern here.
This is a *contrived* example, the problem is the slowness of the first
iteration.
--
https://mail.python.org/mailman/listinfo/python-list
Thanks guys.
I was only aware of a limited iterables which themselves are iterators, e.g.,
the generator.
Seems like its really a pitfall. Any glossary, list on the iterables that
*might* exhaust themselves?
Regards.
--
https://mail.python.org/mailman/listinfo/python-list
else:
continue
return count
More preferably, you should repetitively use "str.find"
Or just use `max(0,len(zmienna.split(szukana))-1)`
--
Shiyao Ma
http://introo.me
--
https://mail.python.org/mailman/listinfo/python-list
On Jan 05 at 22:38 +0800, Shiyao Ma wrote:
> More preferably, you should repetitively use "str.find"
>
> Or just use `max(0,len(zmienna.split(szukana))-1)`
Forgot there was a `str.count`, ;).
--
Shiyao Ma
http://introo.me
--
https://mail.python.org/mailman/listinfo/python-list
instantiate an instance of Node
n = Node()
# I checked, there is no __dict__ on 'n'
# but the following succeeds.
n.foobar = 3
My understanding is the foobar is stored in n.__dict__, but seemingly n has no
__dict__.
So where does the foobar go?
TIA.
--
Shiyao Ma
http://introo.me
Sorry. I don't quite get it. As you said, it first tries,
leftOperand.__eq__(rightOperand) then if it returns NotImplemented, it goes
to invoke rightOperand.__eq__(leftOperand). But for any reason, [] == ()
returns false, why?
On Mon, Aug 5, 2013 at 7:06 AM, Chris Angelico wrote:
> On Sun, Aug
Hi.
While reading the rich_compare of PyLongObject, I noticed this line:
https://hg.python.org/cpython/file/a49737bd6086/Objects/longobject.c#l2785
It increments the ob_ref of the builtin True/False object.
Initializing the ob_ref of True/False to one so that they won't be
garbage collected if
On Wed, Apr 8, 2015 at 11:24 AM, Ian Kelly wrote:
> The ref count is incremented because the caller will decrement it when
> it's done with the reference.
That makes sense.
To be generic, the caller won't check what the returned result is. It
just takes it as a normal PyObject. Traditionally, fo
Hi,
It looks to me that the import system of Python will ignore invalid
directories and cache the result in memory.
For example, the following code:
paste here: https://bpaste.net/show/b144deb42620
#!/usr/bin/env python3
import sysimport osimport shutil
sys.path.append("./test")shutil.rmtree("./
Yep. I followed from bltmodule.c(the import function) and got to the
import.c file, and finally got lost.
Regards.
On Tue, Jul 21, 2015 at 12:16 PM, Mark Lawrence
wrote:
> On 21/07/2015 16:35, Shiyao Ma wrote:
>
>> Hi,
>>
>> It looks to me that the import system of Py
2014-06-09 23:34 GMT+08:00 Roy Smith :
> We noticed recently that:
>
> >>> None in 'foo'
>
> raises (at least in Python 2.7)
>
> TypeError: 'in ' requires string as left operand, not NoneType
>
> This is surprising. The description of the 'in' operatator is, 'True if
> an item of s is equal to x,
It would be great if someone could discuss it from the viewpoint of
bytecode. e.g., how the stack is popped, etc.
2014-06-09 17:40 GMT+08:00 Marko Rauhamaa :
> Philip Shaw :
>
> > OTOH, it could just be that Guido didn't think of banning [return from
> > finally] when exceptions were first added
I wonder if it's opensourced. I am kinda interested in its implementation.
On the whole, the performance is rather good.
2014-06-10 22:39 GMT+08:00 Mark H Harris :
> On 6/9/14 3:54 PM, Carlos Anselmo Dias wrote:
>
>> Hi ...
>>
>> I'm finishing my messages with this ...
>>
>> The first time I loo
Ask on the goagent googlecode?
exe is fow win, dig out more on the linux version. I bet it should be
delivered with py source in that version.
Regards.
2014-07-03 10:20 GMT+08:00 liuerfire Wang :
> Hi 水静流深
> the source code is on https://github.com/goagent/goagent
>
> Hi Terry,
> GoAgent, a to
Hi Pythonistas
I often heard people mention use help(ob) as a way of documentation
look up. Personally I seldom/never do that. My normal workflow is use
ipython, obj? or obj?? for quick look up or use docs.python.org for a
detailed read.
Do you use `help`? How does it integrate into your workflo
Hi.
Anyone with working experience on setting up Python3 dev with vim?
functionalities needed: code completion and jump to defintion
YCM suffices but only with py2.
Any vim (plugin) for py3?
Or do you have any experience both running YCM and jedi-vim(for py3) ?
How's that going?
Regards
--
No intent to pollute this thread.
But really interested in the invalid@invalid.invalid mailing address.
And,,, obviously, I cannot send to invalid@invalid.invalid, so
How does you(he) make this?
2014-07-21 22:27 GMT+08:00 Grant Edwards :
> I was always taught that it's a "bug" is when a program
Hi.
what's the location of the function that reads the .pyc file ?
I bet it should lie in somewhere in
https://hg.python.org/cpython/file/322ee2f2e922/Lib/importlib
But what's the actual location?
Btw, why I need it?
I want to know the structure of a .pyc file. Of course the function
that read
When reading the notes on co_lnotab
I totally got lost at this
line:https://hg.python.org/cpython/file/fd0c02c3df31/Objects/lnotab_notes.txt#l31
It says,"In case #b, there's no way to know
from looking at the table later how many were written."
No way to know "what" is written?
And why no way
Today I come across a problem.
Basically, my need is that I want to launch a http server that can not only
support get but also support post (including post file).
My first idea is to use -m http.sever. However, it only supports get.
Later I find some one extended basehttpserver and made it suppor
Yes, sounds good. I should give it a try.
On Tue, Mar 12, 2013 at 1:02 AM, Xavier L. wrote:
> On 13-03-11 10:42 AM, Shiyao Ma wrote:
>
>> Today I come across a problem.
>> Basically, my need is that I want to launch a http server that can not
>> only support get but also
HI.
one thing confuses me.
It is said in the pep3101 that "{}".format (x) will invoke the method
x.__format__
However, I looked at the src of python3 and found:
in class str(object), the format simply contains a pass statement
in class int(object), things is the same.
So, what's the mechanism that
Hi,
suppose I have a file like this:
class A:
r = 5
def func(self, s):
self.s = s
a = A()
print(a.r)# this should print 5, but where does py store the name of r
a.func(3)
print(a.s)# this should print 3, also where does py store this name.
what's the underlying difference b
PS, I now python's scoping rule is lexical rule (aka static rule). How does
LEGB apply to class?
On Tue, Mar 26, 2013 at 2:17 PM, Shiyao Ma wrote:
> Hi,
> suppose I have a file like this:
> class A:
> r = 5
> def func(self, s):
> self.s = s
> a =
ote:
> On Tue, Mar 26, 2013 at 5:17 PM, Shiyao Ma wrote:
> > class A:
> > r = 5
> > def func(self, s):
> > self.s = s
> > a = A()
> > print(a.r)# this should print 5, but where does py store the name of
> r
>
> What do you mean by
urn a formatted version of S, using substitutions from args and
kwargs.
The substitutions are identified by braces ('{' and '}').
"""
pass
I am curious how you find the corresponding c source code.
On Tue, Mar 26, 2013 at 2:16 PM, Ian Kell
Thx, really a nice and detailed explanation.
On Tue, Mar 26, 2013 at 6:07 PM, Dave Angel wrote:
> On 03/26/2013 02:17 AM, Shiyao Ma wrote:
>
>> Hi,
>> suppose I have a file like this:
>> class A:
>> r = 5
>> def func(self, s):
>> sel
After read Dave's answer, I think I confused LEGB with attribute lookup.
So, a.r has nothing to do with LEGB.
On Tue, Mar 26, 2013 at 7:03 PM, Shiyao Ma wrote:
> Thx, really a nice and detailed explanation.
>
>
> On Tue, Mar 26, 2013 at 6:07 PM, Dave Angel wrote:
>
>&
www.antollma.org
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I'd appreciate your hints on this problem. I'm writing a module in which several
functions can alter the value of a global variable (I know this sounds evil,
please forgive me...). What I'm trying to do is to eliminate the "global foo"
lines in those functions' bodies and to use a decorator fo
Terry Reedy wrote:
> Not to me. You are using the module as a singleton class. The
> alternative is to write a class, make the functions methods, and
> instantiate the class. If that instance must be a singleton, more work
> is required. If multiple instances make sense, you can go the class
> r
Dear all,
Can you give me some hint on getting a directory file descriptor in Python?
Besides, what's good about os.fchdir() if I can't get a directory fd in the
first place?
Thanks for your reply.
Regards,
Cong.
--
http://mail.python.org/mailman/listinfo/python-list
r0g wrote:
> Cong Ma wrote:
>> Dear all,
>>
>> Can you give me some hint on getting a directory file descriptor in Python?
>> Besides, what's good about os.fchdir() if I can't get a directory fd in the
>> first place?
>>
>> Thanks for
alex23 wrote:
> On Nov 26, 12:31 am, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote:
>> Is this what you want?
>>
>> ofiles = [open(x) for x in os.listdir(os.getcwd())]
>
> 'open' returns a "file object", whereas the OP is after "file
> descriptors", which are returned by 'os.open'.
>
> --
> http:/
alex23 wrote:
> On Nov 26, 3:26 pm, greg <[EMAIL PROTECTED]> wrote:
>> os.O_DIRECTORY must be fairly new -- it doesn't exist
>> in my 2.5 installation. But os.O_RDONLY seems to work
>> just as well for this purpose.
>
> Which OS are you using?
>
> Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
Nick Craig-Wood wrote:
> Here is how you do exactly that in python using ctypes
>
> from ctypes import CDLL, c_char_p, c_int, Structure, POINTER
> from ctypes.util import find_library
>
> class c_dir(Structure):
> """Opaque type for directory entries, corresponds to struct DIR"""
> c_dir_p =
Lawrence D'Oliveiro wrote:
> for \
> Entry \
> in \
> sorted \
> (
> f for f in os.listdir(PatchesDir) if PatchDatePat.search(f) !=
> None
> ) \
> :
> Patch = (open,
> gzip.GzipFile)[Entry.endswith(".gz")](os.path.join(PatchesDir, Entry), "r
Hello,
I'm writing a program that pickles an instance of a custom subclass of
datetime.tzinfo. I followed the guides given in the Library Reference (version
2.5.2, chapter 5.1.6), which contain the note:
"Special requirement for pickling: A tzinfo subclass must have an __init__
method that can be
Gabriel Genellina wrote:
> En Mon, 08 Dec 2008 12:34:03 -0200, Cong Ma <[EMAIL PROTECTED]> escribió:
>
>> I'm writing a program that pickles an instance of a custom subclass of
>> datetime.tzinfo. I followed the guides given in the Library Reference
>> (vers
hai,
Uses : The package includes a personal firewall, phishing protection
and the ability to detect and remove malware.
Norton 360 is compatible with 32-bit editions of Windows XP and 32-bit
or 64-bit editions of Windows Vista.Windows 7 support has been added.
Reviews cited Norton 360's low resour
I'd like a copy of that code. Thanks for taking the time for all of us.
Sincerely,
Aaron Dushku
**
Aaron Dushku
GIS Specialist
USDA-NRCS
Amherst, Massachusetts
(413) 253-4379
Email: aaron.dushku at ma.usda.gov
--
http://mail.python.org/mailman/listinfo/python-li
84 matches
Mail list logo