Re: Python docs disappointing

2009-07-31 Thread Ned Deily
In article , Terry Reedy wrote: > This is one area where Windows users seems to have an advantage. The > standard installer includes the doc set as a Windows help file. I often > keep that open in one window while programming in others. I only later > discovered that this was a copy of the onl

Re: Newbie Question regarding __init__()

2009-07-31 Thread Gabriel Genellina
En Sat, 01 Aug 2009 00:13:05 -0300, Nat Williams escribió: One other thing. I'm a little confused by the first line of dcObject.__init__: self.init_Pre() and self.init_Exec() I suspect this does not do what you think it does. init_Pre and init_Exec will both be called by this expression

Re: Confessions of a Python fanboy

2009-07-31 Thread Emmanuel Surleau
On Saturday 01 August 2009 03:46:12 Steven D'Aprano wrote: > On Fri, 31 Jul 2009 20:41:12 +0200, Emmanuel Surleau wrote: > >> We don't actually *declare* that something is constant and then have > >> that declaration ignored. Python doesn't lie to us, although (as in any > >> language) a programmer

Re: problem on socket programming

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 10:43:49 -0300, MalC0de escribió: none of you can't interpret it ? do you have errors like me !? Have you tried Diez B. Roggisch suggestion? : Can you ping and telnet to the port on the desired server? Firewalls can be an issue here. The official doc page for the soc

Re: os.path.exists() and Samba shares

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 13:33:45 -0300, BDZ escribió: On Jul 30, 4:41 pm, Loïc Domaigné wrote: > Hello. I have written a Python 3.1 script running on Windows that uses > os.path.exists() to connect to network shares. If the various network > shares require different user account and password com

Re: Newbie Question regarding __init__()

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 22:53:47 -0300, Simon escribió: So should the dcObject class include the "self" as well since I have not defined an __init__ method in dcCursor? Every method that you define takes "self" as its first argument. Every method that you want to call on the current instance mu

Re: Does underscore has any special built-in meaningin Python ?

2009-07-31 Thread Ben Finney
a...@pythoncraft.com (Aahz) writes: > One more thing: if you have global module names with a single leading > underscore (e.g. "_foo"), they will not be loaded when you use > > from import * > > However, "import *" is strongly discouraged for the most part. Dude, that's exactly the “underscore

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 17:26:58 -0300, Emmanuel Surleau escribió: On Friday 31 July 2009 21:55:11 Terry Reedy wrote: The word tuple comes from relational databases as a generalization of single, double, triple, quadruple, quintuple, sextuple, sestuple, octuple, etc. A tuple is a data record wit

socket policy flash help

2009-07-31 Thread NighterNet
I need help on the policy to able to let access to user to the server once the policy access is finish. I been trying to find a good example, but I got no luck. Using python version 3.1. Here the code I tested but it not working. if str(buff) == str("b\'\\x00\'"):

Re: Python docs disappointing

2009-07-31 Thread Terry Reedy
Tim Chase wrote: It may not be an adversity for looking things up using a web-browser, but rather the need to access documentation offline. Whether on an airplane or simply away from a wifi/landline connection, there are plenty of times I'm coding offline (another reason I'm happy to have DV

Re: Newbie Question regarding __init__()

2009-07-31 Thread Nat Williams
As MRAB described, ALL instance methods need to accept 'self' as a first parameter, as that will be passed to them implicitly when they are called. This includes __init__. The name 'self' is just a commonly accepted convention for the name of the instance object passed to methods. You don't have

Re: os.path.exists() and Samba shares

2009-07-31 Thread Ben Finney
BDZ writes: > Unfortunately, although it has the calls I'd want, pysamba appears to > be *nix only. That's because Samba is *nix-only. If you want to use something knowing that it's Samba, you are by definition working on *nix. > I need something that will work under Windows. In that case, for

Re: heapq "key" arguments

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 16:38:01 -0300, Joshua Bronson escribió: On Jul 31, 2:02 pm, Jonathan Gardner wrote: On Jul 31, 10:44 am, Joshua Bronson wrote: > Say I want to maintain a heap of (x, y) pairs sorted only by > first coordinate. Without being able to pass key=itemgetter(0), won't > hea

Re: .dbf tables and Null

2009-07-31 Thread John Machin
On Aug 1, 3:41 am, Ethan Furman wrote: > Mornin'!  and a good one, too, I hope. > > Question for you... > > First part of the question:  What is the general value in having Null > capability for fields? In general, in any database system, so that one can distinguish between "the customer has no '

Re: Python docs disappointing

2009-07-31 Thread Tim Chase
Martin P. Hellwig wrote: kj wrote: [excerpt of previously snipped content restored] I'm sure that I can find a full description of this parameter if I fire up Google, and search online. In fact, more likely than not, I'll find far more documentation than I want. But my point is that a program

Re: Bug with Python, Cygwin and /dev/urandom?

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 20:57:23 -0300, Jeremy Cowles escribió: urllib2.py is crashes when calling randombytes(n). I run the following under Cygwin (mimicking how randombytes works): $ python Python 2.5.2 (r252:60911, Dec 2 2008, 09:26:14) [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.12

Re: Newbie Question regarding __init__()

2009-07-31 Thread Simon
Hi So should the dcObject class include the "self" as well since I have not defined an __init__ method in dcCursor? Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing

2009-07-31 Thread Steven D'Aprano
On Fri, 31 Jul 2009 21:28:36 +, kj wrote: > In > Carl Banks writes: > >>(omg you have to use a >>*mouse*) > > That's precisely the point. There's a huge number of programmers out > there who, like me, *hate* to use the mouse while they're coding. Complain to the developers of your web b

Re: Confessions of a Python fanboy

2009-07-31 Thread Steven D'Aprano
On Fri, 31 Jul 2009 20:41:12 +0200, Emmanuel Surleau wrote: >> We don't actually *declare* that something is constant and then have >> that declaration ignored. Python doesn't lie to us, although (as in any >> language) a programmer might. > > You could say that Ruby doesn't either, Well you co

Module updating plans for Python 3.1: feedparser, MySQLdb

2009-07-31 Thread John Nagle
Any progress on updating feedparser and MySQLdb for Python 3.x in the foreseeable future? Feedparser shouldn't be that hard; it's just that nobody is working on it. MySQLdb is known to be hard, and that may be a while. John Nagle -- http://mail.python.org/ma

Re: base64 Incorrect Padding

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 18:58:43 -0300, bfrederi escribió: So what if I used a different encoding that isn't ASCII? Like UTF-8? Would that give me lengths that are multiples of 4 based on how the characters are represented? Or would I still need to pad with '='? It doesn't matter, a base64-enco

Re: threads check socket

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 14:42:29 -0300, NighterNet escribió: On Jul 31, 10:23 am, "Gabriel Genellina" wrote: En Fri, 31 Jul 2009 13:35:10 -0300, NighterNet escribió: > I been trying to find a way to check the socket is open or not. The > thread are in a group and loop if the sockets are open

Re: possible to round number and convert to string?

2009-07-31 Thread Dr. Phillip M. Feldman
This was very close to what I wanted. Thanks! My final code looks like this: def num2str(x,f=4): """Convert x (int or float) to a string with f digits to right of the decimal point. f may be zero or negative, in which case the decimal point is suppressed.""" s= str(round(x,f)) i

Re: Python docs disappointing

2009-07-31 Thread Aahz
In article , kj wrote: >In Carl >Banks writes: >> >>(omg you have to use a *mouse*) > >That's precisely the point. There's a huge number of programmers out >there who, like me, *hate* to use the mouse while they're coding. It >is truly disappointing to us that the developers of Python chose

Re: Python docs disappointing

2009-07-31 Thread Mark Lawrence
r wrote: On Jul 31, 4:53 pm, Mark Lawrence wrote: r wrote: On Jul 31, 4:16 pm, Carl Banks wrote: On Jul 31, 1:10 pm, kj wrote: I'm pretty new to Python, and I like a lot overall, but I find the documentation for Python rather poor, overall. I'm sure that Python experts don't have this prob

Re: Python docs disappointing

2009-07-31 Thread Martin P. Hellwig
kj wrote: Well to a level I agree with you. If you are totally new to programming _and_ you won't/can't invest in educational material _and_ have an adversity for looking up resources using a web browser _and_ don't have the patience for trial and error *then* getting proficient with the langua

Re: Python docs disappointing - group effort to hire writers?

2009-07-31 Thread Kee Nethery
I too find the Python docs not very useful and it really slows down my learning curve. I wonder if it would make sense to find good tech writers, get a quotes, and get some professionally written documentation WITH LOTS OF EXAMPLES added to the standard Python documentation tree. I'd chip

Re: Python docs disappointing

2009-07-31 Thread r
On Jul 31, 4:53 pm, Mark Lawrence wrote: > r wrote: > > On Jul 31, 4:16 pm, Carl Banks wrote: > >> On Jul 31, 1:10 pm, kj wrote: > > >>> I'm pretty new to Python, and I like a lot overall, but I find the > >>> documentation for Python rather poor, overall. > >>> I'm sure that Python experts don'

Bug with Python, Cygwin and /dev/urandom?

2009-07-31 Thread Jeremy Cowles
urllib2.py is crashes when calling randombytes(n). I run the following under Cygwin (mimicking how randombytes works): $ python Python 2.5.2 (r252:60911, Dec 2 2008, 09:26:14) [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin Type "help", "copyright", "credits" or "license" for m

Re: Python docs disappointing

2009-07-31 Thread Chris Jones
On Fri, Jul 31, 2009 at 06:03:25PM EDT, Carl Banks wrote: > On Jul 31, 2:28 pm, kj wrote: > > In Carl > > Banks writes: > > > > >(omg you have to use a > > >*mouse*) > > > > That's precisely the point.  There's a huge number of programmers > > out there who, like me, *hate* to use the mouse whi

Re: Does underscore has any special built-in meaningin Python ?

2009-07-31 Thread Aahz
In article <062813eb-7eec-4504-b32c-abadf02c3...@12g2000pri.googlegroups.com>, dandi kain wrote: > >What is the functionality of __ or _ , leading or trailing an object , >class ot function ? Is it just a naming convention to note special >functions and objects , or it really mean someting to Pyt

Re: Python docs disappointing

2009-07-31 Thread Carl Banks
On Jul 31, 3:09 pm, kj wrote: > In <09bf4f17-40a5-4bad-81d3-1950545b7...@g6g2000vbr.googlegroups.com> > > Carl Banks writes: > > > > Thanks.  Your remarks at least confirm that my impression was not > simply due to my noob ignorance: the keyboard-accessible docs are > indeed as poor as they look

Re: possible to round number and convert to string?

2009-07-31 Thread John Yeung
On Jul 31, 6:17 pm, "Dr. Phillip M. Feldman" wrote: > I'd like to be able to convert a float to a > string representation in which the number is > rounded to a specified number of digits.  If > num2str is a hypothetical function that does > this, then num2str(pi,3) would be '3.142' > (not '3.141')

Re: possible to round number and convert to string?

2009-07-31 Thread superpollo
Dr. Phillip M. Feldman wrote: I'd like to be able to convert a float to a string representation in which the number is rounded to a specified number of digits. If num2str is a hypothetical function that does this, then num2str(pi,3) would be '3.142' (not '3.141'). I've been told that there is n

Re: Python docs disappointing

2009-07-31 Thread Nikolaus Rath
Carl Banks writes: >> This is one area in which Perl still whips Python... > > No way. Perl's man pages are organized so poorly there is no > ergonomic pit deep enough to offset them. Quick, what man page is the > "do" statement documented in? Of course there is: $ perldoc -f do | head

Re: possible to round number and convert to string?

2009-07-31 Thread Jerry Hill
On Fri, Jul 31, 2009 at 6:17 PM, Dr. Phillip M. Feldman wrote: > > I'd like to be able to convert a float to a string representation in which > the number is rounded to a specified number of digits.  If num2str is a > hypothetical function that does this, then num2str(pi,3) would be '3.142' > (not

Re: Non-blocking read with popen subprocess

2009-07-31 Thread birdsong
On Jul 30, 7:30 pm, Jonathan Gardner wrote: > On Jul 30, 5:24 pm, Dhanesh wrote: > > > > > how can I we have a non blocking read ? > > Seehttp://docs.python.org/library/popen2.html#flow-control-issues > > Note well: In the non-blocking world, you have to use select() or poll > () to get your job

Re: base64 Incorrect Padding

2009-07-31 Thread MRAB
bfrederi wrote: So what if I used a different encoding that isn't ASCII? Like UTF-8? Would that give me lengths that are multiples of 4 based on how the characters are represented? Or would I still need to pad with '='? I think that when it says Base-64 it's talking about the byte values used f

possible to round number and convert to string?

2009-07-31 Thread Dr. Phillip M. Feldman
I'd like to be able to convert a float to a string representation in which the number is rounded to a specified number of digits. If num2str is a hypothetical function that does this, then num2str(pi,3) would be '3.142' (not '3.141'). I've been told that there is no such function in Python. I t

Re: Python docs disappointing

2009-07-31 Thread Carl Banks
On Jul 31, 2:28 pm, kj wrote: > In Carl > Banks writes: > > >(omg you have to use a > >*mouse*) > > That's precisely the point.  There's a huge number of programmers > out there who, like me, *hate* to use the mouse while they're > coding. You would have figured one of them would have written

Re: base64 Incorrect Padding

2009-07-31 Thread bfrederi
So what if I used a different encoding that isn't ASCII? Like UTF-8? Would that give me lengths that are multiples of 4 based on how the characters are represented? Or would I still need to pad with '='? -- http://mail.python.org/mailman/listinfo/python-list

Re: Help understanding the decisions *behind* python? - immutable objects

2009-07-31 Thread Raymond Hettinger
On Jul 26, 11:24 am, John Nagle wrote: > A tuple is really a frozen list.  Arguably, frozen objects > should have been a general concept.  Conceptually, they're > simple - once "__init__" has run, there can be no more changes > to fields of the object. I would argue that freezing and thawing (mak

Re: Python docs disappointing

2009-07-31 Thread Mark Lawrence
r wrote: On Jul 31, 4:16 pm, Carl Banks wrote: On Jul 31, 1:10 pm, kj wrote: I'm pretty new to Python, and I like a lot overall, but I find the documentation for Python rather poor, overall. I'm sure that Python experts don't have this problem: they have internalized some good ways to access

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Raymond Hettinger
> > While nothing in the list/tuple code requires you to make that > > distinction, > > it is important because that philosophy pervades the language.  If you > > follow Guido's direction, you'll find that the various parts of the > > language fit together better.  Do otherwise and you'll be going

Re: Python docs disappointing

2009-07-31 Thread r
On Jul 31, 4:16 pm, Carl Banks wrote: > On Jul 31, 1:10 pm, kj wrote: > > > I'm pretty new to Python, and I like a lot overall, but I find the > > documentation for Python rather poor, overall. > > > I'm sure that Python experts don't have this problem: they have > > internalized some good ways t

Re: Python docs disappointing

2009-07-31 Thread kj
In Carl Banks writes: >(omg you have to use a >*mouse*) That's precisely the point. There's a huge number of programmers out there who, like me, *hate* to use the mouse while they're coding. It is truly disappointing to us that the developers of Python chose to completely disregard this cons

Re: Python docs disappointing

2009-07-31 Thread Carl Banks
On Jul 31, 1:55 pm, Mark Lawrence wrote: > Apart from that what have the Pythonistas ever done for us? Nothing!:) Please don't feed the trolls. And if you do feed the trolls don't smile at them. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing

2009-07-31 Thread Carl Banks
On Jul 31, 1:10 pm, kj wrote: > I'm pretty new to Python, and I like a lot overall, but I find the > documentation for Python rather poor, overall. > > I'm sure that Python experts don't have this problem: they have > internalized some good ways to access the documentation, are > productive with i

Re: Python docs disappointing

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 22:34 , Emmanuel Surleau wrote: You have first-grade documentation on the Python website: http://docs.python.org/library/urllib.html I'm not really using pydoc, but I'd wager it's more used as a quick lookup than anything else. Another important documentary resource for the

Re: base64 Incorrect Padding

2009-07-31 Thread MRAB
Max Erickson wrote: MRAB wrote: Brandon Fredericks wrote: I did a search within this group, but couldn't find any information on this. I am sending base64 encoded data as the content over http using urllib2 urlopen. When I receive the data and attempt to decode it, I get an "Incorrect Paddin

Re: Python quirk in evaluation order

2009-07-31 Thread Dave Angel
James Stroud wrote: Python 2.5: mbi136-176 211% python *** Pasting of code with ">>>" or "..." has been enabled. ## ipython ## ##

Re: base64 Incorrect Padding

2009-07-31 Thread Max Erickson
MRAB wrote: > Brandon Fredericks wrote: >> I did a search within this group, but couldn't find any >> information on this. >> >> I am sending base64 encoded data as the content over http using >> urllib2 urlopen. When I receive the data and attempt to decode >> it, I get an "Incorrect Padding" e

Re: Python docs disappointing

2009-07-31 Thread Mark Lawrence
r wrote: On Jul 31, 3:10 pm, kj wrote: I'm pretty new to Python, and I like a lot overall, but I find the documentation for Python rather poor, overall. [snip] If you mean the built-in docs i *highly agree* with you. if you mean docs/tutorials available across the WWW i *highly disagree* with

Re: beautiful soup

2009-07-31 Thread John Nagle
xubin.cz wrote: hi, everyone Is there any pakage or module handling html document like beautiful soup? Try "http://code.google.com/p/html5lib/";. That's supposed to be a parser which complies with the HTML 5 specification, including its rules for handling bad HTML.

Re: Python quirk in evaluation order

2009-07-31 Thread Peter Otten
James Stroud wrote: > py> b = 4 if True else b > py> b > 4 > Isn't the right side supposed to be evaluated first? Perhaps it becomes clearer if you change it a bit: >>> b = 4 if True else whatever >>> whatever Traceback (most recent call last): File "", line 1, in NameError: name 'whatever'

Re: Python quirk in evaluation order

2009-07-31 Thread Robert Kern
On 2009-07-31 15:11, James Stroud wrote: Python 2.5: mbi136-176 211% python *** Pasting of code with ">>>" or "..." has been enabled. ## ipython ## py

Re: Python docs disappointing

2009-07-31 Thread Emmanuel Surleau
On Friday 31 July 2009 22:10:45 kj wrote: > I'm pretty new to Python, and I like a lot overall, but I find the > documentation for Python rather poor, overall. > > I'm sure that Python experts don't have this problem: they have > internalized some good ways to access the documentation, are > produc

Re: Python quirk in evaluation order

2009-07-31 Thread Albert Hopkins
On Fri, 2009-07-31 at 13:11 -0700, James Stroud wrote: > Python 2.5: > > mbi136-176 211% python > *** Pasting of code with ">>>" or "..." has been enabled. > > ## ipython

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Emmanuel Surleau
On Friday 31 July 2009 21:55:11 Terry Reedy wrote: > Emmanuel Surleau wrote: > >> Beyond the mutable/hashable distinction, there is an important > >> philosophical distinction articulated by Guido. He deems tuples to > >> be useful for struct like groupings of non-homogenous fields and > >> lists

Re: Python docs disappointing

2009-07-31 Thread r
On Jul 31, 3:10 pm, kj wrote: > I'm pretty new to Python, and I like a lot overall, but I find the > documentation for Python rather poor, overall. [snip] If you mean the built-in docs i *highly agree* with you. if you mean docs/tutorials available across the WWW i *highly disagree* with you, and

Re: Python docs disappointing

2009-07-31 Thread Robert Kern
On 2009-07-31 15:10, kj wrote: I would love to know how experienced Python programmers quickly zero in on the Python documentation they need. http://docs.python.org/library/urllib I use Firefox's "Quick Searches" feature to make getting this URL as fast as possible: "m urllib" -- Robert

Python quirk in evaluation order

2009-07-31 Thread James Stroud
Python 2.5: mbi136-176 211% python *** Pasting of code with ">>>" or "..." has been enabled. ## ipython ## ###

Python docs disappointing

2009-07-31 Thread kj
I'm pretty new to Python, and I like a lot overall, but I find the documentation for Python rather poor, overall. I'm sure that Python experts don't have this problem: they have internalized some good ways to access the documentation, are productive with it, and therefore have lost the ability

Re: base64 Incorrect Padding

2009-07-31 Thread MRAB
Brandon Fredericks wrote: I did a search within this group, but couldn't find any information on this. I am sending base64 encoded data as the content over http using urllib2 urlopen. When I receive the data and attempt to decode it, I get an "Incorrect Padding" error. Is there a simple way to f

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Terry Reedy
Emmanuel Surleau wrote: Beyond the mutable/hashable distinction, there is an important philosophical distinction articulated by Guido. He deems tuples to be useful for struct like groupings of non-homogenous fields and lists to be useful for sequences of homogenous data suitable for looping.

Re: Use existing IE cookie

2009-07-31 Thread Gabriel Genellina
En Thu, 30 Jul 2009 13:31:33 -0300, KB escribió: On Jul 30, 9:23 am, "Diez B. Roggisch" wrote: KB wrote: > From the HTTPCookieProcessor doco, it appears that non-IE browsers > have a cookie file (and example code) but from what I can tell IE uses > a hidden folder. (you can set your location

Re: class or thread id count

2009-07-31 Thread Gabriel Genellina
En Thu, 30 Jul 2009 17:09:36 -0300, NighterNet escribió: On Jul 30, 12:14 pm, r wrote: On Jul 30, 1:13 pm, NighterNet wrote: > Need some help on doing some bit simple id count. It like every time > it create a class orthreadthere is id++. Python 3.1 use a class atrribute class Person():

Re: heapq "key" arguments

2009-07-31 Thread Joshua Bronson
On Jul 31, 2:02 pm, Jonathan Gardner wrote: > On Jul 31, 10:44 am, Joshua Bronson wrote: > > > Say I want to maintain a heap of (x, y) pairs sorted only by > > first coordinate. Without being able to pass key=itemgetter(0), won't > > heapifying a list of such pairs unnecessarily compare both > >

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 20:48 , Emmanuel Surleau wrote: On Friday 31 July 2009 19:49:04 Raymond Hettinger wrote: On Jul 20, 9:27 am, Phillip B Oldham wrote: Specifically the "differences" between lists and tuples have us confused and have caused many "discussions" in the office. We understand that

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 20:17 , Steven D'Aprano wrote: On Fri, 31 Jul 2009 18:15:15 +0200, Masklinn wrote: I know, I know, Ruby people swear by anonymous code blocks, and I've read Paul Graham too. But I'm really not so sure that the benefits of anonymous code blocks are great enough to overcome the

Re: base64 Incorrect Padding

2009-07-31 Thread Peter Otten
Brandon Fredericks wrote: > I did a search within this group, but couldn't find any information on > this. > > I am sending base64 encoded data as the content over http using > urllib2 urlopen. When I receive the data and attempt to decode it, I > get an "Incorrect Padding" error. Is there a simp

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Emmanuel Surleau
On Friday 31 July 2009 19:49:04 Raymond Hettinger wrote: > On Jul 20, 9:27 am, Phillip B Oldham wrote: > > Specifically the "differences" between lists and tuples have us > > confused and have caused many "discussions" in the office. We > > understand that lists are mutable and tuples are not, but

Re: Confessions of a Python fanboy

2009-07-31 Thread Emmanuel Surleau
On Friday 31 July 2009 18:54:23 Tim Rowe wrote: > 2009/7/31 Steven D'Aprano : > > On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: > >> That and the fact that I couldn't stop laughing for long enough to learn > >> any more when I read in the Pragmatic Programmer's Guide that "Ruby, > >> unlike l

.dbf tables and Null

2009-07-31 Thread Ethan Furman
Mornin'! and a good one, too, I hope. Question for you... First part of the question: What is the general value in having Null capability for fields? Second part: Is there a tangible difference between Null, and the nothing of 0, '', False, etc, in python? Third part: If there is a tan

Re: Newbie Question regarding __init__()

2009-07-31 Thread MRAB
Simon wrote: Hi I want to create an instance of dcCursor which inherits from dcObject. When I run the following code it gives the error shown. Can some explain to me what is wrong? I have included the dcObject.py and dcCursor.py below. import dcObject import dcCursor x = dcCursor.dcCursor()

Re: Printing with colors in a portable way

2009-07-31 Thread Nobody
On Thu, 30 Jul 2009 15:40:37 -0700, Robert Dailey wrote: > Anyone know of a way to print text in Python 3.1 with colors in a > portable way? In other words, I should be able to do something like > this: > > print_color( "This is my text", COLOR_BLUE ) > > And this should be portable (i.e. it sho

Newbie Question regarding __init__()

2009-07-31 Thread Simon
Hi I want to create an instance of dcCursor which inherits from dcObject. When I run the following code it gives the error shown. Can some explain to me what is wrong? I have included the dcObject.py and dcCursor.py below. >>>import dcObject >>> import dcCursor >>> x = dcCursor.dcCursor() Traceb

Re: Confessions of a Python fanboy

2009-07-31 Thread Steven D'Aprano
On Fri, 31 Jul 2009 18:15:15 +0200, Masklinn wrote: > > I know, I know, Ruby people swear by > > anonymous code blocks, and I've read Paul Graham too. But I'm really > > not so sure that the benefits of anonymous code blocks are great > > enough to overcome the disadvantages of anonymous code bloc

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 18:24 , Terry Reedy wrote: Masklinn wrote: #each is simply a method that takes a function (called blocks in ruby). One could call it a higher-order method I guess. It's an implementation of the concept of internal iteration: instead of collections yielding iterator objects

base64 Incorrect Padding

2009-07-31 Thread Brandon Fredericks
I did a search within this group, but couldn't find any information on this. I am sending base64 encoded data as the content over http using urllib2 urlopen. When I receive the data and attempt to decode it, I get an "Incorrect Padding" error. Is there a simple way to fix this? A better way to sen

Re: heapq "key" arguments

2009-07-31 Thread Jonathan Gardner
On Jul 31, 10:44 am, Joshua Bronson wrote: > Say I want to maintain a heap of (x, y) pairs sorted only by > first coordinate. Without being able to pass key=itemgetter(0), won't > heapifying a list of such pairs unnecessarily compare both > coordinates? It will compare the second value only if th

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Raymond Hettinger
On Jul 20, 9:27 am, Phillip B Oldham wrote: > Specifically the "differences" between lists and tuples have us > confused and have caused many "discussions" in the office. We > understand that lists are mutable and tuples are not, but we're a > little lost as to why the two were kept separate from

heapq "key" arguments

2009-07-31 Thread Joshua Bronson
According to http://docs.python.org/library/heapq.html, Python 2.5 added an optional "key" argument to heapq.nsmallest and heapq.nlargest. I could never understand why they didn't also add a "key" argument to the other relevant functions (heapify, heappush, etc). Say I want to maintain a heap of (x

Re: threads check socket

2009-07-31 Thread NighterNet
On Jul 31, 10:23 am, "Gabriel Genellina" wrote: > En Fri, 31 Jul 2009 13:35:10 -0300, NighterNet   > escribió: > > > I been trying to find a way to check the socket is open or not. The > > thread are in a group and loop if the sockets are open. If they are > > not open delete the thread and remov

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Raymond Hettinger
On Jul 22, 4:55 am, Duncan Booth wrote: > Steven D'Aprano wrote: > > But that's the wrong solution to the problem. The OP wants the largest > > (or smallest) item, which he expects to get by sorting, then grabbing > > the first element: > > > sorted(alist)[0] > > > That requires sorting the entir

Re: file comparison

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 06:25:17 -0300, learner learner escribió: I want to compare two text files line by line and eliminate the matching/repeated line and store the unmatched/leftout lines into a third file or overwrite into one of them. Look at the difflib module: http://docs.python.org/libr

Re: threads check socket

2009-07-31 Thread Marcus Wanner
On 7/31/2009 12:35 PM, NighterNet wrote: I been trying to find a way to check the socket is open or not. The thread are in a group and loop if the sockets are open. If they are not open delete the thread and remove the group. I need on this. Being a bit more specific would help. Are you using t

Re: threads check socket

2009-07-31 Thread Gabriel Genellina
En Fri, 31 Jul 2009 13:35:10 -0300, NighterNet escribió: I been trying to find a way to check the socket is open or not. The thread are in a group and loop if the sockets are open. If they are not open delete the thread and remove the group. I need on this. What means an "open socket"? Do y

Re: Help understanding the decisions *behind* python?

2009-07-31 Thread Joshua Bronson
On Jul 22, 7:55 am, Duncan Booth wrote: > I find it interesting that the heapq functions tell you in the > documentation that they aren't suitable for use where n==1 or where n is > near the total size of the sequence whereas random.sample() chooses what it > thinks is the best algorithm based on

Re: Confessions of a Python fanboy

2009-07-31 Thread Falcolas
On Jul 31, 3:49 am, Masklinn wrote: > On 31 Jul 2009, at 10:25 , Chris Rebert wrote:> On Fri, Jul 31, 2009 at 1:21 > AM, Xavier Ho   > > wrote: > >> On Fri, Jul 31, 2009 at 6:08 PM, Masklinn   > >> wrote: > > >>> ... but since Python doesn't have anonymous functions that   > >>> usage > >>> tend

Re: Confessions of a Python fanboy

2009-07-31 Thread Tim Rowe
2009/7/31 Steven D'Aprano : > On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: > >> That and the fact that I couldn't stop laughing for long enough to learn >> any more when I read in the Pragmatic Programmer's Guide that "Ruby, >> unlike less flexible languages, lets you alter the value of a co

Re: fast video encoding

2009-07-31 Thread David Bolen
gregorth writes: > I am a novice with video encoding. I found that few codecs support > gray scale images. Any hints to take advantage of the fact that I only > have gray scale images? I don't know that there's any good way around the fact that video encoding is simply one of the heavier CPU-bou

threads check socket

2009-07-31 Thread NighterNet
I been trying to find a way to check the socket is open or not. The thread are in a group and loop if the sockets are open. If they are not open delete the thread and remove the group. I need on this. -- http://mail.python.org/mailman/listinfo/python-list

Re: supported versions policy?

2009-07-31 Thread Terry Reedy
Gary Wilson wrote: Does Python have a formal policy on the support lifetime (bug fixes, security fixes, etc.) for major and minor versions? I did a bit of searching on the Python web site and this group, but didn't find anything. If there is a policy posted somewhere (and I just didn't dig deep

Re: os.path.exists() and Samba shares

2009-07-31 Thread BDZ
On Jul 30, 4:41 pm, Loïc Domaigné wrote: > Hi, > > > Hello. I have written a Python 3.1 script running on Windows that uses > > os.path.exists() to connect to network shares. If the various network > > shares require different user account and password combos than the > > account the script is run

Re: Confessions of a Python fanboy

2009-07-31 Thread Terry Reedy
Masklinn wrote: #each is simply a method that takes a function (called blocks in ruby). One could call it a higher-order method I guess. It's an implementation of the concept of internal iteration: instead of collections yielding iterator objects, and programmers using those through speciall

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 17:55 , Steven D'Aprano wrote: But seriously, while I admit that I have very little Ruby experience, and so aren't in a great position to judge, it seems to me that Ruby doesn't have anything like Python's over-riding design principles (the Zen). If there is a design prin

Re: Confessions of a Python fanboy

2009-07-31 Thread Steven D'Aprano
On Fri, 31 Jul 2009 13:38:56 +0200, Bruno Desthuilliers wrote: >> On the other hand, we don't have to prefix names with @ and @@, > > Nope, we have to prefix them with 'self' or 'cls' (or even > 'self.__class__'). Incorrect. >>> class K: ... class_attribute = 'No @@ required.' ... >>> K().c

Re: Confessions of a Python fanboy

2009-07-31 Thread Benjamin Kaplan
On Fri, Jul 31, 2009 at 11:35 AM, Iain King wrote: > On Jul 31, 4:08 pm, Ethan Furman wrote: >> Steven D'Aprano wrote: >> > On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: >> >> >>That and the fact that I couldn't stop laughing for long enough to learn >> >>any more when I read in the Pragmati

Re: Confessions of a Python fanboy

2009-07-31 Thread Iain King
On Jul 31, 4:08 pm, Ethan Furman wrote: > Steven D'Aprano wrote: > > On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: > > >>That and the fact that I couldn't stop laughing for long enough to learn > >>any more when I read in the Pragmatic Programmer's Guide that "Ruby, > >>unlike less flexible

  1   2   >