What's correct Python syntax?

2014-01-14 Thread Igor Korot
Hi, ALL, I'm trying to process a file which has following lines: 192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200, length 30 (this is the text file out of tcpdump) Now I can esily split the line twice: once by ':' symbol to separate address and the protocol information and the secon

Re: What's correct Python syntax?

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 2:16:56 PM UTC+5:30, Igor Korot wrote: > Hi, ALL, > I'm trying to process a file which has following lines: > > 192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200, length 30 > > (this is the text file out of tcpdump) > > > Now I can esily split the line t

Re: What's correct Python syntax?

2014-01-14 Thread Chris Angelico
On Tue, Jan 14, 2014 at 7:46 PM, Igor Korot wrote: > 192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200, length 30 > > However, I don't need all the protocol info. All I'm interested in is > the last field, which is length. You can split on any string. If you're confident that this is

Re: What's correct Python syntax?

2014-01-14 Thread Igor Korot
Hi, Rustom, On Tue, Jan 14, 2014 at 12:54 AM, Rustom Mody wrote: > On Tuesday, January 14, 2014 2:16:56 PM UTC+5:30, Igor Korot wrote: >> Hi, ALL, >> I'm trying to process a file which has following lines: >> >> 192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200, length 30 >> >> (this

Re: plotting slows down

2014-01-14 Thread Dave Angel
Norman Elliott Wrote in message: > > I cannot see how to change from html to text mode in chromium or within the > group. > You already did post in text mode, my error. The new newsreader I'm using apparently eats tabs. -- DaveA Android NewsGroup Reader http://www.piaohong.tk/ne

Re:plotting slows down

2014-01-14 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Mon, 13 Jan 2014 08:26:11 -0500, Dave Angel wrote: > >> norman.elli...@gmail.com Wrote in message: > >>> [code] >>> #!/usr/bin/python >>> from graphics import * >> >> First things first. what operating system are you using, and >> where did you get the

Re: What's correct Python syntax?

2014-01-14 Thread Mark Lawrence
On 14/01/2014 09:25, Igor Korot wrote: Hi, Rustom, On Tue, Jan 14, 2014 at 12:54 AM, Rustom Mody wrote: On Tuesday, January 14, 2014 2:16:56 PM UTC+5:30, Igor Korot wrote: Hi, ALL, I'm trying to process a file which has following lines: 192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, s

Re: What's correct Python syntax?

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 2:55:00 PM UTC+5:30, Igor Korot wrote: > > What if I want field 2 and field 3? ("seq 200" and "length 30") Wee you did say: > I'm interesred in only one element, so why should care about everything else? So its not clear what you want! Do you want a one-liner? You

Re: What's correct Python syntax?

2014-01-14 Thread Jussi Piitulainen
Chris Angelico writes: > Alternatively, you can split on the space and take just the very > last word: > > for data in f: > length = data.split(" ")[-1] > # process length Also, data.rsplit(' ', 1) will split data in two at the last space. help(str.rsplit) -- https://mail.python.org/ma

Re: What's correct Python syntax?

2014-01-14 Thread Igor Korot
Hi, Rustom, On Tue, Jan 14, 2014 at 1:37 AM, Rustom Mody wrote: > On Tuesday, January 14, 2014 2:55:00 PM UTC+5:30, Igor Korot wrote: >> >> What if I want field 2 and field 3? ("seq 200" and "length 30") > > Wee you did say: > >> I'm interesred in only one element, so why should care about everyt

Fwd: What's correct Python syntax?

2014-01-14 Thread Igor Korot
Sorry, that was sent to Mark directly. Resending to the list. -- Forwarded message -- From: Igor Korot Date: Tue, Jan 14, 2014 at 1:50 AM Subject: Re: What's correct Python syntax? To: Mark Lawrence Hi, Mark, On Tue, Jan 14, 2014 at 1:37 AM, Mark Lawrence wrote: > On 14/01/2

Re: What's correct Python syntax?

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 3:32:24 PM UTC+5:30, Igor Korot wrote: > Hi, Rustom, > On Tue, Jan 14, 2014 at 1:37 AM, Rustom Mody wrote: > > On Tuesday, January 14, 2014 2:55:00 PM UTC+5:30, Igor Korot wrote: > >> What if I want field 2 and field 3? ("seq 200" and "length 30") > > Wee you did say:

Re: What's correct Python syntax?

2014-01-14 Thread Igor Korot
Hi, Rustom, On Tue, Jan 14, 2014 at 2:16 AM, Rustom Mody wrote: > On Tuesday, January 14, 2014 3:32:24 PM UTC+5:30, Igor Korot wrote: >> Hi, Rustom, > >> On Tue, Jan 14, 2014 at 1:37 AM, Rustom Mody wrote: >> > On Tuesday, January 14, 2014 2:55:00 PM UTC+5:30, Igor Korot wrote: >> >> What if I w

Re: L[:]

2014-01-14 Thread Albert-Jan Roskam
On 1/13/2014 4:00 AM, Laszlo Nagy wrote: > >> Unless L is aliased, this is silly code. > There is another use case. If you intend to modify a list within a for > loop that goes over the same list, then you need to iterate over a copy. > And this cannot be called an "alias" because it has

Re: What's correct Python syntax?

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 4:05:27 PM UTC+5:30, Igor Korot wrote: > Hi, Rustom, > > > > On Tue, Jan 14, 2014 at 2:16 AM, Rustom Mody wrote: > > You want this? > > > test = "I,like,my,chocolate" > test.split(',') > > ['I', 'like', 'my', 'chocolate'] > test.split(',')[2:4] > > ['m

Re: What's correct Python syntax?

2014-01-14 Thread Alister
On Tue, 14 Jan 2014 00:46:56 -0800, Igor Korot wrote: > Hi, ALL, > I'm trying to process a file which has following lines: > > 192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200, length 30 > > (this is the text file out of tcpdump) > > Now I can esily split the line twice: once by ':

Stopping a wsgiref server programmatically

2014-01-14 Thread Gilles Lenfant
Hi, I made a small / minimal wsgiref HTTP server dedicated to unittest stubs (testing custom REST client and other likes) that works pretty good in a separate thread. https://gist.github.com/glenfant/7369894 Feel free to reuse it in your own unittest stubs/mocks. But it only works like a char

Re: What's correct Python syntax?

2014-01-14 Thread Peter Otten
Igor Korot wrote: > I am actually looking for a way to get a result from split which is > sliced the way I want. Like in my example above. > I mean I can probably make more variable by creating a tuple, but why? > What is the purpose if I want only couple elements out of split. > Doing it Perl way

Re: What's correct Python syntax?

2014-01-14 Thread Ned Batchelder
On 1/14/14 6:33 AM, Peter Otten wrote: Python has no dedicated syntax for picking arbitrary items from a list If you are only concerned about printing use format(): >>>items = ["alpha", "beta", "gamma", "delta"] >>>print "{1} {3} {0}".format(*items) beta delta alpha .format also supports ite

a web UI to invoke a python script at server side

2014-01-14 Thread Frank Cui
Hey guys, I'm working on to provide a lightweight web UI for providing an interface to invoke a python script(a sequential script which could involve some system calls) at the server side. The UI should collect some parameters for input into this python script, and conversely the output of the s

Re: plotting slows down

2014-01-14 Thread Norman Elliott
@Dave, no problem. I am using gedit to write the files and have it set to translate tabs into 4 spaces which is what was recommended to me as the right amount of indenting for python scripts. On Monday, 13 January 2014 08:15:08 UTC, Norman Elliott wrote: > First let me say I have not done much

Re: plotting slows down

2014-01-14 Thread Rustom Mody
On Tuesday, January 14, 2014 6:34:43 PM UTC+5:30, Norman Elliott wrote: > @Dave, no problem. I am using gedit to write the files and have it set to > translate tabs into 4 spaces which is what was recommended to me as the right > amount of indenting for python scripts. Dunno what you mean by 'tr

Re: a web UI to invoke a python script at server side

2014-01-14 Thread Jean-Michel Pichavant
- Original Message - > Hey guys, > I'm working on to provide a lightweight web UI for providing an > interface to invoke a python script(a sequential script which could > involve some system calls) at the server side. The UI should collect > some parameters for input into this python sc

Re: What's correct Python syntax?

2014-01-14 Thread Roy Smith
In article , Igor Korot wrote: > Hi, ALL, > I'm trying to process a file which has following lines: > > 192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200, length 30 > > (this is the text file out of tcpdump) > > Now I can esily split the line twice: once by ':' symbol to separate

Re: plotting slows down

2014-01-14 Thread Chris Angelico
On Wed, Jan 15, 2014 at 12:15 AM, Rustom Mody wrote: > However it can also mean that gedit sets tabstops at 4 character intervals > Which will mean you will see 4 characters (in gedit) and everyone else will > see a > tab. This is a recipe for trouble. Not a recipe for trouble normally, it's jus

Re: What's correct Python syntax?

2014-01-14 Thread Roy Smith
In article , Igor Korot wrote: > I can do it this way: > > >>> testlist = test.split(',') > >>> print testlist[2] > my > > but it will needlessly creates a list on which I will access by the index. Stop worrying about needlessly creating lists. Write the code in a way that works and is easy

Python Fast I/o

2014-01-14 Thread Ayushi Dalmia
I need to write into a file for a project which will be evaluated on the basis of time. What is the fastest way to write 200 Mb of data, accumulated as a list into a file. Presently I am using this: with open('index.txt','w') as f: f.write("".join(data)) f.close() where data is a l

Re: Python Fast I/o

2014-01-14 Thread Chris Angelico
On Wed, Jan 15, 2014 at 12:50 AM, Ayushi Dalmia wrote: > I need to write into a file for a project which will be evaluated on the > basis of time. What is the fastest way to write 200 Mb of data, accumulated > as a list into a file. > > Presently I am using this: > > with open('index.txt','w') a

Re: efficient way to process data

2014-01-14 Thread Larry Martell
On Mon, Jan 13, 2014 at 11:32 AM, Chris Angelico wrote: > On Tue, Jan 14, 2014 at 5:27 AM, Larry Martell > wrote: >> Thanks. Unfortunately this has been made a low priority task and I've >> been put on to something else (I hate when they do that). > > Ugh, I know that feeling all too well! Life'

Re: Python Fast I/o

2014-01-14 Thread Ayushi Dalmia
On Tuesday, January 14, 2014 7:33:08 PM UTC+5:30, Chris Angelico wrote: > On Wed, Jan 15, 2014 at 12:50 AM, Ayushi Dalmia > > wrote: > > > I need to write into a file for a project which will be evaluated on the > > basis of time. What is the fastest way to write 200 Mb of data, accumulated >

Re: efficient way to process data

2014-01-14 Thread Chris Angelico
On Wed, Jan 15, 2014 at 1:18 AM, Larry Martell wrote: > if you're interested in what the application is, this is data > collected with an electron microscope from semiconductor wafers as > they are being manufactured. The x and y are the position on the wafer > that the data was collected, in micr

Re: Python Fast I/o

2014-01-14 Thread Chris Angelico
On Wed, Jan 15, 2014 at 1:24 AM, Ayushi Dalmia wrote: > On Tuesday, January 14, 2014 7:33:08 PM UTC+5:30, Chris Angelico wrote: >> On Wed, Jan 15, 2014 at 12:50 AM, Ayushi Dalmia >> >> wrote: >> >> > I need to write into a file for a project which will be evaluated on the >> > basis of time. Wha

Re: Python Fast I/o

2014-01-14 Thread Roy Smith
In article <53affb01-0c5e-46e3-9ff7-27a529db6...@googlegroups.com>, Ayushi Dalmia wrote: > Which is more fast? > Creating a 200 Mb string and then dumping into a file or dividing the 200 Mb > string into chunks and then writing those chunks. Won't writing the chunks > call more i/o operation?

Re: Python Fast I/o

2014-01-14 Thread Tim Chase
On 2014-01-14 05:50, Ayushi Dalmia wrote: > I need to write into a file for a project which will be evaluated > on the basis of time. What is the fastest way to write 200 Mb of > data, accumulated as a list into a file. > > Presently I am using this: > > with open('index.txt','w') as f: > f

wx (not responding)

2014-01-14 Thread ngangsia akumbo
When i run this code on my pc it actually runs but signals that the app is not responding. import wx class Example(wx.Frame): def __init__(self, *args, **kwargs): super(Example, self).__init__(*args, **kwargs) self.InitUI()

Re: wx (not responding)

2014-01-14 Thread Frank Miles
On Tue, 14 Jan 2014 07:26:10 -0800, ngangsia akumbo wrote: > When i run this code on my pc it actually runs but signals that the app is > not responding. [snip most of the code]- > def main(): > ex = wx.App() > Example(None) > ex.Mainloop() > > > if __name__ == "__main__": > m

Re: efficient way to process data

2014-01-14 Thread Larry Martell
On Tue, Jan 14, 2014 at 7:26 AM, Chris Angelico wrote: > On Wed, Jan 15, 2014 at 1:18 AM, Larry Martell > wrote: >> if you're interested in what the application is, this is data >> collected with an electron microscope from semiconductor wafers as >> they are being manufactured. The x and y are

Encoding trouble when script called from application

2014-01-14 Thread Florian Lindner
Hello! I'm using python 3.2.3 on debian wheezy. My script is called from my mail delivery agent (MDA) maildrop (like procmail) through it's xfilter directive. Script works fine when used interactively, e.g. ./script.py < testmail but when called from maildrop it's producing an infamous UnicodeD

Re: efficient way to process data

2014-01-14 Thread Chris Angelico
On Wed, Jan 15, 2014 at 3:23 AM, Larry Martell wrote: >> As far as I'm concerned, you won geek cred the moment you said >> "electron microscope", and "semiconductor wafers as they are being >> manufactured" is just gravy. > > Thanks! You made my day. I showed this to my wife and she asked "Is that

python-list@python.org

2014-01-14 Thread MRAB
On 2014-01-14 16:37, Florian Lindner wrote: Hello! I'm using python 3.2.3 on debian wheezy. My script is called from my mail delivery agent (MDA) maildrop (like procmail) through it's xfilter directive. Script works fine when used interactively, e.g. ./script.py < testmail but when called fro

ANN: Python Events Calendar - Please submit your 2014 events

2014-01-14 Thread M.-A. Lemburg
[Please help spread the word by forwarding to other relevant mailing lists, user groups, etc. world-wide; thanks :-)] ANNOUNCING Python Events Calendars - Please submit your 2014 events maintained by th

Re: plotting slows down

2014-01-14 Thread Norman Elliott
On Monday, 13 January 2014 08:15:08 UTC, Norman Elliott wrote: > First let me say I have not done much python programming! > > I am running Python 2.7.3. > > I am trying to use python as a front end to a simple oscilloscope. > > Ultimately I intend to use it with my micropython board. > > >

python adsl script

2014-01-14 Thread ngangsia akumbo
what about a python script that can retrieve my entire isp setting from my adsl router. Any ideas Also my grand mother forget her computer password, she can only login through the guest account. what about a script that can solve that problem. -- https://mail.python.org/mailman/listinfo/python

Re: python adsl script

2014-01-14 Thread Denis McMahon
On Tue, 14 Jan 2014 09:27:07 -0800, ngangsia akumbo wrote: > what about a python script that can retrieve my entire isp setting from > my adsl router. > Any ideas This is probably possible using telnet, so it should be possible to do it over a socket interface, yes. > Also my grand mother forg

Re: wx (not responding)

2014-01-14 Thread ngangsia akumbo
On Tuesday, January 14, 2014 4:56:42 PM UTC+1, cassiope wrote: > On Tue, 14 Jan 2014 07:26:10 -0800, ngangsia akumbo wrote: > Not sure whether your wx version might have a 'Mainloop'. I think is ok now thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: python adsl script

2014-01-14 Thread Stephane Wirtel
+1 > On 14 janv. 2014, at 06:30 PM, Denis McMahon wrote: > >> On Tue, 14 Jan 2014 09:27:07 -0800, ngangsia akumbo wrote: >> >> what about a python script that can retrieve my entire isp setting from >> my adsl router. > >> Any ideas > > This is probably possible using telnet, so it should b

Re: Encoding trouble when script called from application

2014-01-14 Thread Peter Otten
Florian Lindner wrote: > Hello! > > I'm using python 3.2.3 on debian wheezy. My script is called from my mail > delivery agent (MDA) maildrop (like procmail) through it's xfilter > directive. > > Script works fine when used interactively, e.g. ./script.py < testmail but > when called from maildr

Re: Tkinter GUI Error

2014-01-14 Thread Lewis Wood
I cannot say how grateful I am to find such a community willing to help <3 Thanks to everyone posting, learned a lot of new stuff :) Never knew you could just bring a local var into a def block using global inside of the function. Again, thanks for taking your time to help out newbies to program

On how to use cxFreeze

2014-01-14 Thread eneskristo
For the first time in my life as a novice Python developer, I need to convert a python file to a .exe (AKA freeze it). Have been having a lot of problems in finding a proper guide, and have come here to ask for your help humbly. I am willing to provide any data if needed. Thank you! -- https://

Printer list value problem

2014-01-14 Thread Mike
Hello, I confudsed,need printer the value of list (this is reaer from csv) . The reader is ok, but my problem is in the print moment because printer only the last value. For example my csv is: [] us...@example.com;user1;lastName;Name us...@example.com;user2;lastName;Name [] But

Python 3.x adoption

2014-01-14 Thread Staszek
Hi What's the problem with Python 3.x? It was first released in 2008, but web hosting companies still seem to offer Python 2.x rather. For example, Google App Engine only offers Python 2.7. What's wrong?... -- http://people.eisenbits.com/~stf/ http://www.eisenbits.com/ OpenPGP: 80FC 1824 2EA4

Re: Printer list value problem

2014-01-14 Thread MRAB
On 2014-01-14 19:24, Mike wrote: Hello, I confudsed,need printer the value of list (this is reaer from csv) . The reader is ok, but my problem is in the print moment because printer only the last value. For example my csv is: [] us...@example.com;user1;lastName;Name us...@example.com;u

Re: Printer list value problem

2014-01-14 Thread Tim Chase
On 2014-01-14 11:24, Mike wrote: > Hello, > I confudsed,need printer the value of list (this is reaer from > csv) . The reader is ok, but my problem is in the print moment > because printer only the last value. For example my csv is: > > [] > us...@example.com;user1;lastName;Name > us...@e

Re: Python 3.x adoption

2014-01-14 Thread Skip Montanaro
> What's the problem with Python 3.x? It was first released in 2008, but > web hosting companies still seem to offer Python 2.x rather. > > For example, Google App Engine only offers Python 2.7. > > What's wrong?... What makes you think anything's wrong? Major changes to any established piece of s

Re: Python 3.x adoption

2014-01-14 Thread Chris Angelico
On Wed, Jan 15, 2014 at 6:33 AM, Staszek wrote: > What's the problem with Python 3.x? It was first released in 2008, but > web hosting companies still seem to offer Python 2.x rather. > > For example, Google App Engine only offers Python 2.7. > > What's wrong?... There's nothing wrong with Python

Re: Printer list value problem

2014-01-14 Thread Mike
El martes, 14 de enero de 2014 16:32:49 UTC-3, MRAB escribió: > On 2014-01-14 19:24, Mike wrote: > > > Hello, > > > I confudsed,need printer the value of list (this is reaer from csv) . The > > reader is ok, but my problem is in the print moment because printer only > > the last value. For exa

Re: Printer list value problem

2014-01-14 Thread Mark Lawrence
On 14/01/2014 19:54, Mike wrote: El martes, 14 de enero de 2014 16:32:49 UTC-3, MRAB escribió: On 2014-01-14 19:24, Mike wrote: Hello, I confudsed,need printer the value of list (this is reaer from csv) . The reader is ok, but my problem is in the print moment because printer only the la

fork seems to make urlopen into a black hole?

2014-01-14 Thread BobAalsma
A program took much too long to check some texts collected from web pages. As this could be made parallel easily, I put in fork. And the result seems to be that the program simply stops in the line with urlopen. Any suggestions? Relevant part: try: print 'urlopen by', kind_nummer, '-

Re: fork seems to make urlopen into a black hole?

2014-01-14 Thread Chris Angelico
On Wed, Jan 15, 2014 at 7:04 AM, BobAalsma wrote: > A program took much too long to check some texts collected from web pages. > As this could be made parallel easily, I put in fork. Rather than using the low-level fork() function, you may find it easier to manage things if you use the multiproce

setup.py install and compile errors

2014-01-14 Thread David
How does a setup script conditionally change what modules are installed based on version? Background: I have a python2.x/3.x module that puts 3.3-only code in submodules. When the module imports those submodules using an older python version, the compiler raises SyntaxErrors in the submod

dictionary with tuples

2014-01-14 Thread Igor Korot
Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> dict = {} >>> dict[(1,2)] = ('a','b') >>> dict[(3,4)] = ('c','d') >>

Re: dictionary with tuples

2014-01-14 Thread Larry Martell
On Tue, Jan 14, 2014 at 2:10 PM, Igor Korot wrote: > Hi, ALL, > C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python > Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. dict

Re: dictionary with tuples

2014-01-14 Thread Tim Chase
On 2014-01-14 13:10, Igor Korot wrote: > Hi, ALL, > C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python > Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more > information. > >>> dict = {} > >>>

Re: dictionary with tuples

2014-01-14 Thread MRAB
On 2014-01-14 21:10, Igor Korot wrote: Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. dict = {} dict[(1,2)] = ('a','

Re: dictionary with tuples

2014-01-14 Thread YBM
Le 14/01/2014 22:10, Igor Korot a écrit : Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. dict = {} dict[(1,2)] = ('a

Re: setup.py issue - some files are included as intended, but one is not

2014-01-14 Thread Dan Stromberg
On Sat, Jan 11, 2014 at 2:04 PM, Dan Stromberg wrote: > Hi folks. > > I have a setup.py problem that's driving me nuts. Anyone? I've received 0 responses. > I have a treap.py file that tries to "import * from pyx_treap.so", and > failing that, it'll "import * from py_treap.py" (sans extensions

Re: Tkinter GUI Error

2014-01-14 Thread Lewis Wood
Also anyone know how to create an entry box for Tkinter where you can only enter in 2 digits? -- https://mail.python.org/mailman/listinfo/python-list

Re: setup.py issue - some files are included as intended, but one is not

2014-01-14 Thread Ethan Furman
On 01/14/2014 01:26 PM, Dan Stromberg wrote: On Sat, Jan 11, 2014 at 2:04 PM, Dan Stromberg wrote: Hi folks. I have a setup.py problem that's driving me nuts. Anyone? I've received 0 responses. I have no answer, but forwarding to Distutils (hopefully it's an appropriate topic ;) I hav

Re:dictionary with tuples

2014-01-14 Thread Dave Angel
Igor Korot Wrote in message: > Hi, ALL, > C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python > Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. dict = {} dict[(1,2)]

Re: Tkinter GUI Error

2014-01-14 Thread Christian Gollwitzer
Am 14.01.14 22:27, schrieb Lewis Wood: Also anyone know how to create an entry box for Tkinter where you can only enter in 2 digits? You must use a validator to achieve this. This is a more advanced topic though. A validator is a function that is called whenever the user keys something in - e

Re: python adsl script

2014-01-14 Thread Adnan Sadzak
Hi, You need to find out what communication type your router supports (most use telnet, ssh, or http). It is easy to implement solution using any of these protocols. If You have problems in implementation, maybe we can help You, but will not write code for You. For password..khm...as Denis says u

Re: dictionary with tuples

2014-01-14 Thread Tobiah
On 01/14/2014 01:21 PM, YBM wrote: Le 14/01/2014 22:10, Igor Korot a écrit : Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more infor

Re: What's correct Python syntax?

2014-01-14 Thread Terry Reedy
On 1/14/2014 3:46 AM, Igor Korot wrote: Hi, ALL, I'm trying to process a file which has following lines: 192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200, length 30 However, I don't need all the protocol info. All I'm interested in is the last field, which is length. To directl

Re: L[:]

2014-01-14 Thread Terry Reedy
On 1/14/2014 5:42 AM, Albert-Jan Roskam wrote: I also found that item assignment ([1] below) is much faster > than using the more standard (I think) .append ([2]). # [1] for idx,item in enumerate(L[:]): if some_condition: L[idx] = foobarify(item) [1] *is* the standard way to sele

Re: What's correct Python syntax?

2014-01-14 Thread emile
On 01/14/2014 02:05 PM, Terry Reedy wrote: On 1/14/2014 3:46 AM, Igor Korot wrote: Hi, ALL, I'm trying to process a file which has following lines: 192.168.1.6 > 192.168.1.7: ICMP echo request, id 100, seq 200, length 30 However, I don't need all the protocol info. All I'm interested in is t

Re: dictionary with tuples

2014-01-14 Thread emile
On 01/14/2014 02:00 PM, Tobiah wrote: On 01/14/2014 01:21 PM, YBM wrote: Le 14/01/2014 22:10, Igor Korot a écrit : Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright"

Re: python-list@python.org

2014-01-14 Thread Florian Lindner
Am Dienstag, 14. Januar 2014, 17:00:48 schrieb MRAB: > On 2014-01-14 16:37, Florian Lindner wrote: > > Hello! > > > > I'm using python 3.2.3 on debian wheezy. My script is called from my mail > > delivery agent (MDA) maildrop (like procmail) through it's xfilter > > directive. > > > > Script work

Chanelling Guido - dict subclasses

2014-01-14 Thread Steven D'Aprano
Over on the Python-Dev mailing list, there is an ENORMOUS multi-thread discussion involving at least two PEPs, about bytes/str compatibility. But I don't want to talk about that. (Oh gods, I *really* don't want to talk about that...) In the midst of that discussion, Guido van Rossum made a comm

Re: Chanelling Guido - dict subclasses

2014-01-14 Thread Ned Batchelder
On 1/14/14 8:27 PM, Steven D'Aprano wrote: Over on the Python-Dev mailing list, there is an ENORMOUS multi-thread discussion involving at least two PEPs, about bytes/str compatibility. But I don't want to talk about that. (Oh gods, I *really* don't want to talk about that...) In the midst of tha

Re: dictionary with tuples

2014-01-14 Thread YBM
Le 14/01/2014 23:00, Tobiah a écrit : On 01/14/2014 01:21 PM, YBM wrote: Le 14/01/2014 22:10, Igor Korot a écrit : Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright"

Re: Python 3.x adoption

2014-01-14 Thread Steven D'Aprano
On Tue, 14 Jan 2014 20:33:50 +0100, Staszek wrote: > Hi > > What's the problem with Python 3.x? Nothing. > It was first released in 2008, That was only five years ago. I know that to young kids today who change their iPhone every six months, five years sounds like a lot, but in the world o

Re: extracting string.Template substitution placeholders

2014-01-14 Thread Eric S. Johansson
On 1/13/2014 2:24 AM, Steven D'Aprano wrote: On Sun, 12 Jan 2014 10:08:31 -0500, Eric S. Johansson wrote: Now just walk the template for $ signs. Watch out for $$ which escapes the dollar sign. Here's a baby parser: found a different way import string cmplxstr="""a simple $string a longer $s

Re: Python 3.x adoption

2014-01-14 Thread MRAB
On 2014-01-15 02:55, Steven D'Aprano wrote: On Tue, 14 Jan 2014 20:33:50 +0100, Staszek wrote: Hi What's the problem with Python 3.x? Nothing. It was first released in 2008, That was only five years ago. I know that to young kids today who change their iPhone every six months, five year

Re: Chanelling Guido - dict subclasses

2014-01-14 Thread Terry Reedy
On 1/14/2014 8:27 PM, Steven D'Aprano wrote: In the midst of that discussion, Guido van Rossum made a comment about subclassing dicts: [quote] From: Guido van Rossum Date: Tue, 14 Jan 2014 12:06:32 -0800 Subject: Re: [Python-Dev] PEP 460 reboot Personally I wouldn't a

Re: python-list@python.org

2014-01-14 Thread MRAB
On 2014-01-15 01:25, Florian Lindner wrote: Am Dienstag, 14. Januar 2014, 17:00:48 schrieb MRAB: On 2014-01-14 16:37, Florian Lindner wrote: > Hello! > > I'm using python 3.2.3 on debian wheezy. My script is called from my mail delivery agent (MDA) maildrop (like procmail) through it's xfilter

Re: Fwd: What's correct Python syntax?

2014-01-14 Thread Larry Hudson
On 01/14/2014 02:03 AM, Igor Korot wrote: [snip] C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. test = "I,like,my,chocolate"

Re: Chanelling Guido - dict subclasses

2014-01-14 Thread F
I can't speak for Guido but I think it is messy and unnatural and will lead to user frustration. As a user, I would expect a dict to take any hashable as key and any object as value when using one. I would probably just provide a __getitem__ method in a normal class in your case. This said I