Re: Get thread pid

2009-01-30 Thread ma
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

Re: Get thread pid

2009-01-30 Thread ma
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

Re: Will multithreading make python less popular?

2009-02-17 Thread ma
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 > >

Re: Explanation for trailing comma in example from Learning Python?

2009-02-19 Thread ma
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

Re: Can someone explain this behavior to me?

2009-02-26 Thread ma
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:

Re: can't find the right simplification

2009-04-23 Thread ma
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

fcntl and siginfo_t in python

2009-04-28 Thread ma
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

Re: fcntl and siginfo_t in python

2009-04-29 Thread ma
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

Re: fcntl and siginfo_t in python

2009-04-30 Thread ma
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

ctypes: reference of a struct member?

2009-05-01 Thread ma
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_) +

Re: ctypes: reference of a struct member?

2009-05-01 Thread ma
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 > --

Re: fcntl and siginfo_t in python

2009-05-01 Thread ma
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

Re: yet another list comprehension question

2009-05-03 Thread ma
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,

Re: fcntl and siginfo_t in python

2009-05-04 Thread ma
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." > >

Re: fcntl and siginfo_t in python

2009-05-06 Thread ma
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

Re: win32 How to make sure a file is completely written?

2009-05-11 Thread ma
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

Re: What's the use of the else in try/except/else?

2009-05-13 Thread ma
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

Re: What's the use of the else in try/except/else?

2009-05-13 Thread ma
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

Re: How to get path.py ? http://www.jorendorff.com/ is down

2009-05-22 Thread ma
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

Re: easiest way to plot x,y graphically during run-time?

2009-06-03 Thread ma
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

Re: How to test if a file is a symbolic link?

2009-10-28 Thread ma
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

TWiki Python API Wrapper

2009-06-29 Thread ma
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

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread ma
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

The state of pySerial

2013-05-29 Thread Ma Xiaojun
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

Re: How clean/elegant is Python's syntax?

2013-05-29 Thread Ma Xiaojun
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

How clean/elegant is Python's syntax?

2013-05-29 Thread Ma Xiaojun
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

Re: How clean/elegant is Python's syntax?

2013-05-29 Thread Ma Xiaojun
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

Re: The state of pySerial

2013-05-29 Thread Ma Xiaojun
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

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ma Xiaojun
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

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ma Xiaojun
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

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ma Xiaojun
functional VS imperative? mechanical thinking VS mathematical thinking? Sounds interesting. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cancel threads after timeout

2013-01-27 Thread Jason Ma
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

Why monkey patching on module object doesn't work ?

2016-08-17 Thread Shiyao Ma
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

The order of iterable de-referencing in assignment?

2016-08-24 Thread Shiyao Ma
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

Regarding the parsing of await expression.

2016-11-06 Thread Shiyao Ma
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

How to simulate C style integer division?

2016-01-21 Thread Shiyao Ma
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

Re: Can you use self in __str__

2014-11-27 Thread Shiyao Ma
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=

Re: Can you use self in __str__

2014-11-28 Thread Shiyao Ma
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

Re: Can you use self in __str__

2014-11-28 Thread Shiyao Ma
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 *

Re: Tuple of lists concatenation - function vs comprehension

2014-12-07 Thread Shiyao Ma
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

Re: Setting default_factory of defaultdict to key

2014-12-07 Thread Shiyao Ma
n, based on what information a thread is formed? -- Shiyao Ma http://introo.me -- https://mail.python.org/mailman/listinfo/python-list

Re: Python re.search simple question

2014-12-07 Thread Shiyao Ma
.. 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

Nested loops is strangely slow, totally at a loss.

2014-12-09 Thread Shiyao Ma
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

Re: Nested loops is strangely slow, totally at a loss.

2014-12-09 Thread Shiyao Ma
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

Re: Nested loops is strangely slow, totally at a loss.

2014-12-10 Thread Shiyao Ma
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

Re: problem with for and if

2015-01-05 Thread Shiyao Ma
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

Re: problem with for and if

2015-01-05 Thread Shiyao Ma
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

Weird behavior on __dict__ attr

2015-02-09 Thread Shiyao Ma
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

Re: Bug? ( () == [] ) != ( ().__eq__([]) )

2013-08-07 Thread Shiyao Ma
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

Why PyINCREF on _PyFalseStruct and _PyTrueStruct?

2015-04-08 Thread Shiyao Ma
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

Re: Why PyINCREF on _PyFalseStruct and _PyTrueStruct?

2015-04-08 Thread Shiyao Ma
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

Where is the c source code of the import mechanism that ignores invalid directory?

2015-07-21 Thread Shiyao Ma
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("./

Re: Where is the c source code of the import mechanism that ignores invalid directory?

2015-07-21 Thread Shiyao Ma
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

Re: None in string => TypeError?

2014-06-09 Thread Shiyao Ma
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,

Re: try/except/finally

2014-06-09 Thread Shiyao Ma
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

Re: First time I looked at Python was(...)

2014-06-10 Thread Shiyao Ma
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

Re: how can i get the source code of goagent.exe?

2014-07-02 Thread Shiyao Ma
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

How do you use `help` when write your code

2014-07-06 Thread Shiyao Ma
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

Python3+Vim dev environment

2014-07-17 Thread Shiyao Ma
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 --

Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"!

2014-07-21 Thread Shiyao Ma
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

What's the function location that reads the cached .pyc file from disk.

2014-09-15 Thread Shiyao Ma
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

Understanding co_lnotab

2014-09-26 Thread Shiyao Ma
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

How to quickly set up a multithreaded server that can handle http file post.

2013-03-11 Thread Shiyao Ma
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

Re: How to quickly set up a multithreaded server that can handle http file post.

2013-03-11 Thread Shiyao Ma
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

python3 string format

2013-03-25 Thread Shiyao Ma
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

At a loss on python scoping.

2013-03-25 Thread Shiyao Ma
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

Re: At a loss on python scoping.

2013-03-25 Thread Shiyao Ma
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 =

Re: At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
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

Re: python3 string format

2013-03-26 Thread Shiyao Ma
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

Re: At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
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

Re: At a loss on python scoping.

2013-03-26 Thread Shiyao Ma
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: > >&

CHRIST: THE ARRIVAL

2005-12-25 Thread Antoll MA
www.antollma.org -- http://mail.python.org/mailman/listinfo/python-list

Injecting a global into a defined function??

2009-01-15 Thread Cong Ma
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

Re: Injecting a global into a defined function??

2009-01-15 Thread Cong Ma
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

How to get a directory file descriptor?

2008-11-24 Thread Cong Ma
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

Re: How to get a directory file descriptor?

2008-11-25 Thread Cong Ma
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

Re: How to get a directory file descriptor?

2008-11-25 Thread Cong Ma
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:/

Re: How to get a directory file descriptor?

2008-11-26 Thread Cong Ma
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)

Re: How to get a directory file descriptor?

2008-11-26 Thread Cong Ma
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 =

Re: Don't you just love writing this sort of thing :)

2008-12-04 Thread Cong Ma
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

[Python 2.x] Pickling a datetime.tzinfo subclass instance?

2008-12-08 Thread Cong Ma
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

Re: [Python 2.x] Pickling a datetime.tzinfo subclass instance?

2008-12-09 Thread Cong Ma
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

Arisingsoft provides the Norton antivirus all in one security suite.

2011-01-03 Thread mani ma
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

Office COM automatisation - calling python from VBA

2009-07-23 Thread Dushku, Aaron - Amherst, MA
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