ANN: cssutils 0.9.4b1

2007-12-29 Thread Christof Hoeke
what is it -- A Python package to parse and build CSS Cascading Style Sheets. main changes since 0.9.4a4 -- for full details for 0.9.4b1 see the relevant CHANGELOG: http://cssutils.googlecode.com/svn/tags/TAG_0.9.4b1/CHANGELOG.txt 0.9.4b1 - **FEATURE**:

Re: sqlobject issue/question...

2007-12-29 Thread DarkBlue
On Dec 29, 12:27 pm, bruce [EMAIL PROTECTED] wrote: hi i'm playing around, researching sqlobject, and i notice that it appears to require the use of id in each tbl it handles in the database. if i already have a db schema, and it doesn't use 'id' as an auto-generated field, does that

Re: Pivot Table/Groupby/Sum question

2007-12-29 Thread John Machin
On Dec 29, 11:51 am, [EMAIL PROTECTED] wrote: John would you mind walking me through your class in normal speak? Yes. I only have a vague idea of why it works and this would help me a lot to get a grip on classes and this sort of particular problem. It's about time you got a *concrete*

Re: Cheat sheet

2007-12-29 Thread Riccardo T.
Alaric ha scritto: Nicely done! I would suggest you put your website address on it and a revision number so that as it gains use on te web, people can find the latest version. That's a good idea, thank you :) -- GreyFox -- http://mail.python.org/mailman/listinfo/python-list

Re: Cheat sheet

2007-12-29 Thread ZeD
Michele Simionato wrote: Python 2.4.4 (#2, Oct 4 2007, 22:02:31) file is open True Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) file is open False Nowadays file is no more an alias for open. curious... maybe it's me, but I can't find a What's New in Python where this is said...

Re: Cheat sheet

2007-12-29 Thread Riccardo T.
Scott David Daniels ha scritto: Riccardo T. wrote: Maybe I'll add __builtin__ and os in place of the type hierarchy, but I'm not sure about that. However, not in the next release. What do you think about? How about: top line w/ __builtin__, os, os.path (and no contents -- inspire further

Re: Cheat sheet

2007-12-29 Thread Riccardo T.
ZeD ha scritto: Michele Simionato wrote: Python 2.4.4 (#2, Oct 4 2007, 22:02:31) file is open True Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) file is open False Nowadays file is no more an alias for open. curious... maybe it's me, but I can't find a What's New in Python where

Re: Choosing a new language

2007-12-29 Thread Joachim Durchholz
George Neuner schrieb: I know not everyone works in RT, but I can't possibly be alone in developing applications that are hard to restart effectively. Indeed. An additional case is interactive applications where setting up the situation to be tested requires several time-consuming steps.

joining rows

2007-12-29 Thread Beema shafreen
hi every body, I have two columns in a file separted by tabs If the column1 is common in the row1 and row2 then it should be column 2 should be displayed in the single line. eg: col 1 col2 A1 A2 A3 B1 C 2 D 3

Re: Choosing a new language

2007-12-29 Thread Paul Rubin
Joachim Durchholz [EMAIL PROTECTED] writes: Indeed. An additional case is interactive applications where setting up the situation to be tested requires several time-consuming steps. At least for web development, there are a lot of automated tools that mimic user input, just for this purpose. --

Re: OOP: How to implement listing al 'Employees'.

2007-12-29 Thread Petar
On 28 dec, 19:42, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Fri, 28 Dec 2007 04:05:59 -0800 (PST), Petar [EMAIL PROTECTED] declaimed the following in comp.lang.python: I was just wondering. What if you have a 'Employees' class and you want to list all the employees. Currenlty i'm

Professional Grant Proposal Writing Workshop (January 2008: Portland State University)

2007-12-29 Thread Anthony Jones
The Grant Institute's Grants 101: Professional Grant Proposal Writing Workshop will be heldat Portland State University, January 22 -24, 2008. Interested development professionals, researchers, faculty, and graduate students should register as soon as possible, as demand means that seats will

Re: Python DLL in Windows Folder

2007-12-29 Thread Michael Doppler
On 27 Dez., 05:49, Tim Roberts [EMAIL PROTECTED] wrote: It's true that mallocing in one CRT DLL and freeing in another can cause problems, but in Python, I don't think that can happen.  Proper Python add-ins call Python APIs to create and destroy objects, so only the Python runtime will manage

Re: OOP: How to implement listing al 'Employees'.

2007-12-29 Thread Marc 'BlackJack' Rintsch
On Sat, 29 Dec 2007 01:53:38 -0800, Petar wrote: The post of Dennis made me realize of another solution though. To create another class called Articles which return multiple articles. The only problem I forsee with this that's it's gonna be a very empty class. Then maybe it should not be a

Re: Python DLL in Windows Folder

2007-12-29 Thread Martin v. Löwis
There is at least one actual problem I came across in an application linked with MSVCR 8.0, loading the Python DLL linked against MSVCR 7.1. When running a Python file using one of the PyRun_File[1] functions, the passed file handle has to be created from the embedding application. This

Re: joining rows

2007-12-29 Thread km
Hi On Dec 29, 2007 3:08 PM, Beema shafreen [EMAIL PROTECTED] wrote: hi every body, I have two columns in a file separted by tabs If the column1 is common in the row1 and row2 then it should be column 2 should be displayed in the single line. eg: col 1 col2 A1

Re: getting n items at a time from a generator

2007-12-29 Thread Neil Cerutti
On Dec 29, 2007 2:18 AM, Tim Roberts [EMAIL PROTECTED] wrote: Kugutsumen [EMAIL PROTECTED] wrote: I am relatively new the python language and I am afraid to be missing some clever construct or built-in way equivalent to my 'chunk' generator below. I have to say that I have found this to

difference between `x in list` and `list.index(x)` for instances of a new-style class

2007-12-29 Thread Riccardo Murri
Hello, I have some code that stops when trying to find a graph in a list of similar graphs:: (Pydb) list 110try: 111canonical = self.base[self.base.index(graph)] 112except ValueError: 113raise ValueError, \ 114 Cannot find canonical

Re: sqlobject issue/question...

2007-12-29 Thread Diez B. Roggisch
bruce schrieb: hi i'm playing around, researching sqlobject, and i notice that it appears to require the use of id in each tbl it handles in the database. if i already have a db schema, and it doesn't use 'id' as an auto-generated field, does that mean that i can't use/implement

Brussels Python Interest/Users Group

2007-12-29 Thread seb
Hi Pythonistas, Is anyone interested in forming a Brussels(Belgium) area Python User Group ? I am not aware of any python focused group in this area. Language could be whatever fits the bill (English/French/Dutch/...) Focus would be python, ironpython/silverlight, scipy, ORMs, web frameworks,

Re: Choosing a new language

2007-12-29 Thread Stephen Leake
George Neuner gneuner2/@/comcast.net writes: On Fri, 28 Dec 2007 12:54:57 -0800, John Nagle [EMAIL PROTECTED] wrote: Actually, the ability to fix a running program [in Lisp] isn't that useful in real life. It's more cool than useful. Editing a program from a break was more important

Re: Pivot Table/Groupby/Sum question

2007-12-29 Thread petr . jakes . tpc
Patrick, in your first posting you are writing ... I'm trying to learn how to make pivot tables from some excel sheets Can you be more specific please? AFIK Excel offers very good support for pivot tables. So why to read tabular data from the Excel sheet and than transform it to pivot tabel

Re: Remove namespace declaration from ElementTree in lxml

2007-12-29 Thread Stefan Behnel
Zero Piraeus wrote: You can try this: root = etree.parse(...).getroot() new_root = etree.Element(root.tag, root.attrib) new_root[:] = root[:] Note, however, that this will not copy root-level PIs or internal DTD subsets. But you can copy PIs and comments by hand. Thanks. I

Re: sqlobject issue/question...

2007-12-29 Thread Istvan Albert
On Dec 28, 11:27 pm, bruce [EMAIL PROTECTED] wrote: i'm playing around, researching sqlobject, and i notice that it appears to require the use of id in each tbl it handles in the database. is there a way to overide this function/behavior... there better be such way. An ORM that does not

Re: difference between `x in list` and `list.index(x)` for instances of a new-style class

2007-12-29 Thread bpgbaires
On 28 dic, 20:12, Riccardo Murri [EMAIL PROTECTED] wrote: The list `self.base` contains canonical forms of the graphs and the `graph` object must compare equal to some item of the list, which indeed it does::   (Pydb) p graph == self.base[27]     True   (Pydb) p graph in self.base   True

Re: Choosing a new language

2007-12-29 Thread Achim Schneider
Rico Secada [EMAIL PROTECTED] wrote: Second, I need some advice. http://www.nondot.org/sabre/Mirrored/AdvProgLangDesign/ Learn, or better said understand, those and then choose wisely. Lisp throws lambda calculus right into your face, which is a good thing. Scheme might be the better

Re: joining rows

2007-12-29 Thread Tim Chase
A1 A2 A3 B1 C 2 D 3 D 4 The result should be A1|2|3 B1 C2 D3|4 What should I do to get my results Well, it depends on whether the resulting order matters. If not, you can use

Re: Tab indentions on different platforms?

2007-12-29 Thread Thorsten Kampe
* xkenneth (Fri, 28 Dec 2007 14:51:04 -0800 (PST)) I seem to be having problems with running my python code, written on a Mac, on Linux and Windows boxes. You seem to have problems or you do have problems? It seems like the problem has to do with tab indention, Why does it seem and what does

do i need to create new rgbimage class

2007-12-29 Thread jimgardener
hi am a beginner in python and PIL .I need to read an RGB 8 bit image (am using jpeg )and pack the rgb color values into a double value so i can store the image as a list of pixelvalues.From my application i should be able to call rgbimage1.getpixellist() to retrieve the double values of an

Re: i18n questions

2007-12-29 Thread Thorsten Kampe
* Donn Ingle (Fri, 28 Dec 2007 20:01:48 +0200) I'm 100% new to this i18n lark and my approach so far has been to create a .mo file per module in my app. My thinking was, why load one huge .mo file when a single module only needs a few strings? Since then, it seems, I have made the wrong

Howto on callbacks, queues and good design patterns

2007-12-29 Thread Michael Bernhard Arp Sørensen
Hi there. As a newbie, I need to learn about callbacks and queues(syntax and examples) working together. At work we talk a lot about design patterns. Does any of you know a good site about that or any good books from Amazon? I started using python at work in the summer 2007. I think I know

Re: Pivot Table/Groupby/Sum question

2007-12-29 Thread patrick . waldo
On Dec 29, 3:00 pm, [EMAIL PROTECTED] wrote: Patrick, in your first posting you are writing ... I'm trying to learn how to make pivot tables from some excel sheets Can you be more specific please? AFIK Excel offers very good support for pivot tables. So why to read tabular data from the

Re: i18n questions

2007-12-29 Thread Donn Ingle
Thorsten Kampe wrote: gettext.textdomain('optparse') gettext.install('script', unicode = True) They speak of a 'global' domain in the docs, but (as is my usual beef with the Python docs -- see PHP docs for sterling help) there is no clarity. It *sounds* like there can be a .mo file for

Re: Pivot Table/Groupby/Sum question

2007-12-29 Thread petr . jakes . tpc
Yes, I realize Excel has excellent support for pivot tables. However, I hate how Excel does it and, for my particular excel files, I need them to be formated in an automated way because I will have a number of them over time and I'd prefer just to have python do it in a flash than to do it

Optional code segment delimiter?

2007-12-29 Thread xkenneth
Is it possible to use optional delimiters other than tab and colons? For example: if this==1 { print this } And is there an alternate delimiter for statements other than the newline? print this;print that; #for example I know I'll probably get yelled at for this question,

Re: Optional code segment delimiter?

2007-12-29 Thread Marc 'BlackJack' Rintsch
On Sat, 29 Dec 2007 09:20:00 -0800, xkenneth wrote: Is it possible to use optional delimiters other than tab and colons? No. And is there an alternate delimiter for statements other than the newline? print this;print that; #for example Yes. But both are reasons to yell at you. ;-)

Bizarre behavior with mutable default arguments

2007-12-29 Thread bukzor
I've found some bizzare behavior when using mutable values (lists, dicts, etc) as the default argument of a function. I want to get the community's feedback on this. It's easiest to explain with code. This example is trivial and has design issues, but it demonstrates a problem I've seen in

Re: joining rows

2007-12-29 Thread Istvan Albert
On Dec 29, 10:22 am, Tim Chase [EMAIL PROTECTED] wrote: If, however, order matters, you have to do it in a slightly buffered manner. Can be reduced to a sed one-liner I think the original version works just as well for both cases. Your sed version however does need the order you mention.

Mix different C source files into a single one

2007-12-29 Thread Horacius ReX
Hi, I have a C program split into different source files. I am trying a new compiler and for some reason it only accepts a single source file. So I need to mix all my different C source files into a single one. Do you know about some type of python script able to do this kind of task ? Thanks

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread Martin v. Löwis
Is this functionality intended? Google for Python mutable default arguments (you can actually leave out Python). It's part of the language semantics, yes. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: joining rows

2007-12-29 Thread Istvan Albert
on a second read ... I see that you mean the case that should only join consecutive lines with the same key -- http://mail.python.org/mailman/listinfo/python-list

Re: Choosing a new language

2007-12-29 Thread Joachim Durchholz
Paul Rubin schrieb: Joachim Durchholz [EMAIL PROTECTED] writes: Indeed. An additional case is interactive applications where setting up the situation to be tested requires several time-consuming steps. At least for web development, there are a lot of automated tools that mimic user input,

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread Istvan Albert
On Dec 29, 12:50 pm, bukzor [EMAIL PROTECTED] wrote: Is this functionality intended? It seems very unintuitive. This has caused a bug in my programs twice so far, and both times I was completely mystified until I!realized that the default value was changing. it is only unintuitive when you

Re: Howto on callbacks, queues and good design patterns

2007-12-29 Thread Martin v. Löwis
I started using python at work in the summer 2007. I think I know the stuff, but I need to expand my understanding of the more complex programming techniques. There are various materials on Python and design patterns; just google. I particularly recommend the talk by Alex Martelli. He gave

Re: Choosing a new language

2007-12-29 Thread John Thingstad
På Sat, 29 Dec 2007 19:16:09 +0100, skrev Joachim Durchholz [EMAIL PROTECTED]: However, for web applications, I found a far easier variant: I just reload the page being debugged. (I have to make sure that the backend is in the same state when reloading, but that's usually easy to

Re: Optional code segment delimiter?

2007-12-29 Thread Jason
On Dec 29, 10:20 am, xkenneth [EMAIL PROTECTED] wrote: Is it possible to use optional delimiters other than tab and colons? For example:      if this==1 {           print this      } Certainly, it's very possible. Here's how to do it: 1. Download the python source code (easy) 2.

Re: Choosing a new language

2007-12-29 Thread John Thingstad
På Sat, 29 Dec 2007 18:58:30 +0100, skrev Arnaud Delobelle [EMAIL PROTECTED]: On Dec 29, 3:11 pm, Achim Schneider [EMAIL PROTECTED] wrote: [...] Lisp throws lambda calculus right into your face, which is a good thing. Scheme might be the better choice, it's lexically

Re: Optional code segment delimiter?

2007-12-29 Thread Matt Nordhoff
xkenneth wrote: Is it possible to use optional delimiters other than tab and colons? For example: if this==1 { print this } http://timhatch.com/projects/pybraces/ Heheheh.. snip -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread Istvan Albert
On Dec 29, 1:11 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: Google for Python mutable default arguments and a mere 30 minutes later this thread is already one of the results that come up -- http://mail.python.org/mailman/listinfo/python-list

pdf library.

2007-12-29 Thread Shriphani
Hi, I am looking for a pdf library that will give me a list of pages where new chapters start. Can someone point me to such a module ? Regards, Shriphani P. -- http://mail.python.org/mailman/listinfo/python-list

Re: joining rows

2007-12-29 Thread Tim Chase
on a second read ... I see that you mean the case that should only join consecutive lines with the same key Yes...there are actually three cases that occur to me: 1) don't care about order, but want one row for each key (1st value) 2) do care about order, and don't want disjoint runs of

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread bukzor
Here's the answer to the question: http://www.python.org/doc/faq/general/#why-are-default-values-shared-between-objects It looks like Guido disagrees with me, so the discussion is closed. For the record, I still think the following would be an improvement to py3k: In python25: def f(a=None):

Re: Howto on callbacks, queues and good design patterns

2007-12-29 Thread Lorenzo Mainardi
Nel mezzo del cammin di nostra vita, mi ritrovai con Michael Bernhard Arp Sørensen che diceva: Hi there. As a newbie, I need to learn about callbacks and queues(syntax and examples) working together. At work we talk a lot about design patterns. Does any of you know a good site about

Re: getting n items at a time from a generator

2007-12-29 Thread Igor V. Rafienko
[ Terry Jones ] [ ... ] Also consider this solution from O'Reilly's Python Cookbook (2nd Ed.) p705 def chop(iterable, length=2): return izip(*(iter(iterable),) * length) Is this *always* guaranteed by the language to work? Should the iterator returned by izip() change the

Re: Mix different C source files into a single one

2007-12-29 Thread Michael L Torrie
Horacius ReX wrote: Hi, I have a C program split into different source files. I am trying a new compiler and for some reason it only accepts a single source file. So I need to mix all my different C source files into a single one. Do you know about some type of python script able to do

Re: getting n items at a time from a generator

2007-12-29 Thread Terry Jones
Hi Igor Igor == Igor V Rafienko [EMAIL PROTECTED] writes: Also consider this solution from O'Reilly's Python Cookbook (2nd Ed.) p705 def chop(iterable, length=2): return izip(*(iter(iterable),) * length) Igor Is this *always* guaranteed by the language to work? Should the Igor iterator

Re: getting n items at a time from a generator

2007-12-29 Thread Raymond Hettinger
    def chop(iterable, length=2):         return izip(*(iter(iterable),) * length) Is this *always* guaranteed by the language to work? Yes! Users requested this guarantee, and I agreed. The docs now explicitly guarantee this behavior. Raymond --

Re: getting n items at a time from a generator

2007-12-29 Thread Raymond Hettinger
Also consider this solution from O'Reilly's Python Cookbook (2nd Ed.) p705     def chop(iterable, length=2):         return izip(*(iter(iterable),) * length) However, chop ignores the remainder of the data in the example. There is a recipe in the itertools docs which handles the

Re: Optional code segment delimiter?

2007-12-29 Thread Dan Bishop
On Dec 29, 12:41 pm, Matt Nordhoff [EMAIL PROTECTED] wrote: xkenneth wrote: Is it possible to use optional delimiters other than tab and colons? For example: if this==1 { print this } http://timhatch.com/projects/pybraces/ Heheheh.. Wow! I never thought of

Re: Mix different C source files into a single one

2007-12-29 Thread John Machin
On Dec 30, 5:05 am, Horacius ReX [EMAIL PROTECTED] wrote: Hi, I have a C program split into different source files. I am trying a new compiler and for some reason it only accepts a single source file. The relevance of this question to this newsgroup is zero, but ... Smashing all of your

Re: pdf library.

2007-12-29 Thread Benjamin
On Dec 29, 12:54 pm, Shriphani [EMAIL PROTECTED] wrote: Hi, I am looking for a pdf library that will give me a list of pages where new chapters start. Can someone point me to such a module ? ReportLab (ReportLab) might help. Regards, Shriphani P. --

Re: Mix different C source files into a single one

2007-12-29 Thread Benjamin
On Dec 29, 12:05 pm, Horacius ReX [EMAIL PROTECTED] wrote: Hi, I have a C program split into different source files. I am trying a new compiler and for some reason it only accepts a single source file. So I need to mix all my different C source files into a single one. That sounds like one

Re: Mix different C source files into a single one

2007-12-29 Thread Grant Edwards
On 2007-12-29, Horacius ReX [EMAIL PROTECTED] wrote: I have a C program split into different source files. I am trying a new compiler and for some reason it only accepts a single source file. That's pretty much the way they all work. So I need to mix all my different C source files into a

Re: Choosing a new language

2007-12-29 Thread Samuel Tardieu
Brad == byte8bits [EMAIL PROTECTED] writes: Brad Best of luck in finding skilled, affordable Ada programmers Brad outside of major cities. Which is why it may be a good idea to learn it and earn a lot of $$$ :) -- http://mail.python.org/mailman/listinfo/python-list

Fate of itertools.dropwhile() and itertools.takewhile()

2007-12-29 Thread Raymond Hettinger
I'm considering deprecating these two functions and would like some feedback from the community or from people who have a background in functional programming. * I'm concerned that use cases for the two functions are uncommon and can obscure code rather than clarify it. * I originally added them

error on importing variable value

2007-12-29 Thread int32bit
I can't figure out why this doesn't work. Any ideas appreciated. conn = MySQLdb.connect (db = vocab) cursor = conn.cursor () cursor.execute (SELECT VERSION()) row = cursor.fetchone () print server version:, row[0] cursor.close () conn.close () gives: server version: 5.0.44-log but import

CGI, MySQL Python

2007-12-29 Thread CS
I'm new to programming and I'm trying to find some answers. I wrote a few python cgi scripts for my website all of which access a mysql db on 'localhost'. My question is, Is it a bad idea to have my username and password for my db coded in my script? Is there a better way to make sure that

Re: pdf library.

2007-12-29 Thread Waldemar Osuch
On Dec 29, 11:54 am, Shriphani [EMAIL PROTECTED] wrote: Hi, I am looking for a pdf library that will give me a list of pages where new chapters start. Can someone point me to such a module ? Regards, Shriphani P. pyPdf may help you with that: http://pybrary.net/pyPdf/ --

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread Steven D'Aprano
On Sat, 29 Dec 2007 11:14:30 -0800, bukzor wrote: In python25 (this function from the FAQ linked above): def f(a, _cache={}): # Callers will never provide a third parameter for this function. (then why is it an argument?) The caller might want to provide it's own pre-prepared cache.

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2007-12-29 Thread Istvan Albert
On Dec 29, 6:10 pm, Raymond Hettinger [EMAIL PROTECTED] wrote: These thoughts reflect my own experience with the itertools module. It may be that your experience with them has been different. Please let me know what you think. first off, the itertools module is amazing, thanks for creating

Re: Tab indentions on different platforms?

2007-12-29 Thread Steven D'Aprano
On Sat, 29 Dec 2007 15:29:25 +, Thorsten Kampe wrote: I'd personally go for spaces because: 1. I don't like things I cannot see (control characters) You can see spaces but not tabs? Your editor is pretty weird. In all the editors I've every used, both spaces and tabs show up as empty

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread Steven D'Aprano
On Sat, 29 Dec 2007 09:50:53 -0800, bukzor wrote: I've found some bizzare behavior when using mutable values (lists, dicts, etc) as the default argument of a function. This FAQ is so Frequently Asked that I sometimes wonder if Python should, by default, print a warning when it compiles a

sqlobject question...

2007-12-29 Thread bruce
hi... this continues my investigation of python/sqlobject, as it relates to the need to have an id, which is auto-generated. per various sites/docs on sqlobject, it appears that you can override the id, by doing something similar to the following: def foo(SQLObject): def _init(self, id,

Re: sqlobject question...

2007-12-29 Thread Matt Nordhoff
bruce wrote: hi... this continues my investigation of python/sqlobject, as it relates to the need to have an id, which is auto-generated. per various sites/docs on sqlobject, it appears that you can override the id, by doing something similar to the following: def foo(SQLObject):

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2007-12-29 Thread Steven D'Aprano
On Sat, 29 Dec 2007 15:10:24 -0800, Raymond Hettinger wrote: * Both functions seem simple and basic until you try to explain them to someone else. Oh I don't know about that. The doc strings seem to do an admirable job to me. Compared to groupby(), the functions are simplicity themselves.

Re: error on importing variable value

2007-12-29 Thread Gabriel Genellina
On 29 dic, 20:31, [EMAIL PROTECTED] wrote: I can't figure out why this doesn't work. Any ideas appreciated. conn = MySQLdb.connect (db = vocab) cursor = conn.cursor () cursor.execute (SELECT VERSION()) row = cursor.fetchone () print server version:, row[0] cursor.close () conn.close ()

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2007-12-29 Thread bearophileHUGS
Almost every day I write code that uses itertools, so I find it very useful, and its functions fast. Removing useless things and keeping things tidy is often positive. But I can't tell you what to remove. Here are my usages (every sub-list is sorted by inverted frequency usage): I use often or

Re: Choosing a new language

2007-12-29 Thread Rico Secada
On Sat, 29 Dec 2007 23:56:12 +0100 Samuel Tardieu [EMAIL PROTECTED] wrote: Brad == byte8bits [EMAIL PROTECTED] writes: Brad Best of luck in finding skilled, affordable Ada programmers Brad outside of major cities. Which is why it may be a good idea to learn it and earn a lot of $$ $ :)

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread bukzor
I think that this behaviour is a little unintuitive, and by a little I mean a lot. Thanks for acknowledging it. I question that it is much more common. How do you know? Where's your data? I did a dumb grep of my Python25/Lib folder and found 33 occurances of the first pattern above. (Use

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread bukzor
Just for completeness, the mutable default value problem also affects classes: class c: def __init__(self, list = []): self.list = list self.list.append(LIST END) def __repr__(self): return Class a: %s % self.list import example2 print example2.c() Class a:

Re: Tab indentions on different platforms?

2007-12-29 Thread Ben Finney
Steven D'Aprano [EMAIL PROTECTED] writes: On Sat, 29 Dec 2007 15:29:25 +, Thorsten Kampe wrote: I'd personally go for spaces because: 1. I don't like things I cannot see (control characters) You can see spaces but not tabs? Your editor is pretty weird. In all the editors I've

Re: Tab indentions on different platforms?

2007-12-29 Thread John Nagle
Thorsten Kampe wrote: * xkenneth (Fri, 28 Dec 2007 14:51:04 -0800 (PST)) I seem to be having problems with running my python code, written on a Mac, on Linux and Windows boxes. You seem to have problems or you do have problems? It seems like the problem has to do with tab indention,

Re: Tab indentions on different platforms?

2007-12-29 Thread John Machin
On Dec 30, 3:48 pm, John Nagle [EMAIL PROTECTED] wrote: Thorsten Kampe wrote: * xkenneth (Fri, 28 Dec 2007 14:51:04 -0800 (PST)) I seem to be having problems with running my python code, written on a Mac, on Linux and Windows boxes. You seem to have problems or you do have problems?

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2007-12-29 Thread Michele Simionato
On Dec 30, 12:10 am, Raymond Hettinger [EMAIL PROTECTED] wrote: I'm considering deprecating these two functions and would like some feedback from the community or from people who have a background in functional programming. I am with Steven D'Aprano when he says that takewhile and dropwhile

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread John Machin
On Dec 30, 3:21 pm, bukzor [EMAIL PROTECTED] wrote: Just for completeness, the mutable default value problem also affects classes: Simply, because methods are functions, and can have default arguments. You don't need to nail *another* zillion theses to the cathedral door :-) --

[issue1706] Force WINVER 0x0500 (Windows 2000)

2007-12-29 Thread Christian Heimes
Christian Heimes added the comment: The macros don't restrain us to Win2k but they prevent us from using APIs which are not compatible with Windows 2000. It's a compile time option to conditionally exclude new features from the header files. #ifndef NTDDI_VERSION #define NTDDI_VERSION

[issue1704] possible bug in randint

2007-12-29 Thread Rich Marinaccio
Rich Marinaccio added the comment: To be clear, I am not using multi-threading in my particular module. I can't explain this behavior with my code alone. The issue is complicated by the fact that my module is called by Civ IV, and I have no idea what the game is doing behind the scenes. I

[issue1704] possible bug in randint

2007-12-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Attaching the whole file isn't a step in the right direction. The preferred approach is to isolate the problem as tightly as possible. This report is dubious because, I can't get the following to fail: from random import seed, randint seed('mystart')

[issue1704] possible bug in randint

2007-12-29 Thread Rich Marinaccio
Rich Marinaccio added the comment: What was happening before was I was getting an index out of range error every so often, so then I put in the ValueError catch to see what was going on. I was surprised to see that randIndex was the same as len (preshuffle). I have some further catches in

[issue1706] Force WINVER 0x0500 (Windows 2000)

2007-12-29 Thread Martin v. Löwis
Martin v. Löwis added the comment: The macros don't restrain us to Win2k but they prevent us from using APIs which are not compatible with Windows 2000. --- That's what I meant by constrain/restrain: we can't use API that was added in XP directly. For functions, that is a good thing, because the

[issue1699] unconditional definiton of _BSD_SOURCE breaks builds with g++-4.3

2007-12-29 Thread Martin v. Löwis
Martin v. Löwis added the comment: I opted for conditionalizing it to OpenBSD; it was wrong on Linux, anyway, as _BSD_SOURCE has a different meaning there. Fixed in r59610 and r59611. -- resolution: - fixed status: open - closed __ Tracker [EMAIL

[issue1688] Incorrectly displayed non ascii characters in prompt using input() - Python 3.0a2

2007-12-29 Thread Vlastimil Brom
Vlastimil Brom added the comment: First sorry about a delayed response, but moreover, I fear, preparing a patch would be far beyond my programming competence; sorry about that. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1688