Why not BDWGC?

2006-04-27 Thread LuciferLeo
I've heard that the reason why python uses reference counting rather than tracing collector is because python cannot determine the root set for its various C extensions. But provided that BDWGC(full name: Boehm-Demers-Weiser conservative garbage collector) is conservative --- can be used for C, and

Re: Type-Def-ing Python

2006-04-27 Thread Alex Martelli
Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Alex Martelli <[EMAIL PROTECTED]> wrote: > ><[EMAIL PROTECTED]> wrote: > > ... > >> Brett Cannon's thesis in which he tweaks the compiler and shows that > >> type-defing python would not help the compiler achieve a 5% performace

append function problem?

2006-04-27 Thread randomtalk
hello, recently i tried to use list.append() function in seemingly logical ways, however, i cannot get it to work, here is the test code: >>> seed = [2, 3, 4, 5] >>> next = 7 >>> seed1 = seed.append(next) >>> seed1 >>> print(str(seed1)) None >>> def test(lst): ... print(str(lst)) ... >>> test(

Re: append function problem?

2006-04-27 Thread Murali
A typo here? seed v/s seed1. Instead of "print(seed.append(5))", try "seed.append(5)" followed by "print seed" -- "print(seed)" also works. The append method does not return the appended value (like many C functions). - Murali -- http://mail.python.org/mailman/listinfo/python-list

Re: can i set up a mysql db connection as a class ?

2006-04-27 Thread *binarystar*
that's definitely the way to go .. -create a database_object -initialise at start up -then pass the database object to other classes as needed ... If you want to get really fancy have a look at some ORM's ... I think there is a Python one called SQLObject? [EMAIL PROTECTED] wrote: > hey there,

raw_input passing to fun

2006-04-27 Thread Gary Wessle
the output of this code below is not what one would expect, it outputs all kind of numbers and it never stops, I want to ask the user for a number and then print out the multiplication table up to that number. thanks import math

Re: append function problem?

2006-04-27 Thread John Machin
On 28/04/2006 1:49 PM, [EMAIL PROTECTED] wrote: > hello, recently i tried to use list.append() function in seemingly > logical ways, however, i cannot get it to work, here is the test code: > seed = [2, 3, 4, 5] next = 7 seed1 = seed.append(next) seed1 print(str(seed1)) >

Re: Protocols for Python?

2006-04-27 Thread Gregor Horvath
[EMAIL PROTECTED] schrieb: > > Is there a standard way to document protocols in Python? Of should I > come up with something tailored to my needs. > Write unittests or doctest strings. -- Servus, Gregor http://www.gregor-horvath.com -- http://mail.python.org/mailman/listinfo/python-list

Re: raw_input passing to fun

2006-04-27 Thread John Machin
On 28/04/2006 2:04 PM, Gary Wessle wrote: > > the output of this code below is not what one would expect, it outputs > all kind of numbers and it never stops, I want to ask the user for a > number and then print out the multiplication table up to that number. That's what you want, but not what yo

Re: raw_input passing to fun

2006-04-27 Thread Gary Wessle
John Machin <[EMAIL PROTECTED]> writes: > On 28/04/2006 2:04 PM, Gary Wessle wrote: > > the output of this code below is not what one would expect, it > > outputs > > all kind of numbers and it never stops, I want to ask the user for a > > number and then print out the multiplication table up to t

Re: can i set up a mysql db connection as a class ?

2006-04-27 Thread nephish
This is great ! ok, i dont really have a lot of time to get into the ORMS (before your post, this is the first i have heard of it) and my stuff is due on Monday. he he. but, if i am able to make a global db connection, and multiple cursors pointing to the same connection object, how do i pull tha

Two ElementTree questions

2006-04-27 Thread mirandacascade
1) It appears as if the following logic works for determining whether an element is a parent: # assume elem is an ElementTree element if (elem.getchildren() == None): print 'this element is not a parent' else: print 'this element is a parent' My question is this: are there any other ways

print out each letter of a word

2006-04-27 Thread Gary Wessle
I am going through this tut from http://ibiblio.org/obp/thinkCS/python/english/chap07.htm I am getting errors running those 2 groups as below as is from the tut thanks index = 0 while index < len(fruit): letter = fruit[index] print letter index = index + 1 or for char in fruit:

Re: Help needed on COM issue

2006-04-27 Thread Mike Howard
Thanks for the suggestions. I tried the tuple to list to tuple method with no success Its not a .Value issue either. In order to keep going I've left this code as vb for the moment -- http://mail.python.org/mailman/listinfo/python-list

Re: Two ElementTree questions

2006-04-27 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > 1) It appears as if the following logic works for determining whether > an element is a parent: > > # assume elem is an ElementTree element > if (elem.getchildren() == None): > print 'this element is not a parent' > else: > print 'this element is a parent' > > My

Re: How to import whole namespace into global symbol table? (newbie)

2006-04-27 Thread Peter Otten
Scott Simpson wrote: > Lastly, is there an equivalent of Perl's "die" function? I'm writing to > stderr and dieing above but I'm not quite sure if this is the "correct" > way. You can call sys.exit() with a string. Python will print it to stderr and terminate with a nonzero exit status. Peter --

Re: can i set up a mysql db connection as a class ?

2006-04-27 Thread *binarystar*
your on the right track ... create something like this ( hope the formatting doesn't go to hay wire ) class DB_Connector(object): """ Humble Database Connection Class """ def __init__(self, host="localhost", user="MyUser",passwd="MyPassword", **other_db_arguments):

Re: print out each letter of a word

2006-04-27 Thread vbgunz
what errors are you getting? Could it be an indentation error? I don't see anything wrong with the script except the value of fruit is missing. if fruit is a string, it should work like a charm. double check the length of the fruit with print len(fruit) and check fruit with print type(fruit) and ma

Re: print out each letter of a word

2006-04-27 Thread Peter Otten
Gary Wessle wrote: > I am going through this tut from > http://ibiblio.org/obp/thinkCS/python/english/chap07.htm > > I am getting errors running those 2 groups as below as is from the tut Next time, please copy and paste the complete "traceback", the error messages that clutter your screen when

Re: can i set up a mysql db connection as a class ?

2006-04-27 Thread *binarystar*
Oops .. slight edit now when you pass the db_connection instance to other classes, a reference will be passed automagically -- http://mail.python.org/mailman/listinfo/python-list

Re: append function problem?

2006-04-27 Thread vbgunz
seed = [1,2,3] seed.append(4) print seed # [1,2,3,4] many of the list methods are in place methods on a mutable object. In other words, doing the following results in None. seed = [1,2,3] seed = seed.append(4) print seed # None you also just wiped out your list... The append method like many o

Re: can i set up a mysql db connection as a class ?

2006-04-27 Thread Winfried Tilanus
On 04/28/2006 07:54 AM, *binarystar* wrote: Just wondering: is there any risk of two threads accessing the Execute function at the same time and getting something like this on the same cursor object: thread_1: self.cursor.Execute( sql_statement ) thread_2: self.cursor.Execute( sql_statement ) thr

Re: append function problem?

2006-04-27 Thread *binarystar*
# Try This seed = [2, 3, 4, 5] next = [7] seed1 = seed + next [EMAIL PROTECTED] wrote: > hello, recently i tried to use list.append() function in seemingly > logical ways, however, i cannot get it to work, here is the test code: > seed = [2, 3, 4, 5] next = 7 seed1 = seed.append(

Re: can i set up a mysql db connection as a class ?

2006-04-27 Thread *binarystar*
I suppose that is possible because you are calling the one instance of a cursor object ... maybe you have to create a copy of the cursor object, rather than passing a reference to the one object? or set up the db_connection objects inside each of the threads? .. Winfried Tilanus wrote: > On 0

Re: Pyrex installation on windows XP: step-by-step guide

2006-04-27 Thread Julien Fiore
sturlamolden wrote: > edit the text file "c:\mingw\lib\gcc\mingw32\3.2.4\specs" > and change "-lmsvcrt" to "-lmsvcr71". Thank you very much sturlamolden, This procedure should be added to the "step-by-step" guide (see 1st message of this thread) as "step A.5". For ignorant people like me, CRT =

Re: Converstion

2006-04-27 Thread Paddy
Something like (untested): out = [] for ch in instring: if ch==backspace: if out: out = out[:-1] else: out.append(ch) outstring = ''.join(out) - Pad. -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3