On 10 May, 18:02, HMS Surprise <[EMAIL PROTECTED]> wrote:
> Trying not to be a whiner but I sure have trouble finding syntax in
> the reference material. I want to know about list operations such as
> append. Is there a pop type function? I looked in tutorial, language
> reference, and lib for list
docs.python.org/lib/curses-panel-objects.html
--
Bill Pursell
--
http://mail.python.org/mailman/listinfo/python-list
Bill Pursell wrote:
> I've got a simple extension module that contains two functions:
> void hi(void) __attribute__((constructor));
> void hi(void) { printf("Hi!\n");}
> void bye(void) __attribute__((destructor));
> void bye(void) { printf("Bye!\n"
;> import spam
Hi!
>>> del spam
>>>
Notice that the destructor isn't called. How can I force python
to dlclose() the library and ensure that my destructors get called?
--
Bill Pursell
--
http://mail.python.org/mailman/listinfo/python-list
Grant Edwards wrote:
>
> Perl has syntax?
ROTFLMAO. In fact, that even motivated:
Psychotically Engineered Random Language.
--
Bill Pursell
--
http://mail.python.org/mailman/listinfo/python-list
Jason Jiang wrote:
> Hi,
>
> How to get the name of the running .py file like the macro _FILE_ in C?
There are many ways--IMO the easiest is with __file__:
>>> print __file__
/home/bill/.pystart
>>>
[tmp]$ cat foo.py
#!/usr/bin/env python
print "The name of the file is:%s"%__file__
[tmp]$ ./foo
t; ["c", "a", "t" ] ]
>
> The actual data isn't as simple as this, but if I can get the logic
> sorted out, I can handle the other part.
>
> Anyone have any good ideas on how to do this?
how about:
>>> t = [ "a", "b", "c", "n", "a", "a", "t", "t", "t" ]
>>> [t[i::3] for i in range(0,len(t)/3)]
[['a', 'n', 't'], ['b', 'a', 't'], ['c', 'a', 't']]
--
Bill Pursell
--
http://mail.python.org/mailman/listinfo/python-list
Georg Brandl wrote:
> 01 wrote:
> > Georg Brandl wrote:
> >> [EMAIL PROTECTED] wrote:
> >> > bugnthecode 写道:
> >> >
> >> >> How are you trying to import it? Is it in the same directory as your
> >> >> other script? If not is your python path set correctly?
> >> >>
> >> >> When importing a module t
Georg Brandl wrote:
> Paul Rubin wrote:
> > Sybren Stuvel <[EMAIL PROTECTED]> writes:
> >> Because of "there should only be one way to do it, and that way should
> >> be obvious". There are already the str.join and unicode.join methods,
> >
> > Those are obvious???
>
> Why would you try to sum up
Bill Pursell wrote:
> The following code is pretty much straight out of
> section 1.2.1.1 of the Python/C reference manual:
>
> #include
>
> int
> main(void)
> {
> PyObject *l, *x;
>
> Py_Initialize();
>
> l = PyList_
tupid, but it certainly looks like PySequence_SetItem()
was expecting that there should already be an
item at the desired index.
Am I doing something stupid?
--
Bill Pursell
--
http://mail.python.org/mailman/listinfo/python-list
omitting
flags for the sake of brevity, or if I'm actually missing something.
--
Bill Pursell
--
http://mail.python.org/mailman/listinfo/python-list
Gerhard Fiedler wrote:
>There's no Python equivalent to "int*p=345; *p++;".
Sure there is:
os.kill(os.getpid(), signal.SIGSEGV)
:)
--
http://mail.python.org/mailman/listinfo/python-list
Yi Xing wrote:
> I want to read specific lines of a huge txt file (I know the line #).
> Each line might have different sizes. Is there a convenient and fast
> way of doing this in Python? Thanks.
#!/usr/bin/env python
import os,sys
line = int(sys.argv[1])
path = sys.argv[2]
os.system("sed -n %d
alf wrote:
> Hi,
>
> I have a two fold question:
> -how to attach the debugger to running multi threaded program
> -the objective is to find an infinite loop in one of threads which
> makes the whole thingy going craze (100%CPU)
>
> The program itself is not easy, in fact quite hude an
4zumanga wrote:
> Yes, there is a stupid mistake in that script, last line should be:
>
> diff new_out1 new_out2
>
> However, this is hopefully not important, what is important is the
> general kind of (very simple) things I'm trying to do.
I have been hoping for a good solution to this. An
easy
r.e.s. wrote:
> I have a million-line text file with 100 characters per line,
> and simply need to determine how many of the lines are distinct.
>
> On my PC, this little program just goes to never-never land:
>
> def number_distinct(fn):
> f = file(fn)
> x = f.readline().strip()
> L =
Peter Decker wrote:
> On 17 May 2006 06:51:19 -0700, Bill Pursell <[EMAIL PROTECTED]> wrote:
>
> > In my experience, the people who complain about the use
> > of tabs for indentation are the people who don't know
> > how to use their editor, and those peop
Xah Lee wrote:
> Tabs versus Spaces in Source Code
>
> Xah Lee, 2006-05-13
>
> In coding a computer program, there's often the choices of tabs or
> spaces for code indentation.
> (2) Due to the first reason, they have created and
> propagated a massive none-understanding and mis-use, to the degre
Clodoaldo Pinto wrote:
> I'm starting a programming tutorial for absolute beginners using Python
> and I would like your opinions.
>
> http://programming-crash-course.com
Very nicely laid out. Overall, a really nice presentation. 2 minor
points:
1) in the section on the interactive interpreter
none wrote:
> import pgdb;
>
> dbh = pgdb.connect(database = 'test')
> sth = dbh.cursor()
> sth.execute("SELECT * FROM capitals")
> #while 1:
> #results = sth.fetchone()
> #if results == None:
> #break
> #print results
> while results = sth.fetchone():
> print results
[EMAIL PROTECTED] wrote:
> Hi,
>
> I've been using C++ for a few years and have developed a few projects
> in C++. And I'm familar with OO and template metaprogramming.
>
> There are some book like "Learning Perl". It is a little bit tedious
> for me, because more material in that book seems obviou
22 matches
Mail list logo