Re: How to get JSON values and how to trace sessions??

2013-04-23 Thread Tim Roberts
webmas...@terradon.nl wrote: > >But now i am wondering how to trace sessions? it is needed for a >multiplayer game, connected to a webserver. How do i trace a PHP-session? >I suppose i have to save a cookie with the sessionID from the webserver? Yes. The server will send a Set-Cookie: header wit

QTableWidget updating columns in a single row

2013-04-23 Thread Sara Lochtie
I have written a GUI that gets data sent to it in real time and this data is displayed in a table. Every time data is sent in it is displayed in the table in a new row. My problem is that I would like to have the data just replace the old in the first row. The table has 6 columns (A, B, C, D, E

Re: Confusing Algorithm

2013-04-23 Thread Tim Roberts
RBotha wrote: > >I'm facing the following problem: > >""" >In a city of towerblocks, Spiderman can >“cover” all the towers by connecting the >first tower with a spider-thread to the top >of a later tower and then to a next tower >and then to yet another tower until he >reaches the end of the

problem with saving data in a text file

2013-04-23 Thread Debashish Saha
I tried the following: Am_cor=np.vectorize(Am_cor) #plt.plot(t, signal, color='blue', label='Original signal') fig=plt.figure() plt.xlabel('Time(minute)') plt.ylabel('$ Re()$') plt.xlim([t[0], t[-1]]) plt.ylim((-.3*a1-a1,a1+.3*a1)) plt.grid() plt.plot(t,Am_cor(t),'o-',label='with parallax', marke

ANN: MacroPy: bringing Macros to Python

2013-04-23 Thread Haoyi Li
MacroPy is a pure-python library that allows user-defined AST rewrites as part of the import process (using PEP 302). In short, it makes mucking around with Python's semantics so easy as to be almost trivial: you write a function that takes an AST and returns an AST, register it as a macro, and

Re: Reading a CSV file

2013-04-23 Thread Dave Angel
On 04/23/2013 06:40 PM, Ana Dionísio wrote: The condition I want to meet is in the first column, so is there a way to read only the first column and if the condition is true, print the rest? The CSV module will read a row at a time, but nothing gets printed till you print it. So starting wi

Re: List Count

2013-04-23 Thread Steven D'Aprano
On Tue, 23 Apr 2013 17:57:17 +0100, Blind Anagram wrote: > On 23/04/2013 15:49, Steven D'Aprano wrote: >> On Tue, 23 Apr 2013 08:05:53 +0100, Blind Anagram wrote: >> >>> I did a lot of work comparing the overall performance of the sieve >>> when using either lists or arrays and I found that lists

Re: AttributeError Problem

2013-04-23 Thread MRAB
On 24/04/2013 01:28, animemaiden wrote: On Tuesday, April 23, 2013 8:02:08 PM UTC-4, Skip Montanaro wrote: > numberOfVertices = int(infile.readline().decode()) # Read the first line from the file > AttributeError: 'str' object has no attribute 'readline' ... > infile = filedialog.askopen

Re: What is the reason for defining classes within classes in Python?

2013-04-23 Thread alex23
On Apr 24, 9:13 am, vasudevram wrote: > On Wednesday, April 24, 2013 3:52:57 AM UTC+5:30, Ian wrote: > > On Tue, Apr 23, 2013 at 3:50 PM, vasudevram  wrote: > > > I saw an example of defining a class within another class > > > In what way is this useful? > > > In that particular case they're just

Re: AttributeError Problem

2013-04-23 Thread animemaiden
On Tuesday, April 23, 2013 8:02:08 PM UTC-4, Skip Montanaro wrote: > > numberOfVertices = int(infile.readline().decode()) # Read the first line > > from the file > > > AttributeError: 'str' object has no attribute 'readline' > > ... > > > infile = filedialog.askopenfilename() > > > > Thi

Re: AttributeError Problem

2013-04-23 Thread Skip Montanaro
> numberOfVertices = int(infile.readline().decode()) # Read the first line from > the file > AttributeError: 'str' object has no attribute 'readline' ... > infile = filedialog.askopenfilename() This is just returning a filename. You need to open it to get a file object. For example: in

Re: AttributeError Problem

2013-04-23 Thread animemaiden
On Tuesday, April 23, 2013 7:41:27 PM UTC-4, animemaiden wrote: > Hi, > > > > I'm trying to display a graph in Tkinter that reads a graph from a file and > displays it on a panel which the first line in the file contains a number > that indicates the number of vertices (n). The vertices are l

AttributeError Problem

2013-04-23 Thread animemaiden
Hi, I'm trying to display a graph in Tkinter that reads a graph from a file and displays it on a panel which the first line in the file contains a number that indicates the number of vertices (n). The vertices are labeled as 0,1,…,n-1. Each subsequent line, with the format u x y v1, v2, …descr

Re: Reading a CSV file

2013-04-23 Thread Fábio Santos
The enumerate function should allow you to check whether you are in the first iteration. Like so: for row_number, row in enumerate(csv.reader(<...>)): if enumerate == 0: if : break ... Enumerate allows you to know how far into the iterati

Re: What is the reason for defining classes within classes in Python?

2013-04-23 Thread vasudevram
On Wednesday, April 24, 2013 3:52:57 AM UTC+5:30, Ian wrote: > On Tue, Apr 23, 2013 at 3:50 PM, vasudevram wrote: > > > > > > Hi list, > > > > > > I saw an example of defining a class within another class, here, in the > > docs for peewee, a simple ORM for Python: > > > > > > http://peewee.

Re: using pandoc instead of rst to document python

2013-04-23 Thread Peng Yu
On Tue, Apr 23, 2013 at 5:40 PM, R. Michael Weylandt wrote: > On Tue, Apr 23, 2013 at 6:36 PM, Peng Yu wrote: >> Hi, >> >> I'm wondering if it possible to use pandoc instead of rst to document >> python. Is there a documentation system support this format of python >> document? Sorry for the con

Re: Reading a CSV file

2013-04-23 Thread Ana Dionísio
The condition I want to meet is in the first column, so is there a way to read only the first column and if the condition is true, print the rest? -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a CSV file

2013-04-23 Thread Dan Stromberg
On Tue, Apr 23, 2013 at 2:58 PM, Ana Dionísio wrote: > Thank you, but can you explain it a little better? I am just starting in > python and I don't think I understood how to apply your awnser > -- > http://mail.python.org/mailman/listinfo/python-list > #!/usr/local/pypy-1.9/bin/pypy import csv

Re: Nested iteration?

2013-04-23 Thread Oscar Benjamin
On 23 April 2013 22:41, Joshua Landau wrote: > On 23 April 2013 22:29, Oscar Benjamin wrote: >> >> I just thought I'd add that Python 3 has a convenient way to avoid >> this problem with next() which is to use the starred unpacking syntax: >> >> >>> numbers = [1, 2, 3, 4] >> >>> first, *numbers =

Re: using pandoc instead of rst to document python

2013-04-23 Thread R. Michael Weylandt
On Tue, Apr 23, 2013 at 6:36 PM, Peng Yu wrote: > Hi, > > I'm wondering if it possible to use pandoc instead of rst to document > python. Is there a documentation system support this format of python > document? Pandoc is a converter while rst is a format so they're not directly comparable; pando

using pandoc instead of rst to document python

2013-04-23 Thread Peng Yu
Hi, I'm wondering if it possible to use pandoc instead of rst to document python. Is there a documentation system support this format of python document? -- Regards, Peng -- http://mail.python.org/mailman/listinfo/python-list

Re: What is the reason for defining classes within classes in Python?

2013-04-23 Thread Ian Kelly
On Tue, Apr 23, 2013 at 3:50 PM, vasudevram wrote: > > Hi list, > > I saw an example of defining a class within another class, here, in the docs > for peewee, a simple ORM for Python: > > http://peewee.readthedocs.org/en/latest/peewee/quickstart.html > > In what way is this useful? In that parti

Re: Reading a CSV file

2013-04-23 Thread Ana Dionísio
Thank you, but can you explain it a little better? I am just starting in python and I don't think I understood how to apply your awnser -- http://mail.python.org/mailman/listinfo/python-list

What is the reason for defining classes within classes in Python?

2013-04-23 Thread vasudevram
Hi list, I saw an example of defining a class within another class, here, in the docs for peewee, a simple ORM for Python: http://peewee.readthedocs.org/en/latest/peewee/quickstart.html In what way is this useful? Thanks, Vasudev -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a CSV file

2013-04-23 Thread Dan Stromberg
On Tue, Apr 23, 2013 at 2:39 PM, Ana Dionísio wrote: > Hello! > > I need to read a CSV file that has "n" rows and "m" columns and if a > certain condition is met, for exameple n==200, it prints all the columns in > that row. How can I do this? I tried to save all the data in a > multi-dimensional

Re: datetime.strptime() not padding 0's

2013-04-23 Thread Kyle Shannon
On Tue, Apr 23, 2013 at 3:41 PM, Kyle Shannon wrote: > On Tue, Apr 23, 2013 at 3:14 PM, Rodrick Brown > wrote: >> I thought I read some where that strptime() will pad 0's for day's for some >> reason this isnt working for me and I'm wondering if i'm doing something >> wrong. >> > from dateti

Re: datetime.strptime() not padding 0's

2013-04-23 Thread Kyle Shannon
On Tue, Apr 23, 2013 at 3:14 PM, Rodrick Brown wrote: > I thought I read some where that strptime() will pad 0's for day's for some > reason this isnt working for me and I'm wondering if i'm doing something > wrong. > from datetime import datetime dt = datetime.strptime('Apr 9 2013', '%b

Re: Nested iteration?

2013-04-23 Thread Joshua Landau
On 23 April 2013 22:29, Oscar Benjamin wrote: > I just thought I'd add that Python 3 has a convenient way to avoid > this problem with next() which is to use the starred unpacking syntax: > > >>> numbers = [1, 2, 3, 4] > >>> first, *numbers = numbers > That creates a new list every time. You'll

Reading a CSV file

2013-04-23 Thread Ana Dionísio
Hello! I need to read a CSV file that has "n" rows and "m" columns and if a certain condition is met, for exameple n==200, it prints all the columns in that row. How can I do this? I tried to save all the data in a multi-dimensional array but I get this error: "ValueError: array is too big."

Re: datetime.strptime() not padding 0's

2013-04-23 Thread John Gordon
In Rodrick Brown writes: > I thought I read some where that strptime() will pad 0's for day's for some > reason this isnt working for me and I'm wondering if i'm doing something > wrong. > >>> from datetime import datetime > >>> dt = datetime.strptime('Apr 9 2013', '%b %d %Y') > >>> dt.day > 9

Re: Nested iteration?

2013-04-23 Thread Oscar Benjamin
On 23 April 2013 17:30, Ian Kelly wrote: > On Tue, Apr 23, 2013 at 10:21 AM, Chris Angelico wrote: >> The definition of the for loop is sufficiently simple that this is >> safe, with the caveat already mentioned (that __iter__ is just >> returning self). And calling next() inside the loop will si

datetime.strptime() not padding 0's

2013-04-23 Thread Rodrick Brown
I thought I read some where that strptime() will pad 0's for day's for some reason this isnt working for me and I'm wondering if i'm doing something wrong. >>> from datetime import datetime >>> dt = datetime.strptime('Apr 9 2013', '%b %d %Y') >>> dt.day 9 >>> How can I get strptime to run 09? ins

Re: Nested iteration?

2013-04-23 Thread Joshua Landau
On 23 April 2013 21:49, Terry Jan Reedy wrote: > ri= iter(range(3)) > for i in ri: > for j in ri: > print(i,j) > # this is somewhat deceptive as the outer loop executes just once > 0 1 > 0 2 > > I personally would add a 'break' after 'outer_line = next(f)', since the > first loop is e

Re: Nested iteration?

2013-04-23 Thread Terry Jan Reedy
On 4/23/2013 11:40 AM, Roy Smith wrote: In reviewing somebody else's code today, I found the following construct (eliding some details): f = open(filename) for line in f: if re.search(pattern1, line): outer_line = f.next() for inner_line in f:

Re: List Count

2013-04-23 Thread Blind Anagram
On 23/04/2013 21:00, Terry Jan Reedy wrote: > On 4/23/2013 12:57 PM, Blind Anagram wrote: > >> So, all I was doing in asking for advice was to check whether there is >> an easy way of avoiding the slice copy, > > And there is. > >> not because this is critical, >> but rather because it is a pity

Re: List Count

2013-04-23 Thread Oscar Benjamin
On 23 April 2013 21:00, Terry Jan Reedy wrote: > > That said, I do see that tuple/list.index have had start, stop paramaters > added, so doing the same for .count is conceivable. Are those new? I don't remember them not being there. You need the start/stop parameters to be able to use index for

ANN: template-engine pyratemp 0.3.0/0.2.3

2013-04-23 Thread Roland Koebler
Hi, since there were some questions about template-engines some time ago, I would like to announce: - I updated my comparison and benchmarks of several template-engines on http://www.simple-is-better.org/template/ - I have released a new version of my small and simple but powerful and pythoni

Re: List Count

2013-04-23 Thread Terry Jan Reedy
On 4/23/2013 12:57 PM, Blind Anagram wrote: So, all I was doing in asking for advice was to check whether there is an easy way of avoiding the slice copy, And there is. not because this is critical, but rather because it is a pity to limit the performance because Python forces a (strictly un

Re: Lists and arrays

2013-04-23 Thread Denis McMahon
On Mon, 22 Apr 2013 11:13:38 -0700, Ana Dionísio wrote: > I have an array and I need pick some data from that array and put it in > a list, for example: > > array= [a,b,c,1,2,3] > > list=array[0]+ array[3]+ array[4] > > list: [a,1,2] > > When I do it like this: list=array[0]+ array[3]+ array[4

Re: List Count

2013-04-23 Thread Oscar Benjamin
On 23 April 2013 19:30, Blind Anagram wrote: > On 23/04/2013 18:45, Oscar Benjamin wrote: > > [snip] >> You keep mentioning that you want it to work with a large sieve. I >> would much rather compute the same quantities with a small sieve if >> possible. If you were using the Lehmer/Meissel algori

Re: List Count

2013-04-23 Thread Terry Jan Reedy
On 4/23/2013 7:45 AM, Blind Anagram wrote: I then wondered why count for lists has no limits Probably because no one has asked for such, as least partly because it is not really needed. In any case, .count(s) is a generic method. It is part of the definition of a Sequence. It can also be imp

Re: List Count

2013-04-23 Thread Blind Anagram
On 23/04/2013 18:45, Oscar Benjamin wrote: I did a lot of work comparing the overall performance of the sieve when using either lists or arrays and I found that lists were a lot faster for the majority use case when the sieve is not large. >>> >>> And when the sieve is large? >> >>

Re: List Count

2013-04-23 Thread Oscar Benjamin
On 23 April 2013 17:57, Blind Anagram wrote: > On 23/04/2013 15:49, Steven D'Aprano wrote: >> On Tue, 23 Apr 2013 08:05:53 +0100, Blind Anagram wrote: >> >>> I did a lot of work comparing the overall performance of the sieve when >>> using either lists or arrays and I found that lists were a lot f

Re: pip does not find packages

2013-04-23 Thread rusi
On Apr 22, 2:03 pm, Olive wrote: > I am using virtualenv and pip (from archlinux). What I have done: > virtualenv was installed by my distribution. I have made a virtual > environment and activate it, it has installed pip, so far so good. > > Now I am trying to install package in the virtualenvir

Re: List Count

2013-04-23 Thread Blind Anagram
On 23/04/2013 15:49, Steven D'Aprano wrote: > On Tue, 23 Apr 2013 08:05:53 +0100, Blind Anagram wrote: > >> I did a lot of work comparing the overall performance of the sieve when >> using either lists or arrays and I found that lists were a lot faster >> for the majority use case when the sieve i

Re: Nested iteration?

2013-04-23 Thread Steven D'Aprano
On Wed, 24 Apr 2013 02:42:41 +1000, Chris Angelico wrote: > I love this list. If I make a mistake, it's sure to be caught by someone > else. No it's not! Are-you-here-for-the-five-minute-argument-or-the-full-ten-minutes-ly y'rs, -- Steven -- http://mail.python.org/mailman/listinfo/python-li

Re: Nested iteration?

2013-04-23 Thread Chris Angelico
On Wed, Apr 24, 2013 at 2:30 AM, Ian Kelly wrote: > On Tue, Apr 23, 2013 at 10:21 AM, Chris Angelico wrote: >> The definition of the for loop is sufficiently simple that this is >> safe, with the caveat already mentioned (that __iter__ is just >> returning self). And calling next() inside the loo

Re: Nested iteration?

2013-04-23 Thread Ian Kelly
On Tue, Apr 23, 2013 at 10:30 AM, Ian Kelly wrote: > On Tue, Apr 23, 2013 at 10:21 AM, Chris Angelico wrote: >> The definition of the for loop is sufficiently simple that this is >> safe, with the caveat already mentioned (that __iter__ is just >> returning self). And calling next() inside the lo

Re: Nested iteration?

2013-04-23 Thread Steven D'Aprano
On Tue, 23 Apr 2013 11:40:31 -0400, Roy Smith wrote: > In reviewing somebody else's code today, I found the following construct > (eliding some details): > > f = open(filename) > for line in f: > if re.search(pattern1, line): > outer_line = f.next() > for i

Re: Nested iteration?

2013-04-23 Thread Ian Kelly
On Tue, Apr 23, 2013 at 10:21 AM, Chris Angelico wrote: > The definition of the for loop is sufficiently simple that this is > safe, with the caveat already mentioned (that __iter__ is just > returning self). And calling next() inside the loop will simply > terminate the loop if there's nothing th

احلى مجموعة كفرات فيس بوك facebook covers 2013

2013-04-23 Thread 23alagmy
احلى مجموعة كفرات فيس بوك facebook covers 2013 http://natigtas7ab.blogspot.com/2013/04/facebook-covers-2013.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested iteration?

2013-04-23 Thread Chris Angelico
On Wed, Apr 24, 2013 at 1:40 AM, Roy Smith wrote: > In reviewing somebody else's code today, I found the following > construct (eliding some details): > > f = open(filename) > for line in f: > if re.search(pattern1, line): > outer_line = f.next() > for inner

Re: Nested iteration?

2013-04-23 Thread Peter Otten
Roy Smith wrote: > In reviewing somebody else's code today, I found the following > construct (eliding some details): > > f = open(filename) > for line in f: > if re.search(pattern1, line): > outer_line = f.next() > for inner_line in f: > if re.search(patte

Re: Nested iteration?

2013-04-23 Thread Ian Kelly
On Tue, Apr 23, 2013 at 9:40 AM, Roy Smith wrote: > In reviewing somebody else's code today, I found the following > construct (eliding some details): > > f = open(filename) > for line in f: > if re.search(pattern1, line): > outer_line = f.next() > for inner

Re: Nested iteration?

2013-04-23 Thread Oscar Benjamin
On 23 April 2013 16:40, Roy Smith wrote: > In reviewing somebody else's code today, I found the following > construct (eliding some details): > > f = open(filename) > for line in f: > if re.search(pattern1, line): > outer_line = f.next() > for inner_line in

Re: Selenium Webdriver + Python (How to get started ??)

2013-04-23 Thread Santi
On Monday, April 22, 2013 8:24:40 AM UTC-4, arif7...@gmail.com wrote: > Note that:- I have some experience of using Selenium IDE and Webdriver > (Java). but no prior experience of Python. > > > > Now there is a project for which I will need to work with webdriver + Python. > > > > So far I

Nested iteration?

2013-04-23 Thread Roy Smith
In reviewing somebody else's code today, I found the following construct (eliding some details): f = open(filename) for line in f: if re.search(pattern1, line): outer_line = f.next() for inner_line in f: if re.search(pattern2, inner_line):

Re: percent faster than format()?

2013-04-23 Thread Lele Gaifax
Ulrich Eckhardt writes: > So again, why is one faster than the other? What am I missing? The .format() syntax is actually a function, and that alone carries some overload. Even optimizing the lookup may give a little advantage: >>> from timeit import Timer >>> setup = "a = 'spam'; b = 'ham'; c

Re: percent faster than format()?

2013-04-23 Thread Ulrich Eckhardt
Am 23.04.2013 10:26, schrieb Chris “Kwpolska” Warrick: On Tue, Apr 23, 2013 at 9:46 AM, Ulrich Eckhardt wrote: Am 23.04.2013 06:00, schrieb Steven D'Aprano: If it comes down to micro-optimizations to shave a few microseconds off, consider using string % formatting rather than the format metho

Finding referents with Gdb

2013-04-23 Thread Dave Butler
with gdb, can you find referents of an object given an object id? -- http://mail.python.org/mailman/listinfo/python-list

Re: There must be a better way (correction)

2013-04-23 Thread Tim Chase
On 2013-04-23 09:30, Tim Chase wrote: > > But a csv.DictReader might still be more efficient. I never > > tested. This is the only place I've used this "optimization". > > It's fast enough. ;) > > I believe the csv module does all the work at c-level, rather than > as pure Python, so it should be

Re: percent faster than format()? (was: Re: optomizations)

2013-04-23 Thread Chris Angelico
On Wed, Apr 24, 2013 at 12:36 AM, Steven D'Aprano wrote: > # Using Python 3.3. > > py> from timeit import Timer > py> setup = "a = 'spam'; b = 'ham'; c = 'eggs'" > py> t1 = Timer("'%s, %s and %s for breakfast' % (a, b, c)", setup) > py> t2 = Timer("'{}, {} and {} for breakfast'.format(a, b, c)", s

Re: List Count

2013-04-23 Thread Steven D'Aprano
On Tue, 23 Apr 2013 08:05:53 +0100, Blind Anagram wrote: > I did a lot of work comparing the overall performance of the sieve when > using either lists or arrays and I found that lists were a lot faster > for the majority use case when the sieve is not large. And when the sieve is large? I don't

Re: percent faster than format()? (was: Re: optomizations)

2013-04-23 Thread Steven D'Aprano
On Tue, 23 Apr 2013 09:46:53 +0200, Ulrich Eckhardt wrote: > Am 23.04.2013 06:00, schrieb Steven D'Aprano: >> If it comes down to micro-optimizations to shave a few microseconds >> off, consider using string % formatting rather than the format method. > > Why? I don't see any obvious difference b

Re: There must be a better way

2013-04-23 Thread Skip Montanaro
> But a csv.DictReader might still be more efficient. Depends on what efficiency you care about. The DictReader class is implemented in Python, and builds a dict for every row. It will never be more efficient CPU-wise than instantiating the csv.reader type directly and only doing what you need.

distutils and libraries

2013-04-23 Thread Nick Gnedin
Folks, I would like to install a Python module from a complete library. So, my question: if I already have a fully build Python module libMyModule.so, is there a way to use setup.py to just install it, skipping the build step? Here are details if needed: My build process consists of 2 steps

Re: There must be a better way

2013-04-23 Thread Tim Chase
On 2013-04-23 13:36, Neil Cerutti wrote: > On 2013-04-22, Colin J. Williams wrote: > > Since I'm only interested in one or two columns, the simpler > > approach is probably better. > > Here's a sketch of how one of my projects handles that situation. > I think the index variables are invaluable d

Re: There must be a better way

2013-04-23 Thread Oscar Benjamin
On 23 April 2013 14:36, Neil Cerutti wrote: > On 2013-04-22, Colin J. Williams wrote: >> Since I'm only interested in one or two columns, the simpler >> approach is probably better. > > Here's a sketch of how one of my projects handles that situation. > I think the index variables are invaluable

Re: There must be a better way

2013-04-23 Thread Neil Cerutti
On 2013-04-22, Colin J. Williams wrote: > Since I'm only interested in one or two columns, the simpler > approach is probably better. Here's a sketch of how one of my projects handles that situation. I think the index variables are invaluable documentation, and make it a bit more robust. (Python

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread Dave Angel
On 04/23/2013 02:58 AM, inshu chauhan wrote: Yes Simultaneously means all three running at the same time, I looked up zip just now, but will it not disturb my dictionaries ? And yes the dictionaries have same number of keys. More crucially, do all the dictionaries have the *same* keys? If so,

Re: Remove some images from a mail message

2013-04-23 Thread Jason Friedman
This seemed to work. #!/usr/bin/env python3 from email.mime.image import MIMEImage from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.iterators import typed_subpart_iterator from email.generator import Generator, BytesGenerator import email.iterators imp

Re: Ubuntu package "python3" does not include tkinter

2013-04-23 Thread rusi
On Apr 23, 11:44 am, Rui Maciel wrote: > Steven D'Aprano wrote: > > Nobody forces you to do anything. Python is open source, and the source > > code is freely available. > > That goes both ways, with the added benefit that python-tkinter is already > available in distro's official repositories.  I

Re: List Count

2013-04-23 Thread Blind Anagram
On 23/04/2013 12:08, Oscar Benjamin wrote: > On 23 April 2013 08:05, Blind Anagram wrote: >> On 23/04/2013 00:01, Steven D'Aprano wrote: >>> On Mon, 22 Apr 2013 15:15:19 +0100, Blind Anagram wrote: >>> But when using a sub-sequence, I do suffer a significant reduction in speed for a coun

Re: xlrd 0.9.2 released!

2013-04-23 Thread Karim
Thx ! I will update my 0.6 version! Cheers Karim On 09/04/2013 21:38, Chris Withers wrote: Hi All, I'm pleased to announce the release of xlrd 0.9.2: http://pypi.python.org/pypi/xlrd/0.9.2 This release includes the following changes: - Fix some packaging issues that meant docs and examples

Re: xlrd 0.9.2 released!

2013-04-23 Thread Ondrej Ján
Hello. Can you please tell me, how compatible is this version with older versions? In Fedora/CentOS we have versions 0.7 and 0.6. Can I release and Fedora/EPEL update to 0.9.2? Thank you. SAL Dňa utorok, 9.

Re: List Count

2013-04-23 Thread Oscar Benjamin
On 23 April 2013 08:05, Blind Anagram wrote: > On 23/04/2013 00:01, Steven D'Aprano wrote: >> On Mon, 22 Apr 2013 15:15:19 +0100, Blind Anagram wrote: >> >>> But when using a sub-sequence, I do suffer a significant reduction in >>> speed for a count when compared with count on the full list. When

Re: optomizations

2013-04-23 Thread Chris Angelico
On Tue, Apr 23, 2013 at 11:53 AM, Roy Smith wrote: > In article , > Rodrick Brown wrote: > >> I would like some feedback on possible solutions to make this script run >> faster. > > If I had to guess, I would think this stuff: > >> line = line.replace('mediacdn.xxx.com', 'med

Re: Serial Port Issue

2013-04-23 Thread Chris “Kwpolska” Warrick
On Mon, Apr 22, 2013 at 11:34 AM, chandan kumar wrote: > Python Ver: 2.5 Old. Please upgrade to 2.7.4 ASAP. > ser=ser=serial.Serial(port=21,baudrate=9600) That double `ser=` thing is not necessary. It should only be `ser = serial.Serial(port=21, baudrate=9600)`. Look at Phil Birkelbach’s pos

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread Duncan Booth
inshu chauhan wrote: > This statement is giving me the following error > > Statement: > for p, k, j in zip(sorted(segments.iterkeys(), class_count.iterkeys(), > pixel_count.iterkeys())): > > Error: > Traceback (most recent call last): > File "C:\Users\inshu\Desktop\Training_segs_trial2.py", l

Re: percent faster than format()? (was: Re: optomizations)

2013-04-23 Thread Chris “Kwpolska” Warrick
On Tue, Apr 23, 2013 at 9:46 AM, Ulrich Eckhardt wrote: > Am 23.04.2013 06:00, schrieb Steven D'Aprano: >> >> If it comes down to micro-optimizations to shave a few microseconds off, >> consider using string % formatting rather than the format method. > > > Why? I don't see any obvious difference

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread Ulrich Eckhardt
Am 23.04.2013 09:13, schrieb inshu chauhan: This statement is giving me the following error Statement: for p, k, j in zip(sorted(segments.iterkeys(), class_count.iterkeys(), pixel_count.iterkeys())): Error: Traceback (most recent call last): File "C:\Users\inshu\Desktop\Training_segs_trial2.

percent faster than format()? (was: Re: optomizations)

2013-04-23 Thread Ulrich Eckhardt
Am 23.04.2013 06:00, schrieb Steven D'Aprano: If it comes down to micro-optimizations to shave a few microseconds off, consider using string % formatting rather than the format method. Why? I don't see any obvious difference between the two... Greetings! Uli -- http://mail.python.org/mailma

Re: Lists and arrays

2013-04-23 Thread 88888 Dihedral
Ana Dionísio於 2013年4月23日星期二UTC+8上午2時13分38秒寫道: > Hello! > > > > I need your help! > > > > I have an array and I need pick some data from that array and put it in a > list, for example: > > > > array= [a,b,c,1,2,3] > > > > list=array[0]+ array[3]+ array[4] > > > > list: [a,1,2] > >

Re: Ubuntu package "python3" does not include tkinter

2013-04-23 Thread Chris Angelico
On Tue, Apr 23, 2013 at 4:48 PM, Rui Maciel wrote: > Chris Angelico wrote: > >> 30 years ago, people weren't using Tk. > > And after 30 years gone by, some people still don't use Tk, let alone > Tkinter. There is absolutely no reason to force them to install that if > they don't need to. Agreed;

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread Chris Angelico
On Tue, Apr 23, 2013 at 5:13 PM, inshu chauhan wrote: > This statement is giving me the following error > > Statement: > for p, k, j in zip(sorted(segments.iterkeys(), class_count.iterkeys(), > pixel_count.iterkeys())): You probably want to sort them separately. By the way, using iterkeys() isn't

Re: Ubuntu package "python3" does not include tkinter

2013-04-23 Thread Andrew Berg
On 2013.04.23 00:49, Steven D'Aprano wrote: > Obviously you cannot display an X window without > X, well duh, but merely importing tkinter doesn't require an X display. Importing it doesn't. Doing anything useful with it, however, does. Would you consider the engine an optional part of a car? Af

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread inshu chauhan
This statement is giving me the following error Statement: for p, k, j in zip(sorted(segments.iterkeys(), class_count.iterkeys(), pixel_count.iterkeys())): Error: Traceback (most recent call last): File "C:\Users\inshu\Desktop\Training_segs_trial2.py", line 170, in access_segments(segimage

Re: List Count

2013-04-23 Thread Blind Anagram
On 23/04/2013 00:01, Steven D'Aprano wrote: > On Mon, 22 Apr 2013 15:15:19 +0100, Blind Anagram wrote: > >> But when using a sub-sequence, I do suffer a significant reduction in >> speed for a count when compared with count on the full list. When the >> list is small enough not to cause memory al

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread inshu chauhan
Thanks Gary. > > Be clearer about the problem please. > > Do you wish to produce a loop that: > On pass 1, each of p,k, and t hold the first item of their respective > lists, and > on pass 2, each of p,k, and t hold the second item of their respective > lists, and > so on > until one (or a

Re: List Count

2013-04-23 Thread Blind Anagram
On 23/04/2013 02:47, Dave Angel wrote: > On 04/22/2013 05:32 PM, Blind Anagram wrote: >> On 22/04/2013 22:03, Oscar Benjamin wrote: >>> On 22 April 2013 21:18, Oscar Benjamin >>> wrote: On 22 April 2013 17:38, Blind Anagram wrote: > On 22/04/2013 17:06, Oscar Benjamin wrote: > >>

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread inshu chauhan
zip isn't doing the required On Tue, Apr 23, 2013 at 12:28 PM, inshu chauhan wrote: > Yes Simultaneously means all three running at the same time, I looked up > zip just now, but will it not disturb my dictionaries ? > And yes the dictionaries have same number of keys. > > thanks > > > On Tue, A

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread Gary Herron
On 04/22/2013 11:40 PM, inshu chauhan wrote: i have to implement the below line in one of my code: for p in sorted(segments.iterkeys()) and for k in sorted(class_count.iterkeys()) and for j in sorted(pixel_count.iterkeys()): Its giving me a syntax error which is obvious, but how can I make

Re: List Count

2013-04-23 Thread Blind Anagram
On 23/04/2013 00:28, Steven D'Aprano wrote: > On Mon, 22 Apr 2013 22:25:50 +0100, Blind Anagram wrote: > >> I have looked at solutions based on listing primes and here I have found >> that they are very much slower than my existing solution when the sieve >> is not large (which is the majority use

Re: Ubuntu package "python3" does not include tkinter

2013-04-23 Thread Rui Maciel
Steven D'Aprano wrote: > No, the job of the package system is to manage dependencies. It makes no > guarantee about whether or not something will "work". The purpose of establishing dependencies is to guarantee that once a software package is installed, all the necessary components needed for it

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread inshu chauhan
Yes Simultaneously means all three running at the same time, I looked up zip just now, but will it not disturb my dictionaries ? And yes the dictionaries have same number of keys. thanks On Tue, Apr 23, 2013 at 12:16 PM, Chris Angelico wrote: > On Tue, Apr 23, 2013 at 4:40 PM, inshu chauhan >

Re: Ubuntu package "python3" does not include tkinter

2013-04-23 Thread Rui Maciel
Chris Angelico wrote: > 30 years ago, people weren't using Tk. And after 30 years gone by, some people still don't use Tk, let alone Tkinter. There is absolutely no reason to force them to install that if they don't need to. > We've moved on beyond worrying about the odd kilobyte of space.