Re: Where are documentation for Gnome

2012-10-15 Thread Matěj Cepl
On Sat, 13 Oct 2012 20:14:50 +0200, Kwpolska wrote: > https://live.gnome.org/EyeOfGnome/Plugins#Python > > That is all the documentation in existence for Python plugins. > > Examples: > http://git.gnome.org/browse/eog-plugins/tree/plugins/slideshowshuffle > http://git.gnome.org/browse/eog-plugins

Re: delete xml elements - using xpath search

2012-10-15 Thread Stefan Behnel
Tharanga Abeyseela, 16.10.2012 05:57: > i need to delete the following pattern and its parent node from my xml > file (IF THE SEARCH STRING FOUND) > > NC > > if i find the above particular string , i need to delete the XML > elements (parent of the element. problem is i have different > parent

Re: Which book is the best?

2012-10-15 Thread Dwight Hutto
On Tue, Oct 16, 2012 at 12:27 AM, 老爷 wrote: > I have strong c++ development experience. But now I want to study the > python to do some windows setting task, such as editing file, changing the > system setting, doing some network processing. Please help me which book is > the best? > > Definitel

Re: OT Questions

2012-10-15 Thread Dwight Hutto
On Tue, Oct 16, 2012 at 12:05 AM, Dwight Hutto wrote: > Like a lot of people here, I'm trying to build a web development business. > I'm starting off by building a profile on a freelance site. > > I would like some honest opinions(don't be too harsh, or you can be, that's > what it's about), abou

Re: how to insert random error in a programming

2012-10-15 Thread Steven D'Aprano
On Mon, 15 Oct 2012 18:21:55 -0700, alex23 wrote: > On Oct 16, 5:52 am, Chris Angelico wrote: >> Surely there's a shorter way to rot13 a piece of text? CODE GOLF! > > In Python2: "a piece of string".encode('rot13') :) And in Python 3, unfortunately there has been a right-royal mess made of the

Is there a way to create kernel log messages via Python?

2012-10-15 Thread J
Hi... I have a bit of code that does the following: uses the syslog module to inject a LOG_INFO message into the syslog on my linux machine runs a suspend/resume cycle uses the syslog module to inkect a LOG_INFO message marking the end of test. Then I parse everything between the start and stop

Re: LinkedIn Python group discussions

2012-10-15 Thread Dwight Hutto
On Sun, Oct 14, 2012 at 7:42 AM, Mark Lawrence wrote: > I've been sparked into raising the subject as this has just come up "Does > Jython/Python fall short of true POSIX thread parallelism?". I'm not > qualified to comment and I recognise relatively few names amongst the people > who do particip

easy_install says "not a recognized archive type" Windows Py3

2012-10-15 Thread Noah Coad
Hello, I'm new to Python, have v3.0 32bit installed on Windows 7, installed distribute, now trying to install pymysql and am getting the below error. Any pointers on how to fix? thanks!! -Noah [C:\Python32]pip install --upgrade distribute Real name of requirement distribute is distribute Requ

Re: how to insert random error in a programming

2012-10-15 Thread Roy Smith
In article , rusi wrote: > On Oct 15, 9:00 pm, John Gordon wrote: > > In Debashish Saha > > writes: > > > > > how to insert random error in a programming? > > > > Open the program source file and replace the Nth character with a random > > character. > > I'm reminded of a description of vi

Re: how to insert random error in a programming

2012-10-15 Thread rusi
On Oct 15, 9:00 pm, John Gordon wrote: > In Debashish Saha > writes: > > > how to insert random error in a programming? > > Open the program source file and replace the Nth character with a random > character. I'm reminded of a description of vi: A program with two modes, one in which it beep

Re: Fastest web framework

2012-10-15 Thread alex23
On Oct 15, 11:40 pm, Andriy Kornatskyy wrote: > Comments or suggestions are welcome. Performance speed is possibly the least interesting aspect of web frameworks; ease of use & readily re-usable 3rd party code figures much higher, IMO. Rather than constantly hammer on about performance, maybe you

Re: how to insert random error in a programming

2012-10-15 Thread alex23
On Oct 16, 5:52 am, Chris Angelico wrote: > Surely there's a shorter way to rot13 a piece of text? CODE GOLF! In Python2: "a piece of string".encode('rot13') :) > At very least, a single cryptic expression in place of your nice clear > loops MUST be an improvement. > > d = dict((chr(i+c),chr((i+

Re: Exception Messages

2012-10-15 Thread Steven D'Aprano
On Mon, 15 Oct 2012 09:00:15 -0700, Wanderer wrote: > How do you get Exceptions to print messages? I have an exception defined > like this > > class PvCamError(Exception): > def __init__(self, msg): > self.msg = msg Please don't invent yet another interface for exception messages. E

Re: how to insert random error in a programming

2012-10-15 Thread Steven D'Aprano
On Mon, 15 Oct 2012 19:25:38 +0530, Debashish Saha wrote: > how to insert random error in a programming? While editing the source code, have your cat walk across the keyboard. I really think you need to explain your question better. -- Steven -- http://mail.python.org/mailman/listinfo/pytho

Using pipe_controller to swap pipe components at runtime

2012-10-15 Thread vasudevram
I added a couple of methods / functions to my pipe_controller Python module, the Python tool to experiment with pipelined functions within a program. With these additions, it is now possible to swap the components of a pipe_controller 'pipe' programmatically, at runtime (*), and then run the pi

Re: how to insert random error in a programming

2012-10-15 Thread Joshua Landau
On 15 October 2012 20:51, Chris Angelico wrote: > On Tue, Oct 16, 2012 at 6:28 AM, Mark Lawrence > wrote: > > I like clearly written code like this > > > > " > > d = {} > > for c in (65, 97): > > for i in range(26): > > d[chr(i+c)] = chr((i+13) % 26 + c) > > > > print "".join([d.get(

Re: numpy - 2D matrix/array - initialization like in Matlab...

2012-10-15 Thread someone
On 10/15/2012 11:26 PM, MRAB wrote: On 2012-10-15 22:09, someone wrote: See this: == In [5]: Dx = numpy.matrix('1 0 0; 0 0.5 -0.5; 0 -0.5 1.5') In [6]: Dx Out[6]: matrix([[ 1. , 0. , 0. ], [ 0. , 0.5, -0.5], [ 0. ,

RE: Tkinter how to access the widget by name

2012-10-15 Thread Prasad, Ramit
? wrote: > I'm a little teapot ... himself the question: if I want to appeal to the > widget, knowing his name... ? > > # appropriated the name of the widget > label = Label(frame, width = 40, text='text', name = 'name') > ... > name_='name' > configure(name_) > ... > def configure(n

Re: numpy - 2D matrix/array - initialization like in Matlab...

2012-10-15 Thread Emile van Sebille
someone wrote: How to initialize my array directly using variables ? It could also be that I wanted: test11 = 1 test12 = 1.5 test13 = 2 test21 = 0 test22 = 5 Dx = numpy.matrix('test11 test12 test13; test21 test22 -0.5; 0 -0.5 1.5') Etc... for many variables... Appreciate ANY help, thank you

Re: numpy - 2D matrix/array - initialization like in Matlab...

2012-10-15 Thread Joshua Landau
On 15 October 2012 22:09, someone wrote: > > See this: > > ==** > In [5]: Dx = numpy.matrix('1 0 0; 0 0.5 -0.5; 0 -0.5 1.5') > > In [6]: Dx > Out[6]: > matrix([[ 1. , 0. , 0. ], > [ 0. , 0.5, -0.5], > [ 0. , -0.5, 1.5]])

Re: numpy - 2D matrix/array - initialization like in Matlab...

2012-10-15 Thread MRAB
On 2012-10-15 22:09, someone wrote: See this: == In [5]: Dx = numpy.matrix('1 0 0; 0 0.5 -0.5; 0 -0.5 1.5') In [6]: Dx Out[6]: matrix([[ 1. , 0. , 0. ], [ 0. , 0.5, -0.5], [ 0. , -0.5, 1.5]]) ==

Re: How to use "while" within the command in -c option of python?

2012-10-15 Thread Joshua Landau
On 13 October 2012 17:38, Joshua Landau wrote: > This here isn't a flaw in Python, though. It's a flaw in the command-line > interpreter. By putting it all on one line, you are effectively saying: > "group these". Which is the same as an "if True:" block, and some things > like Reinteract even su

Re: numpy - 2D matrix/array - initialization like in Matlab...

2012-10-15 Thread Ian Kelly
On Oct 15, 2012 3:12 PM, "someone" wrote: > How to initialize my array directly using variables ? Why not just use the list-of-lists constructor instead of the string constructor? m = numpy.matrix([[1,2,3],[4,5,6],[7,8,test]]) -- http://mail.python.org/mailman/listinfo/python-list

numpy - 2D matrix/array - initialization like in Matlab...

2012-10-15 Thread someone
See this: == In [5]: Dx = numpy.matrix('1 0 0; 0 0.5 -0.5; 0 -0.5 1.5') In [6]: Dx Out[6]: matrix([[ 1. , 0. , 0. ], [ 0. , 0.5, -0.5], [ 0. , -0.5, 1.5]]) == O

Re: how to insert random error in a programming

2012-10-15 Thread Victor Stinner
Try fuzzing. Examples: http://pypi.python.org/pypi/fusil/ http://peachfuzzer.com/ Victor -- http://mail.python.org/mailman/listinfo/python-list

Re: how to insert random error in a programming

2012-10-15 Thread Mark Lawrence
On 15/10/2012 20:51, Chris Angelico wrote: On Tue, Oct 16, 2012 at 6:28 AM, Mark Lawrence wrote: I like clearly written code like this " d = {} for c in (65, 97): for i in range(26): d[chr(i+c)] = chr((i+13) % 26 + c) print "".join([d.get(c, c) for c in s]) Surely there's a sh

Re: how to insert random error in a programming

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 6:28 AM, Mark Lawrence wrote: > I like clearly written code like this > > " > d = {} > for c in (65, 97): > for i in range(26): > d[chr(i+c)] = chr((i+13) % 26 + c) > > print "".join([d.get(c, c) for c in s]) Surely there's a shorter way to rot13 a piece of tex

Re: MySQL with Python

2012-10-15 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > For routine database /access/ (that is, someone has created the > database user account that will be used), MySQLdb is the Python adapter > to connect to the server. For using THAT, you basically need to know SQL > (MySQL's flavor in particular), along wit

Re: how to insert random error in a programming

2012-10-15 Thread Mark Lawrence
On 15/10/2012 20:10, Joshua Landau wrote: On 15 October 2012 14:55, Debashish Saha wrote: how to insert random error in a programming? You could always just *write* the code with random errors from the start. Try random code, like this: from collections import defaultdict as ð def ire(ł,

Re: Exception Messages

2012-10-15 Thread Terry Reedy
On 10/15/2012 12:22 PM, John Gordon wrote: In MRAB writes: Why wasn't the message printed out? You didn't add a __str__ method: class PvCamError(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg Wouldn't PvCamError i

Re: how to insert random error in a programming

2012-10-15 Thread Joshua Landau
On 15 October 2012 14:55, Debashish Saha wrote: > how to insert random error in a programming? > You could always just *write* the code with random errors from the start. Try random code, like this: from collections import defaultdict as ð > def ire(ł, æ=[]): > yield [ð(bool, {æ and æ[0]or obje

Re: how to insert random error in a programming

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 4:18 AM, Serhiy Storchaka wrote: > On 15.10.12 17:04, Chris Angelico wrote: >> On Tue, Oct 16, 2012 at 12:55 AM, Debashish Saha wrote: >>> how to insert random error in a programming? >> >> how to ask question good in forumming? >> http://www.catb.org/~esr/faqs/smart-quest

Re: how to insert random error in a programming

2012-10-15 Thread Emile van Sebille
Debashish Saha wrote: how to insert random error in a programming? Make the changes late in the day then leave for the weekend? Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: how to insert random error in a programming

2012-10-15 Thread Gary Herron
On 10/15/2012 06:55 AM, Debashish Saha wrote: how to insert random error in a programming? Drink several beers before you start programming. :-) -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python

Re: Exception Messages

2012-10-15 Thread Wanderer
On Monday, October 15, 2012 1:34:24 PM UTC-4, MRAB wrote: > On 2012-10-15 18:18, Wanderer wrote: > > > On Monday, October 15, 2012 12:34:53 PM UTC-4, MRAB wrote: > > > > > >> > > >> Yes, but you've put the message in msg, and Exception doesn't have that > > >> > > >> attribute. > > >> > > >

Re: Exception Messages

2012-10-15 Thread MRAB
On 2012-10-15 18:18, Wanderer wrote: On Monday, October 15, 2012 12:34:53 PM UTC-4, MRAB wrote: Yes, but you've put the message in msg, and Exception doesn't have that attribute. That's weird. I got this Exception class definition idea from this post by Guido van Rostrum, Where he gives t

Re: Feedback on my python framework I'm building.

2012-10-15 Thread Roel Schroeven
MRAB schreef: On 2012-10-14 23:38, Dave Angel wrote: On 10/14/2012 08:48 AM, Roy Smith wrote: In article <507a3365$0$6574$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: Remember using PEEK and POKE commands with BASIC back in 1978? Pretty much impossible in Python. But, trivia

Re: Exception Messages

2012-10-15 Thread Wanderer
On Monday, October 15, 2012 1:18:52 PM UTC-4, Wanderer wrote: > On Monday, October 15, 2012 12:34:53 PM UTC-4, MRAB wrote: > > > > > > > > Yes, but you've put the message in msg, and Exception doesn't have that > > > > > > attribute. > > > > > > > That's weird. I got this Exception cla

Re: how to insert random error in a programming

2012-10-15 Thread Serhiy Storchaka
On 15.10.12 17:04, Chris Angelico wrote: > On Tue, Oct 16, 2012 at 12:55 AM, Debashish Saha wrote: >> how to insert random error in a programming? > > how to ask question good in forumming? > http://www.catb.org/~esr/faqs/smart-questions.html > > But here's one way to do it: > > raise > random

Re: Exception Messages

2012-10-15 Thread Wanderer
On Monday, October 15, 2012 12:34:53 PM UTC-4, MRAB wrote: > > Yes, but you've put the message in msg, and Exception doesn't have that > > attribute. > That's weird. I got this Exception class definition idea from this post by Guido van Rostrum, Where he gives this main function to look like

Re: portable unicode literals

2012-10-15 Thread Serhiy Storchaka
On 15.10.12 16:05, Ulrich Eckhardt wrote: I need a little nudge in the right direction, as I'm misunderstanding something concerning string literals in Python 2 and 3. In Python 2.7, b'' and '' are byte strings, while u'' is a unicode literal. In Python 3.2, b'' is a byte string and '' is a unico

Re: how to insert random error in a programming

2012-10-15 Thread Jean-Michel Pichavant
- Original Message - [snip a huge list of advices example and insights] > Then list the description on the homework > assignment. > > -- > > DaveA Like the youngsters write: "/bow" JM -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception Messages

2012-10-15 Thread Dave Angel
On 10/15/2012 12:34 PM, MRAB wrote: > On 2012-10-15 17:22, John Gordon wrote: >> In MRAB >> writes: >> >>> > Why wasn't the message printed out? >>> >>> You didn't add a __str__ method: >> >>> class PvCamError(Exception): >>> def __init__(self, msg): >>> self.msg = msg >>> def

Re: Exception Messages

2012-10-15 Thread MRAB
On 2012-10-15 17:22, John Gordon wrote: In MRAB writes: > Why wasn't the message printed out? You didn't add a __str__ method: class PvCamError(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return self.msg Wouldn't PvCamError inherit

Re: Exception Messages

2012-10-15 Thread John Gordon
In MRAB writes: > > Why wasn't the message printed out? > > You didn't add a __str__ method: > class PvCamError(Exception): > def __init__(self, msg): > self.msg = msg > def __str__(self): > return self.msg Wouldn't PvCamError inherit __str__() from Exception? --

Re: Exception Messages

2012-10-15 Thread MRAB
On 2012-10-15 17:00, Wanderer wrote: How do you get Exceptions to print messages? I have an exception defined like this class PvCamError(Exception): def __init__(self, msg): self.msg = msg But when the error is raised I get this: Traceback (most recent call last): File "C:\P

Re: how to insert random error in a programming

2012-10-15 Thread John Gordon
In Debashish Saha writes: > how to insert random error in a programming? Open the program source file and replace the Nth character with a random character. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bear

Exception Messages

2012-10-15 Thread Wanderer
How do you get Exceptions to print messages? I have an exception defined like this class PvCamError(Exception): def __init__(self, msg): self.msg = msg But when the error is raised I get this: Traceback (most recent call last): File "C:\Python27\lib\site-packages\ipython-0.12.1-p

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Terry Reedy
On 10/15/2012 7:23 AM, tinn...@isbd.co.uk wrote: I want to fix an error in some code I have installed, however I don't really want to just bodge it. The function producing the error is:- def get_text(self, idx): # override ! node = self.items[idx] a= [

Re: how to insert random error in a programming

2012-10-15 Thread Neal Becker
Debashish Saha wrote: > how to insert random error in a programming? Apparently, giving it to Microsoft will work. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to insert random error in a programming

2012-10-15 Thread Mark Lawrence
On 15/10/2012 14:55, Debashish Saha wrote: how to insert random error in a programming? Just use some of my code, it's far more random than that suggested by others who've replied to your query. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQL with Python

2012-10-15 Thread Anurag Chourasia
Don't worry about what book you have (or don't have) in your Library..And let this not dictate your technology stack. PostgreSQL is one of the popular choice and you will never be short of documentation...Just Google and you will find lot of helpful tutorials... Regards, Anurag On Mon, Oct 1

Re: MySQL with Python

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 1:47 AM, রুদ্র ব্যাণার্জী wrote: > On Tue, 2012-10-16 at 01:01 +1100, Chris Angelico wrote: >> But you may wish to consider using PostgreSQL instead. > Thanks, as I am very much new in database thing, I am not very aware of > the options I have. > But in my library, I did

Re: MySQL with Python

2012-10-15 Thread রুদ্র ব্যাণার্জী
On Tue, 2012-10-16 at 01:01 +1100, Chris Angelico wrote: > But you may wish to consider using PostgreSQL instead. Thanks, as I am very much new in database thing, I am not very aware of the options I have. But in my library, I did not found any thing on PostgreSQL. Though, I will google its supp

Re: how to insert random error in a programming

2012-10-15 Thread Dave Angel
On 10/15/2012 09:55 AM, Debashish Saha wrote: > how to insert random error in a programming? I don't see how this phrase makes any sense without a lot more context. If I add the words "I'd like to know" in front of the phrase, and "session." at the end (and add the word "a" as appropriate), the

Re: how to insert random error in a programming

2012-10-15 Thread Jean-Michel Pichavant
- Original Message - > how to insert random error in a programming? > -- > http://mail.python.org/mailman/listinfo/python-list > Here's an example from random raise Except(randome.randinteger(0,10,'error']): return -- http://mail.python.org/mailman/listinfo/python-list

Re: how to insert random error in a programming

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 12:55 AM, Debashish Saha wrote: > how to insert random error in a programming? how to ask question good in forumming? http://www.catb.org/~esr/faqs/smart-questions.html But here's one way to do it: raise random.choice((OSError,IOError,ZeroDivisionError,UnicodeDecodeErro

Re: MySQL with Python

2012-10-15 Thread Demian Brecht
On 12-10-15 06:45 AM, রুদ্র ব্যাণার্জী wrote: if yes, can you kindly suggest a book/reference on this? There are a few different ways to connect to MySQL, two of which are: For reference on connecting and querying MySQL through mysql-python, take a read through http://mysql-python.sourceforg

Re: MySQL with Python

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 12:45 AM, রুদ্র ব্যাণার্জী wrote: > Dear friends, > I am starting a project of creating a database using mySQL(my first > project with database). > I went to my institute library and find that, all books are managing > "mySQL with perl and php" > > I am new to python itself

Re: MySQL with Python

2012-10-15 Thread Anurag Chourasia
Yes you can. There are libraries available in python to make this happen. Read this for a starter http://dev.mysql.com/usingmysql/python/ Regards, Anurag On Oct 15, 2012 10:53 AM, "রুদ্র ব্যাণার্জী" wrote: > Dear friends, > I am starting a project of creating a database using mySQL(my first >

how to insert random error in a programming

2012-10-15 Thread Debashish Saha
how to insert random error in a programming? -- http://mail.python.org/mailman/listinfo/python-list

MySQL with Python

2012-10-15 Thread রুদ্র ব্যাণার্জী
Dear friends, I am starting a project of creating a database using mySQL(my first project with database). I went to my institute library and find that, all books are managing "mySQL with perl and php" I am new to python itself and gradually loving it. I mostly use it as an alternative of shell-sc

Re: portable unicode literals

2012-10-15 Thread Alex Strickland
On 2012/10/15 03:05 PM, Ulrich Eckhardt wrote: This actually came as a surprise to me, I assumed that using b'' I could portably create a byte string (which is true) and using u'' I could portably create a unicode string (which is not true). This feature would help porting code between both vers

RE: Fastest web framework

2012-10-15 Thread Andriy Kornatskyy
How fast python web frameworks reverse urls? While routing is a mapping of incoming request to a handler, url reverse function is designed to build urls for those handlers. A web page may have a number of urls from few dozen to hundreds... all related to your web site (e.g. links between relat

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Miki Tebeka
> I want to fix an error in some code I have installed, ... Apart from all the reasons why it's bad (see the Python Zen #10). One way to do it is: return [i or '' for i in a] -- http://mail.python.org/mailman/listinfo/python-list

Re: portable unicode literals

2012-10-15 Thread Dave Angel
On 10/15/2012 09:05 AM, Ulrich Eckhardt wrote: > Hi! > > I need a little nudge in the right direction, as I'm misunderstanding > something concerning string literals in Python 2 and 3. In Python 2.7, > b'' and '' are byte strings, while u'' is a unicode literal. In Python > 3.2, b'' is a byte strin

Re: portable unicode literals

2012-10-15 Thread Steven D'Aprano
On Mon, 15 Oct 2012 15:05:01 +0200, Ulrich Eckhardt wrote: > Hi! > > I need a little nudge in the right direction, as I'm misunderstanding > something concerning string literals in Python 2 and 3. In Python 2.7, > b'' and '' are byte strings, while u'' is a unicode literal. In Python > 3.2, b'' i

portable unicode literals

2012-10-15 Thread Ulrich Eckhardt
Hi! I need a little nudge in the right direction, as I'm misunderstanding something concerning string literals in Python 2 and 3. In Python 2.7, b'' and '' are byte strings, while u'' is a unicode literal. In Python 3.2, b'' is a byte string and '' is a unicode literal, while u'' is a syntax

Re: simple string format question

2012-10-15 Thread Dave Angel
On 10/15/2012 08:29 AM, Chris Rebert wrote: > On Mon, Oct 15, 2012 at 5:12 AM, Neal Becker wrote: >> Is there a way to specify to format I want a floating point written with no >> more >> than e.g., 2 digits after the decimal? I tried {:.2f}, but then I get all >> floats written with 2 digits, e

Re: simple string format question

2012-10-15 Thread Adrien
Le 15/10/2012 14:12, Neal Becker a écrit : Is there a way to specify to format I want a floating point written with no more than e.g., 2 digits after the decimal? I tried {:.2f}, but then I get all floats written with 2 digits, even if they are 0: 2.35 << yes, that's what I want 2.00 << no, I w

Re: simple string format question

2012-10-15 Thread Kamlesh Mutha
There doesn't seem to be any direct way to achieve this. Maybe you can do something like this: import math x = 3.05 if math.modf(x)[0] != 0.0: print x Cheers, -Kamlesh On Mon, Oct 15, 2012 at 5:59 PM, Chris Rebert wrote: > On Mon, Oct 15, 2012 at 5:12 AM, Neal Becker wrote: > > Is ther

Re: simple string format question

2012-10-15 Thread Chris Rebert
On Mon, Oct 15, 2012 at 5:12 AM, Neal Becker wrote: > Is there a way to specify to format I want a floating point written with no > more > than e.g., 2 digits after the decimal? I tried {:.2f}, but then I get all > floats written with 2 digits, even if they are 0: > > 2.35 << yes, that's what I

simple string format question

2012-10-15 Thread Neal Becker
Is there a way to specify to format I want a floating point written with no more than e.g., 2 digits after the decimal? I tried {:.2f}, but then I get all floats written with 2 digits, even if they are 0: 2.35 << yes, that's what I want 2.00 << no, I want just 2 or 2. -- http://mail.python.o

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Roy Smith
In article <1b8tk9-un9@chris.zbmc.eu>, tinn...@isbd.co.uk wrote: > The function producing the error is:- > > def get_text(self, idx): # override ! > node = self.items[idx] > > a= [ > ", ".join(node.tags), > node.comment, >

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Chris Rebert
On Mon, Oct 15, 2012 at 4:23 AM, wrote: > I want to fix an error in some code I have installed, however I don't > really want to just bodge it. "bodge". Well, I learned a new word this morning! > The function producing the error is:- > > def get_text(self, idx): # override ! >

Re: pyw program not displaying unicode characters properly

2012-10-15 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > Classically, NNTP did not have "attachments" as seen in MIME email. NNTP (Network News Transport Protocol) and SMTP (Simple Mail Transfer Protocol) are both just ways of shipping around messages. Neither one really knows about attachments. In bo

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Paul Rubin
tinn...@isbd.co.uk writes: > I want to fix an error in some code I have installed, however I don't > really want to just bodge it. ... > Now its *probably* something higher up the tree causing the problem > (it's only one particular image in 20 thousand or so that breaks > things) but I really want

What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread tinnews
I want to fix an error in some code I have installed, however I don't really want to just bodge it. The function producing the error is:- def get_text(self, idx): # override ! node = self.items[idx] a= [ ", ".join(node.tags), node.comment

Python stand alone Android Apps:)

2012-10-15 Thread michaeldavid1234567
Hi, Cote here, and I'm very pleased to announce that I've ported ALL my sl4a apps to eclipse apk, it embeds with the python interpreter, no need to install anything but the app off google play! I have completed: A) Android Eye (Computer Vision), that takes a picture and tells you what it is (O

Re: Understanding http proxies

2012-10-15 Thread Olive
Thank you for all yours answers. There are very usefull! Olive -- http://mail.python.org/mailman/listinfo/python-list