ANN: cssutils 0.9.5b2

2008-03-23 Thread Christof Hoeke
what is it -- A Python package to parse and build CSS Cascading Style Sheets. (Not a renderer though!) main changes 0.9.5b2 - **API CHANGE**: ``cssutils.parseURL`` has been renamed to ``parseUrl`` for consistency with ``getUrls`` or ``replaceUrls``. Parameter

Python-URL! - weekly Python news and links (Mar 3)

2008-03-23 Thread Gabriel Genellina
QOTW: No, Google, I didn't want the Botswana daily news with its article on the Botswana National Front and another on a fellow arrested for having contraband python skins. - Martin Rineh, during his relentless search for Python's BNF

Re: finding items that occur more than once in a list

2008-03-23 Thread Bryan Olson
Arnaud Delobelle wrote: Bryan Olson wrote: We mean that the party supplying the keys deliberately chose them to make the hash table inefficient. In this thread the goal is efficiency; a party working toward an opposing goal is an adversary. There are situations where this can happen I

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread John Nagle
Paul Rubin wrote: Jeff Schwab [EMAIL PROTECTED] writes: I've been learning a fair amount about functional programming recently, mostly because compile-time C++ turns out to be a pure functional programming language. Where should I go for a solid grounding in lambda-calculus? For PL theory

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Paul Rubin
John Nagle [EMAIL PROTECTED] writes: What a mess. That's some professor inventing his very own variation on predicate calculus and writing a book using his own notation and terminology. I thought it was all pretty standard. It's the same notation I see in other PL stuff. There's no

Re: Pyparsing help

2008-03-23 Thread Paul McGuire
There are a couple of bugs in our program so far. First of all, our grammar isn't parsing the METAL2 entry at all. We should change this line: md = mainDict.parseString(test1) to md = (mainDict+stringEnd).parseString(test1) The parser is reading as far as it can, but then stopping

Re: re.search (works)|(doesn't work) depending on for loop order

2008-03-23 Thread sgharvey
On Mar 22, 5:03 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Sat, 22 Mar 2008 17:27:49 -0300, sgharvey [EMAIL PROTECTED] escribi�: Take a look at ConfigObjhttp://pypi.python.org/pypi/ConfigObj/ Thanks for the pointer; I'll check it out. I'm not sure you can process a config file in this

Re: Pyparsing help

2008-03-23 Thread Arnaud Delobelle
On Mar 22, 9:11 pm, rh0dium [EMAIL PROTECTED] wrote: Hi all, Hi, I am struggling with parsing the following data: test1 = Technology      {                 name                            = gtc                 dielectric                      = 2.75e-05 [...] I know it's cheating, but

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Steven D'Aprano
On Sat, 22 Mar 2008 23:15:00 -0700, John Nagle wrote: That's some professor inventing his very own variation on predicate calculus and writing a book using his own notation and terminology. There's no sign of footnotes or references to prior work. The notation doesn't seem to do anything not

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Berco Beute
On Mar 22, 5:40 pm, jmDesktop [EMAIL PROTECTED] wrote: For students 9th - 12th grade, with at least Algebra I. Do you think Python is a good first programming language for someone with zero programming experience? Using Linux and Python for first exposure to programming languages and

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Arnaud Delobelle
On Mar 23, 8:14 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Sat, 22 Mar 2008 23:15:00 -0700, John Nagle wrote: That's some professor inventing his very own variation on predicate calculus and writing a book using his own notation and terminology. There's no sign of

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Ben C
On 2008-03-22, bsoist [EMAIL PROTECTED] wrote: On Mar 22, 12:40 pm, jmDesktop [EMAIL PROTECTED] wrote: For students 9th - 12th grade, with at least Algebra I. Do you think Python is a good first programming language for someone with zero programming experience? Using Linux and Python for

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Martin P. Hellwig
jmDesktop wrote: For students 9th - 12th grade, with at least Algebra I. Do you think Python is a good first programming language for someone with zero programming experience? Using Linux and Python for first exposure to programming languages and principles. Thank you. I for one can't

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Dustan
On Mar 22, 10:40 am, jmDesktop [EMAIL PROTECTED] wrote: For students 9th - 12th grade, with at least Algebra I. Do you think Python is a good first programming language for someone with zero programming experience? Using Linux and Python for first exposure to programming languages and

Re: List question

2008-03-23 Thread Dustan
On Mar 21, 3:57 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: if 'one' and 'two' in f: alist.append(f) Use: if 'one' in f and 'two' in f: ... Personally, I would put parentheses around to be clearer: if ('one' in f) and ('two' in f): ...

Re: Removal of tkinter from python 3.0? [was: Fate of the repr module in Py3.0]

2008-03-23 Thread Guilherme Polo
2008/3/21, Martin v. Löwis [EMAIL PROTECTED]: I've been thinking of volunteering to port Tkinter to Python 3.0, I hadn't noticed that there was any discussion of removing it. It would be a shame IMHO. I don't think Tkinter will be removed. It works just fine in 3k. Of course, if you

Re: Problem with complex numbers

2008-03-23 Thread David C. Ullrich
On Sat, 22 Mar 2008 23:29:10 +0100, Christian Heimes [EMAIL PROTECTED] wrote: Matthias Götz schrieb: So can you tell me what's the purpose of Complex.py, and where can i find the semantic i'am looking for. Well, the file is in the Demo folder. It's just a demo how to implement a naive

Duplicating list of lists [newbie]

2008-03-23 Thread yatsek
Hi there. I felt like I already know my toys around but it looks that I'm still newbie on some points. So here goes problem: Lets say that we have list to copy: a = [1,2,3] b = a[:] a[0] = 5 a [5,2,3] b [1,2,3] So far so good But... let's say that a also contains lists: a = [1,2,[5,6,7]] b

Re: Duplicating list of lists [newbie]

2008-03-23 Thread George Sakkis
On Mar 23, 11:34 am, [EMAIL PROTECTED] wrote: Hi there. I felt like I already know my toys around but it looks that I'm still newbie on some points. So here goes problem: Lets say that we have list to copy: a = [1,2,3] b = a[:] a[0] = 5 a [5,2,3] b [1,2,3] So far so good

Testing for an empty dictionary in Python

2008-03-23 Thread John Nagle
What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : is expensive for large dictionaries, and makes loops O(N^2). John Nagle -- http://mail.python.org/mailman/listinfo/python-list

RE: Duplicating list of lists [newbie]

2008-03-23 Thread Ryan Ginstrom
On Behalf Of [EMAIL PROTECTED] So - it looks that in list b there copy of all objects from list a including not copy of list [5,6,7] but reference to it. Is there simple way to copy a into b (like a[:]) with all copies of all objects going as deep as possible? Or it can be done only

Soup Strainer for ElementSoup?

2008-03-23 Thread erikcw
Hi all, I was reading in the Beautiful Soup documentation that you should use a Soup Strainer object to keep memory usage down. Since I'm already using Element Tree elsewhere in the project, I figured it would make sense to use ElementSoup to keep the api consistent. (and cElementTree should be

RE: Testing for an empty dictionary in Python

2008-03-23 Thread Ryan Ginstrom
On Behalf Of John Nagle What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : is expensive for large dictionaries, and makes loops O(N^2). I believe that the following is fairly efficient: def dict_is_empty(D): for k in D:

Re: Testing for an empty dictionary in Python

2008-03-23 Thread D'Arcy J.M. Cain
On Sun, 23 Mar 2008 08:53:02 -0700 John Nagle [EMAIL PROTECTED] wrote: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : is expensive for large dictionaries, and makes loops O(N^2). Try this: if dict: It should be faster as it only

Re: Testing for an empty dictionary in Python

2008-03-23 Thread Brian Lane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John Nagle wrote: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : is expensive for large dictionaries, and makes loops O(N^2). John Nagle if dict:

pydoc

2008-03-23 Thread A Hutchison
Any known reasons why pydoc no longer works? AB -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing for an empty dictionary in Python

2008-03-23 Thread Paddy
On Mar 23, 3:53 pm, John Nagle [EMAIL PROTECTED] wrote: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : is expensive for large dictionaries, and makes loops O(N^2). John Nagle As others have

Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Aahz
In article [EMAIL PROTECTED], Jeff Schwab [EMAIL PROTECTED] wrote: Also, despite reassurances to the contrary, I still get the impression that there is a strong anti-lambda sentiment among the Python in crowd. Is it just a question of the word lambda, as opposed to perceived cleaner syntax?

Re: Duplicating list of lists [newbie]

2008-03-23 Thread bearophileHUGS
Yatsek: Is there simple way to copy a into b (like a[:]) with all copies of all objects going as deep as possible? If you only want to copy up to level-2, then you can do something like: cloned = [subl[:] for subl in somelist] Or sometimes safer: cloned = [list(subl) for subl in somelist] If

Re: pydoc

2008-03-23 Thread Gabriel Genellina
En Sun, 23 Mar 2008 12:57:35 -0300, A Hutchison [EMAIL PROTECTED] escribió: Any known reasons why pydoc no longer works? It gets confused by many timezone changes that occur this month around the world; pydoc tries hard to please all kind of users and tracking those locale changes isn't

Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread George Sakkis
On Mar 23, 12:24 pm, [EMAIL PROTECTED] (Aahz) wrote: The problem with lambda is that too often it results in clutter (this is a strictly made-up example off the top of my head for illustrative purposes rather than any real code, but I've seen plenty of code similar at various times):

Re: Issues with XMLTreeBuilder in cElementTree and ElementTree

2008-03-23 Thread Stefan Behnel
Michael Becker wrote: Secondly, I found a potential issue with the cElementTree module. My understanding (which could be incorrect) of python C modules is that they should work the same as the python versions but be more efficient. The XMLTreeBuilder class in cElementTree doesn't seem to be

Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Steven D'Aprano
On Sun, 23 Mar 2008 09:24:35 -0700, Aahz wrote: The problem with lambda is that too often it results in clutter (this is a strictly made-up example off the top of my head for illustrative purposes rather than any real code, but I've seen plenty of code similar at various times):

Re: dividing tuple elements with an int or float

2008-03-23 Thread Lie
On Mar 20, 1:06 pm, royG [EMAIL PROTECTED] wrote: hi i am trying to resize some images.First i'd read the size as a 2 tuple  and then i want to divide it by 2 or 4 or 2.5 etc.. suppose origsz=(400,300) i want to divide the origsize by 2.5 so i can resize to (160,120) There are several ways

Re: dividing tuple elements with an int or float

2008-03-23 Thread Lie
On Mar 22, 2:23 pm, [EMAIL PROTECTED] wrote: Sane programmers don't write such semi-functional things (unless it helps expressing the problem in certain domains). I now think that deprecating map, lambda Co. was a good thing after all. If you write it that way the first time, you need

Re: Is this doable

2008-03-23 Thread Lie
On Mar 22, 1:11 am, MRAB [EMAIL PROTECTED] wrote: On Mar 21, 11:48 am, fkallgren [EMAIL PROTECTED] wrote: Hi. I have a little problem. I have a script that is in the scheduler (win32). But every now and then I update this script and I dont want to go to every computer and update it. So now

Re: Testing for an empty dictionary in Python

2008-03-23 Thread Paul Rubin
John Nagle [EMAIL PROTECTED] writes: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : I like to think len(dict) is constant time but I haven't checked the code. Same for bool(dict) (which is what you get when you run if dict: ...). --

Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Roy Smith
Also, despite reassurances to the contrary, I still get the impression that there is a strong anti-lambda sentiment among the Python in crowd. Is it just a question of the word lambda, as opposed to perceived cleaner syntax? There is a fundamental disharmony in how functions and other

Re: Testing for an empty dictionary in Python

2008-03-23 Thread Paddy
On Mar 23, 4:14 pm, Paddy [EMAIL PROTECTED] wrote: On Mar 23, 3:53 pm, John Nagle [EMAIL PROTECTED] wrote: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : is expensive for large dictionaries, and makes loops O(N^2).

A roadmap for ctypes wrapping?

2008-03-23 Thread Alaric Haag
Hi all, I'm undertaking a pretty significant wrapping project (a linux shared-object lib) early in my Python experience, and thought it might be useful for many more that just myself if this thread were to produce a sort of roadmap for approaching wrapping with ctypes. I've been doing some

Re: A roadmap for ctypes wrapping?

2008-03-23 Thread Diez B. Roggisch
Alaric Haag schrieb: Hi all, I'm undertaking a pretty significant wrapping project (a linux shared-object lib) early in my Python experience, and thought it might be useful for many more that just myself if this thread were to produce a sort of roadmap for approaching wrapping with

Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Fuzzyman
On Mar 23, 4:24 pm, [EMAIL PROTECTED] (Aahz) wrote: In article [EMAIL PROTECTED], Jeff Schwab [EMAIL PROTECTED] wrote: Also, despite reassurances to the contrary, I still get the impression that there is a strong anti-lambda sentiment among the Python in crowd. Is it just a question of

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Fuzzyman
On Mar 22, 6:40 pm, Jeff Schwab [EMAIL PROTECTED] wrote: jmDesktop wrote: For students 9th - 12th grade, with at least Algebra I. Do you think Python is a good first programming language for someone with zero programming experience? Using Linux and Python for first exposure to

Re: Testing for an empty dictionary in Python

2008-03-23 Thread John Nagle
Brian Lane wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John Nagle wrote: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys()) : is expensive for large dictionaries, and makes loops O(N^2). John

Re: Testing for an empty dictionary in Python

2008-03-23 Thread Arnaud Delobelle
On Mar 23, 5:45 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: John Nagle [EMAIL PROTECTED] writes:    What's the cheapest way to test for an empty dictionary in Python?    if len(dict.keys() 0) : I like to think len(dict) is constant time but I haven't checked the code. Same for

writing a message to the terminal in a daemon process

2008-03-23 Thread bharath venkatesh
hi, i created a daemon process using the following code import os import sys # Default daemon parameters. # File mode creation mask of the daemon. UMASK = 0 # Default working directory for the daemon. WORKDIR = / # Default maximum for the number of available file descriptors. MAXFD =

Re: Removal of tkinter from python 3.0? [was: Fate of the repr module in Py3.0]

2008-03-23 Thread Martin v. Löwis
Guilherme Polo wrote: 2008/3/21, Martin v. Löwis [EMAIL PROTECTED]: I've been thinking of volunteering to port Tkinter to Python 3.0, I hadn't noticed that there was any discussion of removing it. It would be a shame IMHO. I don't think Tkinter will be removed. It works just fine in

Re: Pyparsing help

2008-03-23 Thread rh0dium
On Mar 23, 12:26 am, Paul McGuire [EMAIL PROTECTED] wrote: There are a couple of bugs in our program so far. First of all, our grammar isn't parsing the METAL2 entry at all.  We should change this line:     md = mainDict.parseString(test1) to     md =

Problems with joining Unicode strings

2008-03-23 Thread Ulysse
Hello, I have problems with joining strings. My program get web page fragments, then joins them into one single web page. I have error when I try to join these fregments : UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 208: ordinal not in range(128) Here is my code : #

Re: Pyparsing help

2008-03-23 Thread rh0dium
On Mar 23, 1:48 pm, rh0dium [EMAIL PROTECTED] wrote: On Mar 23, 12:26 am, Paul McGuire [EMAIL PROTECTED] wrote: There are a couple of bugs in our program so far. First of all, our grammar isn't parsing the METAL2 entry at all.  We should change this line:     md =

Re: Need help calling a proprietary C DLL from Python

2008-03-23 Thread Craig
On Mar 23, 4:48 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Sat, 22 Mar 2008 19:05:31 -0700 (PDT), Craig [EMAIL PROTECTED] declaimed the following in comp.lang.python: I got back exactly what I expected for TypeDef, but SecKey and PriKey were what I initialized them to , not what

Clone Digger: the tool for finding software clones; GSoC 2008

2008-03-23 Thread Peter Bulychev
Hello. I am glad to present you Clone Digger, the tool for finding software clones in Python programs, The presence of clones can greatly increase the software maintenance cost. For instance, every error in the original have to be fixed in all copies. Therefore I hope that Clone Digger will be

Issue with select.select() and missing data

2008-03-23 Thread nnp
Hi guys, I have an issue when using select.select(). I have an application that creates sockets then sends data on them. These sockets are then passed off to a listener which uses select.select() to detect any responses. For some reason every socket can only receive one response before my

Re: Why I hate lambdas (Re: Do any of you recommend Python as a firstprogramming language?)

2008-03-23 Thread Terry Reedy
Roy Smith [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | There is a fundamental disharmony in how functions and other objects are | treated in Python. [snip] For scalars and collections, print object prints the value, which is the main part of the object, in a form close to (or

On copying arrays

2008-03-23 Thread ernesto . adorio
Is there a conceptual difference between best =test[:] and best = [x for x in test] ? test is a list of real numbers. Had to use the second form to avoid a nasty bug in a program I am writing. I have to add too that I was using psyco in Python 2.5.1. Regards, Ernie. --

Re: Testing for an empty dictionary in Python

2008-03-23 Thread John Machin
On Mar 24, 2:53 am, John Nagle [EMAIL PROTECTED] wrote: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : TypeError: object of type 'bool' has no len() I presume you meant if len(dict.keys()) 0: is expensive for large dictionaries,

Re: Problems with joining Unicode strings

2008-03-23 Thread John Machin
On Mar 24, 7:58 am, Ulysse [EMAIL PROTECTED] wrote: Hello, I have problems with joining strings. My program get web page fragments, then joins them into one single web page. I have error when I try to join these fregments : UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in

Re: pydoc

2008-03-23 Thread John Machin
On Mar 24, 3:31 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Sun, 23 Mar 2008 12:57:35 -0300, A Hutchison [EMAIL PROTECTED] escribió: Any known reasons why pydoc no longer works? It gets confused by many timezone changes that occur this month around the world; pydoc tries hard to

Open Web Vancouver 2008: A Conference on Open Web Technologies

2008-03-23 Thread Mike Cantelon
When: Monday April 14 - Tuesday April 15th 2008 Where: Vancouver Convention Exhibition Centre (VCEC), 999 Canada Place. What: A conference showcasing open source technologies, communities and culture. We are featuring talks from all areas of open source technologies such as PHP, Python, Ruby on

Re: List question

2008-03-23 Thread John Machin
On Mar 24, 12:19 am, Dustan [EMAIL PROTECTED] wrote: On Mar 21, 3:57 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: if 'one' and 'two' in f: alist.append(f) Use: if 'one' in f and 'two' in f: ... Personally, I would put parentheses

PyTuple_Check and other type check functions didn't check the NULL pointer

2008-03-23 Thread NotGuru
I was writing some C extensions for Python and use PyTupleType_Check extensively. I found that all the PySomeType_Check macros directly delegate the job to PyObject_TypeCheck(op, PyType_Type). The PyObject_TypeCheck(op, PyType_Type) is again a macro and defined as ((ob)-ob_type == (tp) ||

Re: PyTuple_Check and other type check functions didn't check the NULL pointer

2008-03-23 Thread John Machin
On Mar 24, 10:01 am, NotGuru [EMAIL PROTECTED] wrote: I was writing some C extensions for Python and use PyTupleType_Check extensively. I found that all the PySomeType_Check macros directly delegate the job to PyObject_TypeCheck(op, PyType_Type). The PyObject_TypeCheck(op, PyType_Type) is

always getting 'None' return value from PyObject_CallObject

2008-03-23 Thread Gal Aviel
Hello all, Kinda desperate over here .. Any help would be greatly appreciated ! I'm trying to embed a Python interpreter inside a Verilog simulator as a SystemVerilog DPI application. The python side implements a few SV exported tasks. I've got a thin C shared library as the dpi app; all it does

Does python hate cathy?

2008-03-23 Thread QS
Hi to all! I am new to python, and I encountered a weird problem. Here is my code ##8 #!/usr/bin/python # Filename: objvar.py class Person: '''Represents a person.''' population = 0 #sex = 'F' #age = 22 # It is vague here: is this variable going

Re: always getting 'None' return value from PyObject_CallObject

2008-03-23 Thread Carsten Haese
On Sun, 2008-03-23 at 23:43 +, Gal Aviel wrote: [...] When calling a function defined in my module, the function executes Ok How do you know that? - it sees the correct arguments being passed from C How do you know that? , and executes 100% How do you know that? - only the return

Re: parsing json output

2008-03-23 Thread Gowri
Hi Tim, I'm able to get and print correctly some HTML content. I don't know how to fix this. Need all the help I can get with this :) Regards, Gowri -- http://mail.python.org/mailman/listinfo/python-list

Re: always getting 'None' return value from PyObject_CallObject

2008-03-23 Thread John Machin
On Mar 24, 10:43 am, Gal Aviel [EMAIL PROTECTED] wrote: Hello all, Kinda desperate over here .. Any help would be greatly appreciated ! I'm trying to embed a Python interpreter inside a Verilog simulator as a SystemVerilog DPI application. The python side implements a few SV exported tasks.

Re: Testing for an empty dictionary in Python

2008-03-23 Thread Steven D'Aprano
On Sun, 23 Mar 2008 10:45:38 -0700, Paul Rubin wrote: John Nagle [EMAIL PROTECTED] writes: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : I like to think len(dict) is constant time but I haven't checked the code. Same for bool(dict)

Re: List question

2008-03-23 Thread Steven D'Aprano
On Sun, 23 Mar 2008 15:55:43 -0700, John Machin wrote: On Mar 24, 12:19 am, Dustan [EMAIL PROTECTED] wrote: On Mar 21, 3:57 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: if 'one' and 'two' in f: alist.append(f) Use: if 'one' in f and

Re: Does python hate cathy?

2008-03-23 Thread George Sakkis
On Mar 23, 8:01 pm, QS [EMAIL PROTECTED] wrote: Hi to all! I am new to python, and I encountered a weird problem. Here is my code ##8 #!/usr/bin/python # Filename: objvar.py class Person: '''Represents a person.''' population = 0 #sex = 'F'

TUTORIALS ON COMPUTER PROGRAMMING

2008-03-23 Thread Santhosh1992
languages Have the complete details regarding programming languages. A-Z about programming languages like Java J2EE, C++, code implementation guides and more. http://operatingsys.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Does python hate cathy?

2008-03-23 Thread John Machin
On Mar 24, 11:42 am, George Sakkis [EMAIL PROTECTED] wrote: On Mar 23, 8:01 pm, QS [EMAIL PROTECTED] wrote: Hi to all! I am new to python, and I encountered a weird problem. Here is my code ##8 #!/usr/bin/python # Filename: objvar.py class Person:

Re: Does python hate cathy?

2008-03-23 Thread Carsten Haese
On Sun, 2008-03-23 at 17:42 -0700, George Sakkis wrote: That's really weird... it's reproducible on Windows too. It doesn't make any sense why the name of the variable would make a difference. My guess is you hit some kind of obscure bug. This is not a bug, just an unexpected feature:

Re: Does python hate cathy?

2008-03-23 Thread Michael Wieher
I changed the last few lines to read: 37 kalam.howMany() 38 c = Person('Catherine', 'F') 39 #cathy.sayHi() 40 #cathy.howMany() 41 #swaroop.sayHi() 42 #swaroop.howMany() 43 And I don't get the error. However if I change line 38 to read ca = Person('Catherine','F') It again initializes

Re: Does python hate cathy?

2008-03-23 Thread Michael Wieher
is that farnarkeling about in a __del__ method is *not* a good idea. Ok that having been said, is accessing an unbound variable of a class and using it to coordinate between instances of that class common practice? -- http://mail.python.org/mailman/listinfo/python-list

Re: Does python hate cathy?

2008-03-23 Thread Tim Chase
When I run this script, I got the following exception: Exception exceptions.AttributeError: 'NoneType' object has no attribute 'population' in bound method Person.__del__ of __main__.Person instance at 0xb7d8ac6c ignored To to newcomer like me, this message doesn't make much sense. What

Re: Does python hate cathy?

2008-03-23 Thread QS
Thanks to you all! It's good to know... On Mar 23, 9:02 pm, Carsten Haese [EMAIL PROTECTED] wrote: On Sun, 2008-03-23 at 17:42 -0700, George Sakkis wrote: That's really weird... it's reproducible on Windows too. It doesn't make any sense why the name of the variable would make a difference.

Re: Does python hate cathy?

2008-03-23 Thread Carsten Haese
On Sun, 2008-03-23 at 20:05 -0500, Michael Wieher wrote: is that farnarkeling about in a __del__ method is *not* a good idea. Ok that having been said, is accessing an unbound variable of a class and using it to coordinate between instances of that class common practice?

Re: PyTuple_Check and other type check functions didn't check the NULL pointer

2008-03-23 Thread Christian Heimes
NotGuru schrieb: My questions is: is it necessary to check the null pointer in the macro or it's a job for the user? Semantically all the type check should report a false if a null pointer is encountered. I've already had the patch to this issue but I am not sure if I think this problem

Re: Does python hate cathy?

2008-03-23 Thread Carsten Haese
On Mon, 2008-03-24 at 02:18 +0100, I wrote the barely intelligible phrase: I'm not sure what you mean by accessing an unbound variable means in the context of this thread I'm starting to sound like castironpi. Time to go to sleep. -- Carsten Haese http://informixdb.sourceforge.net --

Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Steven D'Aprano
On Sun, 23 Mar 2008 13:51:34 -0400, Roy Smith wrote: On the other hand, when I do: def torture(): woman.putInChair() cushion.poke() rack.turn() I've also done two things. First, I've created a function object (i.e. a lambda body), and I've also bound the name torture to

PyCon FR - Journées Python

2008-03-23 Thread Christophe Combelles
PyCon FR will take place in Paris, France, 17-18 May 2008. The French Python Association (AFPY) is organizing this event called Journées Python for the second time. We expect most talks to be in french, but any proposal in english is also greatly welcome! You may submit your idea of talks and

python + olap

2008-03-23 Thread hberig
Hi, I'm looking for python olap applications or frameworks, integrable to a web server application (like turbo gears or other) or some gui (like qt, wxwidgets or other). Any suggestion?? Thanks in advance!! -- http://mail.python.org/mailman/listinfo/python-list

Re: On copying arrays

2008-03-23 Thread bearophileHUGS
ernesto: best = list(test) may be faster than: best = [x for x in test] Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Does python hate cathy?

2008-03-23 Thread George Sakkis
On Mar 23, 9:02 pm, Carsten Haese [EMAIL PROTECTED] wrote: On Sun, 2008-03-23 at 17:42 -0700, George Sakkis wrote: That's really weird... it's reproducible on Windows too. It doesn't make any sense why the name of the variable would make a difference. My guess is you hit some kind of

PyCon FR - Journées Python

2008-03-23 Thread Christophe Combelles
PyCon FR will take place in Paris, France, 17-18 May 2008. The French Python Association (AFPY) is organizing this event called Journées Python for the second time. We expect most talks to be in french, but any proposal in english is also greatly welcome! You may submit your idea of talks and

Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Kay Schluehr
On 23 Mrz., 09:31, Arnaud Delobelle [EMAIL PROTECTED] wrote: On Mar 23, 8:14 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Sat, 22 Mar 2008 23:15:00 -0700, John Nagle wrote: That's some professor inventing his very own variation on predicate calculus and writing a

Re: Does python hate cathy?

2008-03-23 Thread Ken
Yup, I think Carsten got it. Mystery solved! You could replace Person with self.__class__ instead of type(self) if Person is an old-style class (since the class won't be collected until after all the instances are collected (because each instance references it's class)). Note that when the

Re: Testing for an empty dictionary in Python

2008-03-23 Thread John Machin
On Mar 24, 11:32 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Sun, 23 Mar 2008 10:45:38 -0700, Paul Rubin wrote: John Nagle [EMAIL PROTECTED] writes: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : I like to

Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Roy Smith
Steven D'Aprano [EMAIL PROTECTED] wrote: On Sun, 23 Mar 2008 13:51:34 -0400, Roy Smith wrote: On the other hand, when I do: def torture(): woman.putInChair() cushion.poke() rack.turn() I've also done two things. First, I've created a function object (i.e. a

Re: Testing for an empty dictionary in Python

2008-03-23 Thread Steven D'Aprano
On Sun, 23 Mar 2008 18:56:51 -0700, John Machin wrote: Python knows the truth value of built-in types like dicts without actually converting them to bools, or for that matter calling __len__ or __nonzero__ on them. What the 2.5.1 interpreter does is call PyObject_IsTrue, which checks to

Re: Testing for an empty dictionary in Python

2008-03-23 Thread Bryan Olson
D'Arcy J.M. Cain wrote: John Nagle wrote: What's the cheapest way to test for an empty dictionary in Python? Try this: if dict: D'Arcy is right; that's the way to go. I'll add that 'dict' is the name of the built-in class, so an instance is usually best named something else. --

Re: PyCon video editing

2008-03-23 Thread Atom
On Mar 18, 8:09 am, amk [EMAIL PROTECTED] wrote: On Mar 17, 10:00 pm, dundeemt [EMAIL PROTECTED] wrote: Anyone know who is in charge of this? I'd like to help out if I could. I am, but haven't set anything up yet, such as a mailing list or a host for the video. I'll update the wiki

Re: PyTuple_Check and other type check functions didn't check the NULL pointer

2008-03-23 Thread NotGuru
On Mar 23, 8:24 pm, Christian Heimes [EMAIL PROTECTED] wrote: NotGuru schrieb: My questions is: is it necessary to check the null pointer in the macro or it's a job for the user? Semantically all the type check should report a false if a null pointer is encountered. I've already had the

Re: always getting 'None' return value from PyObject_CallObject

2008-03-23 Thread NotGuru
On Mar 23, 6:43 pm, Gal Aviel [EMAIL PROTECTED] wrote: Hello all, Kinda desperate over here .. Any help would be greatly appreciated ! I'm trying to embed a Python interpreter inside a Verilog simulator as a SystemVerilog DPI application. The python side implements a few SV exported tasks.

Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Steven D'Aprano
On Sun, 23 Mar 2008 22:36:35 -0400, Roy Smith wrote: I've also done two things. First, I've created a function object (i.e. a lambda body), and I've also bound the name torture to that function object, in much the same way I did with the list. But, it's different. The function object

xml.sax problem

2008-03-23 Thread Timothy Wu
Hi, I have created a very, very simple parser for an XML. class FindGoXML2(ContentHandler): def characters(self, content): print content I have made it simple because I want to debug. This prints out any content enclosed by tags (right?). The XML is publicly available here:

encoding/decoding issue with python2.5 and pymssql

2008-03-23 Thread Tzury Bar Yochay
hi, in my table the field row_id is type of uniqueidentifier. when try to fetch the data, pymssql somehow, encodes the values in a way which yields odd results. for example: the value 'EE604EE3-4AB0-4EE7-AF4D-018124393CD7' is represent as '\xe3N`\xee\xb0J\xe7N\xafM\x01\x81$9\xd7' the only way

Re: Testing for an empty dictionary in Python - documented?

2008-03-23 Thread John Nagle
Bryan Olson wrote: D'Arcy J.M. Cain wrote: John Nagle wrote: What's the cheapest way to test for an empty dictionary in Python? Try this: if dict: D'Arcy is right; that's the way to go. I'll add that 'dict' is the name of the built-in class, so an instance is usually best

[issue1691411] Duplicate preferences menu item/Tk Aqua 8.4.14

2008-03-23 Thread Georg Brandl
Changes by Georg Brandl [EMAIL PROTECTED]: -- resolution: - fixed status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1691411 _ ___

  1   2   >