Re: Type of an object: ‘obj.__class__’ versus ‘type(obj)’

2013-12-16 Thread Steven D'Aprano
On Tue, 17 Dec 2013 08:14:09 +0100, dieter wrote: > Steven D'Aprano writes: > >> On Mon, 16 Dec 2013 12:51:21 +1100, Ben Finney wrote: ... "type(obj)" >> versus "obj.__class__" That is an excellent question, I only wish I had >> an excellent answer to give you. Obviously great minds think alike

Re: Type of an object: ‘obj.__class__’ versus ‘type(obj)’

2013-12-16 Thread dieter
Steven D'Aprano writes: > On Mon, 16 Dec 2013 12:51:21 +1100, Ben Finney wrote: > ... "type(obj)" versus "obj.__class__" > That is an excellent question, I only wish I had an excellent answer to > give you. Obviously great minds think alike because I was going to ask > the same question, prompt

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Mark Lawrence
On 17/12/2013 05:37, Rick Johnson wrote: We don't need that functionality, we ALREADY have a language... it's called Python and the syntax is MUCH better. All we want is a damn GUI. Then write it, dear Rick, dear Rick, dear Rick, then write it, dear Rick, dear Rick, write it. -- My fellow

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 4:37 PM, Rick Johnson wrote: > We don't need that functionality, we ALREADY have a > language... it's called Python and the syntax is MUCH > better. All we want is a damn GUI. > > And trying to justify TCL as legit because "Tcl just calls C > routines" is ludicrous. Python

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Rick Johnson
On Sunday, December 15, 2013 11:01:53 AM UTC-6, Steven D'Aprano wrote: > On Sun, 15 Dec 2013 14:53:45 +, Grant Edwards wrote: > > On 2013-12-14, Steven D'Aprano wrote: > > > > You seem to be equating "was compiled from" with "includes an > > implemenation of". Do you say that CPython "ships wi

Re: Reading csv file

2013-12-16 Thread Mark Lawrence
On 17/12/2013 05:20, Igor Korot wrote: Hi, ALL, Is there a better way to do that: def Read_CSV_File(filename): file = open(filename, "r") reader = csv.DictReader(file) line = 1 for row in reader: if line < 6: reader.next() line++

Re: Reading csv file

2013-12-16 Thread Krishnan Shankar
Hi Igor You can use the following way to do this using "with" operator. def Read_CSV_File(filename): with open(filename, "r") as csvfile: csvreader = csv.DictReader(csvfile) line = 1 for row in csvreader: if line < 6: reader.next(

Reading csv file

2013-12-16 Thread Igor Korot
Hi, ALL, Is there a better way to do that: def Read_CSV_File(filename): file = open(filename, "r") reader = csv.DictReader(file) line = 1 for row in reader: if line < 6: reader.next() line++ # process the CSV Thank you. -- https://mail.

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Rick Johnson
On Monday, December 16, 2013 8:33:11 PM UTC-6, Steven D'Aprano wrote: > Of course, this is very hard to measure: different languages require > different amounts of code to get something useful done. Different > languages get used for different things -- there are no operating system > kernels writ

Re: Installing Python from sources with all the modules

2013-12-16 Thread David Robinow
On Mon, Dec 16, 2013 at 8:55 PM, shankha wrote: > Hi, > I am trying to install Python 3.3 from the latest sources on linux. > > After the installation when I try to run the following I get a error: > > ./python > Python 3.3.3 (default, Dec 16 2013, 18:28:25) > [GCC 4.8.2 20131017 (Red Hat 4.8.2-1)

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Grant Edwards
On 2013-12-16, Gregory Ewing wrote: > Grant Edwards wrote: >> On 2013-12-16, Chris Angelico wrote: >> >>> Are there >>> any aggregate types at all? >> >> There are arrays with string keys (similar to Python dictionaries). > > Well... sort of. They can only hold strings, not other arrays. > They

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Mark Lawrence
On 16/12/2013 22:06, Christian Gollwitzer wrote: Let the flame war begin! Surely proper flame wars should have inflammatory titles like this https://archive.org/details/SeanKellyRecoveryfromAddiction ? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Steven D'Aprano
On Mon, 16 Dec 2013 19:26:37 -0800, Rick Johnson wrote: > **As a side note, you might want to be aware that ethylene glycol, > whilst quite poisonous, tastes sweet. That fact may seem > inconsequential until your beloved pet drinks leaking coolant water, > quickly goes blind, and d

Re: Total time in running Python Tests

2013-12-16 Thread Steven D'Aprano
On Tue, 17 Dec 2013 08:10:18 +0530, shankha wrote: > Hi, > What is the usually the time taken to run Python tests on a x86 machine > with 1 GB of RAM? If I remember correctly from the last time I did it, probably around 20 or 30 minutes. I wasn't really paying attention, so I could be completely

Re: Installing Python from sources with all the modules

2013-12-16 Thread Terry Reedy
On 12/16/2013 8:55 PM, shankha wrote: I am trying to install Python 3.3 from the latest sources on linux. After the installation when I try to run the following I get a error: ./python Python 3.3.3 (default, Dec 16 2013, 18:28:25) [GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux

Re: Script for new contributors to check the patch

2013-12-16 Thread Mark Lawrence
On 17/12/2013 02:46, shankha wrote: Hi, For people who wish to contribute is there a script which checks if the patch is good and the test results are matching with the baseline and basically says yes or no about good or not good to merge. -- Thanks Gudge I think you'd be better off asking th

Re: Determining whether a glyph is available in Tkinter

2013-12-16 Thread Terry Reedy
On 12/16/2013 6:59 PM, wmcbr...@gmail.com wrote: I'm not going to control the font. Tk widgets that display text must use *some* font. If you do not select one, then you get the system-dependent default. for k, v in tk.Text().configure().items(): print(k, v) ... font ('font', 'font', 'Font',

Re: Web Server for Python

2013-12-16 Thread Denis McMahon
On Mon, 16 Dec 2013 19:20:20 -0800, Mura Zalukhu wrote: > Could you give me the best tutorial / web for python. For example how to > make a connection with database. Which database? Which version of Python? Google may help. So will the Python on-line documentation. -- Denis McMahon, denismfmcm

Re: Question RE urllib

2013-12-16 Thread William Ray Wing
On Dec 16, 2013, at 6:40 AM, Jeff James wrote: > So I'm using the following script to check our sites to make sure they are > all up and some of them are reporting they are "down" when, in fact, they are > actually up. These sites do not require a logon in order for the home page > to come u

Re: Figuring out what dependencies are needed

2013-12-16 Thread alex23
On 12/12/2013 4:53 PM, sal i wrote: This is the entire testing file along with the error at the bottom. data = load_from_yahoo() You're _still_ not passing into `load_from_yahoo` either `indexes` or `stocks` parameters, as I tried to point out by highlighting: assert indexes is not None

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Rick Johnson
On Monday, December 9, 2013 2:53:30 PM UTC-6, bob gailer wrote: > Taking the opposite perspective from Gene: I think Python > is great as an intro to computing and programming. Give a > student a tool with which he can be productive quickly. > and with minimal effort. Understanding the real machine

Re: Web Server for Python

2013-12-16 Thread Mura Zalukhu
Hi David, Thanks for your reply, i will learn it. Could you give me the best tutorial / web for python. For example how to make a connection with database. Thanks so much On Tuesday, December 17, 2013 9:40:56 AM UTC+7, david@gmail.com wrote: > Hi Mura, > > > apache is used as a proxy with p

Script for new contributors to check the patch

2013-12-16 Thread shankha
Hi, For people who wish to contribute is there a script which checks if the patch is good and the test results are matching with the baseline and basically says yes or no about good or not good to merge. -- Thanks Gudge On Tue, Dec 17, 2013 at 8:11 AM, shankha wrote: > Hi, > For people who wi

Total time in running Python Tests

2013-12-16 Thread shankha
Hi, What is the usually the time taken to run Python tests on a x86 machine with 1 GB of RAM? http://docs.python.org/devguide/ ./python -m test -j3 Should it be all PASS ? What is the expected summary of the results. Are these good: .3 tests omitted: test___all__ test_site test_urlli

[no subject]

2013-12-16 Thread shankha
Hi, For people who wish to contribute is there a script which checks if the patch is good and the test results are matching with the baseline and basically says yes or no about good or not good to merge. -- Thanks Gudge -- https://mail.python.org/mailman/listinfo/python-list

Re: Web Server for Python

2013-12-16 Thread david.gar...@gmail.com
Hi Mura, apache is used as a proxy with python. You would fire up your python web app and put apache in front of it. Apache does come these days with wsgi https://code.google.com/p/modwsgi/ that can be added to apache as module, something like mod_wsgi can be used for your python web app. PHP is a

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Steven D'Aprano
On Mon, 16 Dec 2013 16:39:14 -0800, rusi wrote: > I had a paper some years ago on why C is a horrible language *to teach > with* http://www.the-magus.in/Publications/chor.pdf Nice paper! I have a few quibbles with it, but overall I think it is very good. > I believe people did not get then (a

Web Server for Python

2013-12-16 Thread Mura Zalukhu
Hi all, I am a newbiew for python, i want to improve my programming for python. but i have searching any tutorial to configuration python for webserver but no one of tutorial solved my problem. could you give me how to configuration ptyhon on webserver like apache / php or Thanks so much -- http

Running Python tests

2013-12-16 Thread shankha
Hi, I am following the developers guide in running Python tests. I had few questions. 1) Say I run the tests and the run got interrupted after few minutes. I want to start afresh. Is there a way to get rid of all the test results or intermediate files or python does the job as and when the test is

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread rusi
On Tuesday, December 17, 2013 6:14:59 AM UTC+5:30, Chris Angelico wrote: > On Tue, Dec 17, 2013 at 11:39 AM, rusi wrote: > > I had a paper some years ago on why C is a horrible language *to teach with* > > http://www.the-magus.in/Publications/chor.pdf > > I believe people did not get then (and stil

Installing Python from sources with all the modules

2013-12-16 Thread shankha
Hi, I am trying to install Python 3.3 from the latest sources on linux. After the installation when I try to run the following I get a error: ./python Python 3.3.3 (default, Dec 16 2013, 18:28:25) [GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux Type "help", "copyright", "credits" or

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 12:25 PM, Mark Lawrence wrote: > I suspect that your manual skills are rather better than mine. One of my > favourite expressions, perhaps because I only ever heard my dad use it, is > "like watching a cow handle a shotgun". Heh. In D&D terms, I think that would be a DEX

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Mark Lawrence
On 17/12/2013 01:06, Roy Smith wrote: In article , Rick Johnson wrote: Dovetails are nothing more than sadistic nostalgia -- they give old men a "chubby" and young men a nightmare. There is nothing more satisfying than cutting a set of dovetails by hand and having them glide together

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Roy Smith
In article , Rick Johnson wrote: > Dovetails are nothing more than sadistic nostalgia -- > they give old men a "chubby" and young men a nightmare. There is nothing more satisfying than cutting a set of dovetails by hand and having them glide together like silk, the first time you test-fit

Re: New to Python, Help to get script working?

2013-12-16 Thread rusi
On Tuesday, December 17, 2013 1:55:57 AM UTC+5:30, Mark wrote: > I am sorry if the way I posted messages was incorrect. Like I said, I am new > to google groups and python quite a bit but i am trying to do things > correctly by you guys. The errors that I am getting were not necessarily > postin

Re: [newbie] Saving binaries in a specific way

2013-12-16 Thread rusi
On Tuesday, December 17, 2013 5:00:14 AM UTC+5:30, Djoser wrote: > Basically I have a .dat file, so I get some numbers and make a different > conversion. > > I'll try this struct script. I'm not used to it, but it seems to do what I > want. Construct is a very powerful utility for binary parsin

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Rick Johnson
On Tuesday, December 10, 2013 7:35:47 PM UTC-6, Dennis Lee Bieber wrote: > NAILS Nails were verboten in my high school wood > working class... We used dowels and glue; chisels to carve > dove-tails; etc. That could be a result of two possibilities: 1. Your high school years were before t

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 11:39 AM, rusi wrote: > I had a paper some years ago on why C is a horrible language *to teach with* > http://www.the-magus.in/Publications/chor.pdf > > I believe people did not get then (and still dont) that bad for > - beginner education (CS101) > - intermediate -- compil

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread rusi
On Tuesday, December 17, 2013 5:58:12 AM UTC+5:30, Ned Batchelder wrote: > On 12/16/13 3:32 PM, Wolfgang Keller wrote: > >>> And ever after that experience, I avoided all languages that were > >>> even remotely similar to C, such as C++, Java, C#, Javascript, PHP > >>> etc. > >> I think that's disa

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Ned Batchelder
On 12/16/13 3:32 PM, Wolfgang Keller wrote: And ever after that experience, I avoided all languages that were even remotely similar to C, such as C++, Java, C#, Javascript, PHP etc. I think that's disappointing, for two reasons. Firstly, C syntax isn't that terrible. It's not just the abysmal

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Terry Reedy
On 12/16/2013 5:40 PM, Chris Angelico wrote: Nice, though Python's threading and/or multiprocessing can do 90% of what people want. Side point: What about Tk? Can you (a) run separate GUI threads for separate windows? (b) manipulate widgets created by another thread? When running tk via tkinte

Re: Determining whether a glyph is available in Tkinter

2013-12-16 Thread wmcbrine
I'm not going to control the font. This is for a program that's distributed to the general public, for use on a wide variety of systems. But what I do in the current version is to use the ASCII label strings by default, and have a command-line option to select the "graphical" (non-ASCII Unicode)

Re: [newbie] Saving binaries in a specific way

2013-12-16 Thread Djoser
Basically I have a .dat file, so I get some numbers and make a different conversion. I'll try this struct script. I'm not used to it, but it seems to do what I want. -- https://mail.python.org/mailman/listinfo/python-list

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Rhodri James
On Mon, 16 Dec 2013 20:32:25 -, Wolfgang Keller wrote: > And ever after that experience, I avoided all languages that were > even remotely similar to C, such as C++, Java, C#, Javascript, PHP > etc. I think that's disappointing, for two reasons. Firstly, C syntax isn't that terrible. I

Re: min max from tuples in list

2013-12-16 Thread Gregory Ewing
Ned Batchelder wrote: On 12/16/13 10:49 AM, rusi wrote: And things that have consistency are of course... consistant (not consistent) In English, it's spelled consistent: http://en.wiktionary.org/wiki/consistant So to be consistent we should spell it performent? :-) -- Greg -- https://m

Re: [newbie] Saving binaries in a specific way

2013-12-16 Thread Tim Chase
On 2013-12-16 14:19, Djoser wrote: > I am new to this forum and also to Python, but I'm trying hard to > understand it better. Welcome aboard! > I need to create a binary file, but the first 4 lines must be in > signed-Integer16 and all the others in signed-Integer32. I have a > program that doe

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Gregory Ewing
Grant Edwards wrote: On 2013-12-16, Chris Angelico wrote: Are there any aggregate types at all? There are arrays with string keys (similar to Python dictionaries). Well... sort of. They can only hold strings, not other arrays. They're not first-class entities: you can't pass them around or

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 9:06 AM, Christian Gollwitzer wrote: > Let the flame war begin! I'll try to avoid flamage :) > First off, gitk is a huge unstructured mess. You are not obliged to write > programs like this in Tcl, at least not today. All these global statements > give already a hint, tha

Re: [newbie] Saving binaries in a specific way

2013-12-16 Thread Djoser
I'm using python 2.7. If I understood correctly, using bytearray I will lost the information about the signed 16, 32, since it makes automatically the conversion. Do you think that I can make the conversion as I proposed before or using struct and save with open()? -- https://mail.python.org/m

Re: Packaging a private project

2013-12-16 Thread Oscar Benjamin
On Dec 16, 2013 11:20 AM, "Nicholas Cole" wrote: > > Dear List, > > What is the best way to distribute a private, pure python, Python 3 > project that needs several modules (some available on pypi but some > private and used by several separate projects) in order to run? > > I'd like to include ev

Re: [newbie] Saving binaries in a specific way

2013-12-16 Thread Chris Kaynor
On Mon, Dec 16, 2013 at 2:19 PM, Djoser wrote: > Hi all, > > I am new to this forum and also to Python, but I'm trying hard to > understand it better. > I need to create a binary file, but the first 4 lines must be in > signed-Integer16 and all the others in signed-Integer32. I have a program >

[newbie] Saving binaries in a specific way

2013-12-16 Thread Djoser
Hi all, I am new to this forum and also to Python, but I'm trying hard to understand it better. I need to create a binary file, but the first 4 lines must be in signed-Integer16 and all the others in signed-Integer32. I have a program that does that with Matlab and other with Mathematica, but

Re: Type of an object: ‘obj.__class__’ versus ‘type(obj)’

2013-12-16 Thread Steven D'Aprano
On Mon, 16 Dec 2013 12:51:21 +1100, Ben Finney wrote: > Howdy all, > > What is the Pythonic way to determine the type of an object? Are there > multiple valid ways, and when should each be used? That is an excellent question, I only wish I had an excellent answer to give you. Obviously great mi

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Christian Gollwitzer
Am 16.12.13 18:04, schrieb Grant Edwards: On 2013-12-16, Chris Angelico wrote: On Tue, Dec 17, 2013 at 3:46 AM, Grant Edwards wrote: * The "everything is a string" view of the world is severly limiting if you're not just processing strings. I wasn't sure if that was the case, from w

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Christian Gollwitzer
Let the flame war begin! Am 16.12.13 17:10, schrieb Chris Angelico: Here's the Tcl procedure that I tweaked. This is from gitk; I find the word diff not all that useful, but a character diff at times is very useful. I haven't found a way to configure the word diff regex through gitk's options, so

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean Dubois
Op maandag 16 december 2013 20:21:15 UTC+1 schreef Jean-Michel Pichavant: > - Original Message - > > On Tue, Dec 17, 2013 at 5:26 AM, Jean Dubois > > wrote: > > >> Try something simple first: > > >> import telnetlib > > >> host = '10.128.59.63' > > >> port = 7000 > > >> t = Telnet(host, po

Re: Question RE urllib

2013-12-16 Thread John Gordon
In Jeff James writes: > --f46d04479f936227ee04edac31bd > Content-Type: text/plain; charset=ISO-8859-1 > Sorry to be a pain here, guys, as I'm also a newbie at this as well. > Where, exactly in the script would I place the " print str(e) " ? except Exception, e: print site + " is

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-16 Thread Wolfgang Keller
> > And ever after that experience, I avoided all languages that were > > even remotely similar to C, such as C++, Java, C#, Javascript, PHP > > etc. > > I think that's disappointing, for two reasons. Firstly, C syntax isn't > that terrible. It's not just the abysmally appalling, hideously horrif

Re: New to Python, Help to get script working?

2013-12-16 Thread Mark
I am sorry if the way I posted messages was incorrect. Like I said, I am new to google groups and python quite a bit but i am trying to do things correctly by you guys. The errors that I am getting were not necessarily posting traceback messages. In those messages I posted my last bit of confus

Re: Question Re urllib (Resolved)

2013-12-16 Thread Jeff James
This worked perfectly. Thank You Where, exactly in the script would I place the " print str(e) " ? The line after the print site + " is down" line. Original Post : I'm not really receiving an "exception" other than those three sites, out of the 30 or so I have listed, are the only sites

Re: Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread Terry Reedy
On 12/16/2013 12:43 PM, Mark Lawrence wrote: On 16/12/2013 17:16, Ravi Prabakaran wrote: Hi, I'm completely new to python. I just need simple logic to get output without any loops. I have list of string The remainder of your description and example imply that this must be a sequence of exactl

Re: Small script to check serial port sucking down system resources.

2013-12-16 Thread Grant Edwards
On 2013-12-16, MRAB wrote: > On 16/12/2013 14:31, sem...@gmail.com wrote: > >> i wrote a program to watch a serial port and look for a command. then >> send a tcp packet. all works great but it takes my processor load to >> about %25. not sure if there is a way to make this more efficient. >> >> i

Re: Question RE urllib

2013-12-16 Thread Larry Martell
On Mon, Dec 16, 2013 at 2:55 PM, Jeff James wrote: > Sorry to be a pain here, guys, as I'm also a newbie at this as well. > > Where, exactly in the script would I place the " print str(e) " ? The line after the print site + " is down" line. > > Thanks > > Original message : > >> I'm not really

RE: Question RE urllib

2013-12-16 Thread Jeff James
Sorry to be a pain here, guys, as I'm also a newbie at this as well. Where, exactly in the script would I place the " print str(e) " ? Thanks Original message : I'm not really receiving an "exception" other than those three sites, out > of the 30 or so I have listed, are the only sites which s

Re: Determining whether a glyph is available in Tkinter

2013-12-16 Thread Terry Reedy
On 12/16/2013 12:32 PM, wmcbr...@gmail.com wrote: I have a Tkinter app that can optionally label some buttons with certain Unicode glyphs that aren't always available (depending on the OS, etc.). It depends on the font in use. The best scenario would be to always use the same unicode font. Idl

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean-Michel Pichavant
- Original Message - > On Tue, Dec 17, 2013 at 5:26 AM, Jean Dubois > wrote: > >> Try something simple first: > >> import telnetlib > >> host = '10.128.59.63' > >> port = 7000 > >> t = Telnet(host, port) > >> def flush() > >> t.read_very_eager() > >> def sendCmd(cmd) > >> t.write('%s

Re: Small script to check serial port sucking down system resources.

2013-12-16 Thread MRAB
On 16/12/2013 14:31, sem...@gmail.com wrote: i am new to python and programming all together. i wrote a program to watch a serial port and look for a command. then send a tcp packet. all works great but it takes my processor load to about %25. not sure if there is a way to make this more efficie

Re: Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread John Gordon
In <2333bfb4-cd72-4ed0-9b28-d8dbe26b5...@googlegroups.com> Ravi Prabakaran writes: > Hi, > I'm completely new to python. I just need simple logic to get output without > any loops. > I have list of string and list of list of numbers. > Each string should be concatenated with every third and fou

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Dave Angel
On Mon, 16 Dec 2013 10:26:14 -0800 (PST), Jean Dubois wrote: File "./test.py", line 7 def flush() ^ SyntaxError: invalid syntax A definition line needs to end with a colon (fix the other as well) -- DaveA -- https://mail.python.org/mailman/listinfo/python-list

Re: Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread Peter Otten
Jussi Piitulainen wrote: > Ravi Prabakaran writes: > >> I'm completely new to python. I just need simple logic to get output >> without any loops. >> I have list of string and list of list of numbers. >> Each string should be concatenated with every third and fourth >> values to generate proper t

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 5:26 AM, Jean Dubois wrote: >> Try something simple first: >> import telnetlib >> host = '10.128.59.63' >> port = 7000 >> t = Telnet(host, port) >> def flush() >> t.read_very_eager() >> def sendCmd(cmd) >> t.write('%s\n' % cmd) >> return flush() >> flush() >> print se

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean Dubois
Op maandag 16 december 2013 17:44:31 UTC+1 schreef Jean-Michel Pichavant: > > This is what I got using telnet: > > [jean:~] $ telnet 10.128.59.63 7000 > > Trying 10.128.59.63... > > Connected to 10.128.59.63. > > Escape character is '^]'. > > *IDN? > > KEITHLEY INSTRUMENTS INC.,MODEL 2425,1078209,C

Re: Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread Jussi Piitulainen
Ravi Prabakaran writes: > I'm completely new to python. I just need simple logic to get output > without any loops. > I have list of string and list of list of numbers. > Each string should be concatenated with every third and fourth > values to generate proper titles in list of strings. > > t =

Re: Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 4:51 AM, Chris Angelico wrote: > t = ['Start','End'] > a = [[1,2,3,4], > [5,6,7,8]] > result = [] > for cur in a: > result.append("%s - %d"%(t[0],cur[2])) > result.append("%s - %d"%(t[1],cur[3])) Whoops, I misread the desired output, I thought you wanted a f

Re: Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 4:41 AM, Ravi Prabakaran wrote: >> Hi Chris, > > Thanks for reply. If you have any good idea with loop, please post. But > i'm looking same without loop because python has slicing,concatenating and > other straight forward feature. I guess it can be done without loop. M

Re: Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread Mark Lawrence
On 16/12/2013 17:16, Ravi Prabakaran wrote: Hi, I'm completely new to python. I just need simple logic to get output without any loops. I have list of string and list of list of numbers. Each string should be concatenated with every third and fourth values to generate proper titles in list of s

Determining whether a glyph is available in Tkinter

2013-12-16 Thread wmcbrine
I have a Tkinter app that can optionally label some buttons with certain Unicode glyphs that aren't always available (depending on the OS, etc.). When they aren't available, Tkinter renders them as "\u". What I'd like to do is check whether the glyphs are available, and fall back to my own a

Re: Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 4:16 AM, Ravi Prabakaran wrote: > Could anyone please guide me with best solution without loops ? > Why "without loops"? The best solution, in my opinion, is a loop. Is this a specific challenge (homework)? I could make you a list comprehension, but that's really just anot

Concatenate string list to number list to form title - Logic needed.

2013-12-16 Thread Ravi Prabakaran
Hi, I'm completely new to python. I just need simple logic to get output without any loops. I have list of string and list of list of numbers. Each string should be concatenated with every third and fourth values to generate proper titles in list of strings. t = ['Start','End'] a = [[1,2,3,4],

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Grant Edwards
On 2013-12-16, Chris Angelico wrote: > On Tue, Dec 17, 2013 at 3:46 AM, Grant Edwards > wrote: >> * The "everything is a string" view of the world is severly >> limiting if you're not just processing strings. > > I wasn't sure if that was the case, from what I was seeing. Are there > any a

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 3:46 AM, Grant Edwards wrote: > * The "everything is a string" view of the world is severly > limiting if you're not just processing strings. I wasn't sure if that was the case, from what I was seeing. Are there any aggregate types at all? ChrisA -- https://mail.py

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Grant Edwards
On 2013-12-16, Chris Angelico wrote: > On Tue, Dec 17, 2013 at 2:32 AM, Kevin Walzer wrote: >> On 12/16/13, 10:20 AM, Chris Angelico wrote: >>> >>> Having made a tweak to gitk at one point, I have to say Tcl is >>> definitely inferior to Python. >> >> >> Without starting a flame war, can you elab

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean-Michel Pichavant
> This is what I got using telnet: > [jean:~] $ telnet 10.128.59.63 7000 > Trying 10.128.59.63... > Connected to 10.128.59.63. > Escape character is '^]'. > *IDN? > KEITHLEY INSTRUMENTS INC.,MODEL 2425,1078209,C32 Oct 4 2010 > 14:20:11/A02 /E/ >

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread 88888 Dihedral
On Saturday, December 14, 2013 8:12:16 PM UTC+8, Jai wrote: > GUI:-want to learn GUI programming in python , how should i proceed. > > > > There are lots of book here so I am confuse which book i should refer so > that i don't waste time . please answer Please check JYTHON and those ready-

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 2:32 AM, Kevin Walzer wrote: > On 12/16/13, 10:20 AM, Chris Angelico wrote: >> >> Having made a tweak to gitk at one point, I have to say Tcl is >> definitely inferior to Python. > > > Without starting a flame war, can you elaborate? I'm curious about your > perspective. >

Re: min max from tuples in list

2013-12-16 Thread Ned Batchelder
On 12/16/13 10:49 AM, rusi wrote: On Sunday, December 15, 2013 9:11:15 AM UTC+5:30, Tim Roberts wrote: Dennis Lee Bieber wrote: Well "performant" is performant enough for the purposes of communicating on the python list I think :D Most probably could figure it out as being stylisticall

Re: min max from tuples in list

2013-12-16 Thread rusi
On Sunday, December 15, 2013 9:11:15 AM UTC+5:30, Tim Roberts wrote: > Dennis Lee Bieber wrote: > >>Well "performant" is performant enough for the purposes of communicating > >>on the python list I think :D > > Most probably could figure it out as being stylistically similar to > >conformant =>

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Kevin Walzer
On 12/16/13, 10:20 AM, Chris Angelico wrote: Having made a tweak to gitk at one point, I have to say Tcl is definitely inferior to Python. Without starting a flame war, can you elaborate? I'm curious about your perspective. (I studied PSL--Python as a Second Language--so develop in it with a

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Chris Angelico
On Tue, Dec 17, 2013 at 1:55 AM, Kevin Walzer wrote: > Finally, Tcl is itself a fully-featured, general programming language that > is a peer to Python both generationally and in terms of its capabilities; > the main way it lags is in the size of its development community. In other > words, you ar

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean Dubois
Op maandag 16 december 2013 15:16:17 UTC+1 schreef Jean-Michel Pichavant: > - Original Message - > > Op maandag 16 december 2013 13:05:41 UTC+1 schreef Jean-Michel > > Pichavant: > > > > Here is the code: > > > > #!/usr/bin/env python > > > > import telnetlib > > > > host = '10.128.59.63' >

Re: New to Python, Help to get script working?

2013-12-16 Thread Ned Batchelder
On 12/16/13 3:02 AM, Mark wrote: If i just try to double click the script, i get an index error, i can barely see the window it disappears so fast, but thats what I see. If you're going to participate in this forum, you'll get better help from people if you use the medium well. 1) Sending

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Kevin Walzer
On 12/15/13, 5:06 PM, Chris Angelico wrote: Yeah, but there's a difference between passing your GUI incantations on to a library function (written in C but now just part of a binary library) and feeding them to a completely different language interpreter. When I write something with PyGTK, I can

Small script to check serial port sucking down system resources.

2013-12-16 Thread sem2jy
i am new to python and programming all together. i wrote a program to watch a serial port and look for a command. then send a tcp packet. all works great but it takes my processor load to about %25. not sure if there is a way to make this more efficient. import serial import socket HOST = '1

Re: Downloading multiple files based on info extracted from CSV

2013-12-16 Thread Matt Graves
On Thursday, December 12, 2013 5:20:59 PM UTC-5, Chris Angelico wrote: > import urllib > > import csv > > > > # You actually could get away with not using a with > > # block here, but may as well keep it for best practice > > with open('clients.csv') as f: > > for client in csv.reader(f

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean-Michel Pichavant
- Original Message - > Op maandag 16 december 2013 13:05:41 UTC+1 schreef Jean-Michel > Pichavant: > > > Here is the code: > > > #!/usr/bin/env python > > > import telnetlib > > > host = '10.128.59.63' > > > port = 7000 > > > t = Telnet(host, port) > > > t.write('*IDN?\n') > > > print t.r

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Roy Smith
On Friday, December 13, 2013 5:58:49 AM UTC+8, Chris Angelico wrote: > > Now, if you want reliability AND datagrams, it's a lot easier to add > > boundaries to a TCP stream (sentinel or length prefixes) than to add > > reliability to UDP... In article <11cb8cd3-7a12-46b2-abc6-53fbc2a54...@googlegr

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Mark Lawrence
On 16/12/2013 11:58, Chris Angelico wrote: On Mon, Dec 16, 2013 at 8:42 PM, Mark Lawrence wrote: I've done the latter, but still can't fit all the data for my 100+ screens into a one liner, help please :) With 100 screens, you should be able to use lines of text up to 8000 characters long - j

Re: [newbie] trying socket as a replacement for nc

2013-12-16 Thread Jean Dubois
Op maandag 16 december 2013 13:05:41 UTC+1 schreef Jean-Michel Pichavant: > > Here is the code: > > #!/usr/bin/env python > > import telnetlib > > host = '10.128.59.63' > > port = 7000 > > t = Telnet(host, port) > > t.write('*IDN?\n') > > print t.read_until('Whateverprompt') > > # you can use read_

Re: Question Re urllib (Jeff James)

2013-12-16 Thread Larry Martell
On Monday, December 16, 2013, Jeff James wrote: > I'm not really receiving an "exception" other than those three sites, out > of the 30 or so I have listed, are the only sites which show "is down" at > the end of that line specifying the site. > > > Where " # " has been substituted for our domain

Re: Launching Helium: A Selenium wrapper that makes web automation 50% easier

2013-12-16 Thread Michael Herrmann
On Monday, December 16, 2013 12:40:56 PM UTC+1, larry@gmail.com wrote: ... > Is this open source? No. We quit our daytime jobs to work on this project and need the income to sustain our development... -- https://mail.python.org/mailman/listinfo/python-list

  1   2   >