Re: load_module for import entire package

2013-12-12 Thread Sergey
> This should work: > def get_obj(): > tmp = load_package_strict("tmp", basedir) > return tmp.main.TTT() Thank you:) I can only mention that it is working only if __init__.py of pkg contains line: import main To avoid modules caching I copy package to the new folder with anot

request for guidance

2013-12-12 Thread jennifer stone
greetings I am a novice who is really interested in contributing to Python projects. How and where do I begin? thanking you in anticipation -- https://mail.python.org/mailman/listinfo/python-list

Re: min max from tuples in list

2013-12-12 Thread Robert Voigtländer
>I've heard the term used often. It means something like, "performs >well" or "runs fast". It may or may not be an English word, but that >doesn't stop people from using it :-) > If "google" can be used to mean "make huge amouts of money with a > product that is inherently flawed" then I'll

Re: Python Script

2013-12-12 Thread Amimo Benja
On Thursday, December 12, 2013 9:59:26 PM UTC+3, MRAB wrote: > On 12/12/2013 18:05, Amimo Benja wrote: > > > I have an issue with a Python script that I will show as follows: > > > http://codepad.org/G8Z2ConI > > > > > > Assume that you have three (well defined) classes: AirBase and VmNet, > >

Re: Python Script

2013-12-12 Thread Amimo Benja
On Thursday, December 12, 2013 9:55:29 PM UTC+3, Terry Reedy wrote: > On 12/12/2013 1:35 PM, Gary Herron wrote: > > > On 12/12/2013 10:05 AM, Amimo Benja wrote: > > >> I have an issue with a Python script that I will show as follows: > > >> http://codepad.org/G8Z2ConI > > >> > > >> Assume that

Re: Python Script

2013-12-12 Thread Amimo Benja
On Thursday, December 12, 2013 9:35:23 PM UTC+3, Gary Herron wrote: > On 12/12/2013 10:05 AM, Amimo Benja wrote: > > > I have an issue with a Python script that I will show as follows: > > > http://codepad.org/G8Z2ConI > > > > > > Assume that you have three (well defined) classes: AirBase and V

Re: Need help with file object

2013-12-12 Thread John Gordon
In Unix SA writes: > f=open('/tmp/file1') > s=open('/tmp/file2') > for line in f: > if 'match' not in line: > s.write(line) > import shutil > shutil.move(s, f) > With above prog I am getting error > TypeError: coercing to Unicode: need sting or buffer, file found > What that means an

Re: Optimizing list processing

2013-12-12 Thread rusi
On Friday, December 13, 2013 8:31:37 AM UTC+5:30, Steven D'Aprano wrote: > I don't know of any reasonable way to tell at runtime which of the two > algorithms I ought to take. Hard-coding an arbitrary value > ("if len(table) > 500") is not the worst idea I've ever had, but I'm > hoping for

Re: Need help with file object

2013-12-12 Thread rusi
On Friday, December 13, 2013 9:59:25 AM UTC+5:30, Unix SA wrote: > s=open('/tmp/file2') >s.write(line) Among other things you are missing a write mode (2nd optional argument to open) http://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files -- https://mail.python.org/

Re: Need help with file object

2013-12-12 Thread Christopher Welborn
On 12/12/2013 10:29 PM, Unix SA wrote: Hello, I am facing some issue when copying or moving file f=open('/tmp/file1') s=open('/tmp/file2') for line in f: if 'match' not in line: s.write(line) import shutil shutil.move(s, f) With above prog I am getting error TypeError: coercing to U

Need help with file object

2013-12-12 Thread Unix SA
Hello, I am facing some issue when copying or moving file f=open('/tmp/file1') s=open('/tmp/file2') for line in f: if 'match' not in line: s.write(line) import shutil shutil.move(s, f) With above prog I am getting error TypeError: coercing to Unicode: need sting or buffer, file found W

Using pythons smtp server

2013-12-12 Thread Vincent Davis
I have an app that generates a file one a day and would like to email it using pythons SMTP server. http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer The documentation is kinda sparse and I cant seem to find any good examples. Basically what I want to do; when my app runs it would initi

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

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 7:23 PM, Jean Dubois wrote: > Op donderdag 12 december 2013 22:23:22 UTC+1 schreef Dan Stromberg: >> On Thu, Dec 12, 2013 at 12:28 AM, Jean Dubois >> wrote: >> >> > On Thursday, December 12, 2013 12:20:36 AM UTC+1, Dan Stromberg wrote: >> >> >> On Wed, Dec 11, 2013 at 3:0

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

2013-12-12 Thread Jean Dubois
Op donderdag 12 december 2013 22:23:22 UTC+1 schreef Dan Stromberg: > On Thu, Dec 12, 2013 at 12:28 AM, Jean Dubois wrote: > > > On Thursday, December 12, 2013 12:20:36 AM UTC+1, Dan Stromberg wrote: > > >> On Wed, Dec 11, 2013 at 3:08 PM, Jean Dubois wrote: > > >> > > >> I have an ethernet-r

Re: Optimizing list processing

2013-12-12 Thread Steven D'Aprano
On Thu, 12 Dec 2013 16:08:33 +0100, Peter Otten wrote: > Steven D'Aprano wrote: [...] >> So, ideally I'd like to write my code like this: >> >> >> table = [(x, i) for i,x in enumerate(iterable)] table.sort() >> if len(table) < ?: >> table = [i for x,i in table] >> else: >> for x, i i

Re: Knapsack Problem Without Value

2013-12-12 Thread Gary Herron
On 12/12/2013 06:08 PM, geezl...@gmail.com wrote: Hi, I wanna ask about Knapsack. I do understand what Knapsack is about. But this one i faced is a different problem. There is no value. I mean, it's like this, for example. I have 4 beams [X0, X1, X2, X3]. Each 1, 2, 2, 3 cm long. I want to ma

Re: min max from tuples in list

2013-12-12 Thread Steven D'Aprano
On Thu, 12 Dec 2013 13:54:10 +0100, Peter Otten wrote: > Steven D'Aprano wrote: > >> In any case, sorting in Python is amazingly fast. You may be pleasantly >> surprised that a version that sorts your data, while nominally O(N log >> N), may be much faster than an O(N) solution that doesn't requi

Knapsack Problem Without Value

2013-12-12 Thread geezle86
Hi, I wanna ask about Knapsack. I do understand what Knapsack is about. But this one i faced is a different problem. There is no value. I mean, it's like this, for example. I have 4 beams [X0, X1, X2, X3]. Each 1, 2, 2, 3 cm long. I want to make a new 6 cm long connected-beam from these 4 beam

Re: min max from tuples in list

2013-12-12 Thread Denis McMahon
On Wed, 11 Dec 2013 23:25:53 -0800, Robert Voigtländer wrote: > I have a list like this: > > a = [(52, 193), .. (36, 133)] # iterate over the list of tuples # creates a dictionary n0:[n1a, n1b, n1c ... ] # from tuples (n0,n1a), (n0,n1b), (n0,n1c) ... b = {} for x in a: if x[0] in b:

Re: Optimizing list processing

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 11:14 AM, Steven D'Aprano wrote: > Back in the 1980s, when I was a Mac user and occasional programmer, there > were memory manager routines which (if I recall correctly) would tell you > whether or not an allocation would succeed or not. Macs of that vintage > didn't have v

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

2013-12-12 Thread Dave Angel
On Thu, 12 Dec 2013 13:27:16 -0800, Dan Stromberg wrote: On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards wrote: I haven't done a lot of UDP, but are you pretty sure UDP can't at least fragment large packets? What's a router or switch to do if the Path MTU isn't large enough for an original

Re: Optimizing list processing

2013-12-12 Thread Steven D'Aprano
On Thu, 12 Dec 2013 13:40:36 -0500, Terry Reedy wrote: > On 12/12/2013 7:08 AM, Steven D'Aprano wrote: > >> Please don't focus on the algorithm I gave. Focus on the fact that I >> could write it like this: >> >> if some condition to do with the computer's available memory: >> make modificat

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

2013-12-12 Thread Rhodri James
On Wed, 11 Dec 2013 16:18:08 -, Mark Lawrence wrote: On 11/12/2013 16:04, Chris Angelico wrote: I strongly believe that a career programmer should learn as many languages and styles as possible, but most of them can wait. I chuckle every time I read this one. Five years per language,

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

2013-12-12 Thread Christian Gollwitzer
Am 12.12.13 00:08, schrieb Jean Dubois: I have an ethernet-rs232 adapter which allows me to connect to a measurement instrument by means of netcat on a linux system. e.g. entering nc 10.128.59.63 7000 allows me to enter e.g. *IDN? after which I get an identification string of the measurement ins

Re: min max from tuples in list

2013-12-12 Thread Steven D'Aprano
On Thu, 12 Dec 2013 12:36:51 +, MRAB wrote: > On 12/12/2013 11:44, Steven D'Aprano wrote: >> On Wed, 11 Dec 2013 23:25:53 -0800, Robert Voigtländer wrote: >> >>> Hi, >>> >>> I have a list like this: >>> >>> a = [(52, 193), (52, 193), (52, 192), ... >>> >>> >>> I need to find a -performant- way

Re: Tree library - multiple children

2013-12-12 Thread Ethan Furman
On 12/12/2013 02:01 PM, Ricardo Aráoz wrote: El 12/12/13 15:56, Terry Reedy escribió: On 12/12/2013 1:14 PM, Ricardo Aráoz wrote: I need to use a tree structure. Is there a good and known library? Search tools, both for the web and on pypi.python.org, are your friend. I thought it was obvio

Re: Downloading file

2013-12-12 Thread MRAB
On 12/12/2013 20:45, Matt Graves wrote: I have direct links to a number of csv files to download. Copying and pasting it to my browser would take too long, how would i go to this site for example and get the file? Right when you go to the site the download should start www.example.com/files/do

Re: Code suggestion - List comprehension

2013-12-12 Thread Ben Finney
Shyam Parimal Katti writes: > A semi-colon in the string value indicates the termination of a sql query. > So the expected out come is a conversion to a list of valid sql queries: > ['drop table sample_table;', 'create table sample_test (col1 int);', > 'select col1 from sample_test;'] I presume

Re: Downloading multiple files based on info extracted from CSV

2013-12-12 Thread John Gordon
In <88346903-2af8-48cd-9829-37cedb717...@googlegroups.com> Matt Graves writes: > import urllib > import csv > urls = [] > clientname = [] > ###This will set column 7 to be a list of urls > with open('clients.csv', 'r') as f: > reader = csv.reader(f) > for column in reader: > url

Re: Downloading multiple files based on info extracted from CSV

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 8:43 AM, Matt Graves wrote: > ###This SHOULD plug in the URL for F, and the client name for G. > def downloadFile(urls, clientname): > urllib.urlretrieve(f, "%g.csv") % clientname > > downloadFile(f,g) > > When I run it, I get : AttributeError: 'file' object has no attr

Re: Downloading multiple files based on info extracted from CSV

2013-12-12 Thread Mark Lawrence
On 12/12/2013 21:43, Matt Graves wrote: I have a CSV file containing a bunch of URLs I have to download a file from for clients (Column 7) and the clients names (Column 0) I tried making a script to go down the .csv file and just download each file from column 7, and save the file as [clientna

Re: Code suggestion - List comprehension

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 7:40 AM, Shyam Parimal Katti wrote: > sample = ['drop table sample_table;', 'create table sample_test', '(col1 > int);', 'select col1 from', ' sample_test;'] > pure_sqls = [] > query_holder= '' > for each_line in sample: > query_holder += each_line > if query_holder

Re: Tree library - multiple children

2013-12-12 Thread Ricardo Aráoz
El 12/12/13 18:01, Mark Lawrence escribió: On 12/12/2013 18:56, Terry Reedy wrote: On 12/12/2013 1:14 PM, Ricardo Aráoz wrote: I need to use a tree structure. Is there a good and known library? Search tools, both for the web and on pypi.python.org, are your friend. stackoverflow is another

Re: Tree library - multiple children

2013-12-12 Thread Ricardo Aráoz
El 12/12/13 15:56, Terry Reedy escribió: On 12/12/2013 1:14 PM, Ricardo Aráoz wrote: I need to use a tree structure. Is there a good and known library? Search tools, both for the web and on pypi.python.org, are your friend. I thought it was obvious that I've already looked around. I'm using

Re: Tree library - multiple children

2013-12-12 Thread Ricardo Aráoz
El 12/12/13 16:26, Neil Cerutti escribió: On 2013-12-12, Ricardo Aráoz wrote: I need to use a tree structure. Is there a good and known library? Doesn't have to be binary tree, I need to have multiple children per node. Have you tried nested lists? [[1, 2], [3, 4] Can represent root

Re: Tracking the status of python script execution

2013-12-12 Thread Ned Batchelder
On 12/11/13 2:26 PM, Shyam Parimal Katti wrote: Hello All, I am looking for a library that can help me trace the status of a live python script execution. i.e if I have a python script `x.py` with 200 lines, when I execute the script with `python x.py`, is there a way to trace the status of this

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

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 8:27 AM, Dan Stromberg wrote: > On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards > wrote: > >>> Sockets reserve the right to split one socket.send() into multiple >>> socket.recv()'s on the other end of the communication, or to aggregate >>> multiple socket.send()'s into a

Re: Code suggestion - List comprehension

2013-12-12 Thread Mark Lawrence
On 12/12/2013 20:40, Shyam Parimal Katti wrote: Hello, I have a list of sql queries, some which are split across multiple list elements e.x. ['drop table sample_table;', 'create table sample_test', '(col1 int);', 'select col1 from', ' sample_test;'] A semi-colon in the string value indicates t

Re: Code suggestion - List comprehension

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 7:40 AM, Shyam Parimal Katti wrote: > A semi-colon in the string value indicates the termination of a sql query. > So the expected out come is a conversion to a list of valid sql queries: > ['drop table sample_table;', 'create table sample_test (col1 int);', 'select > col1

Downloading multiple files based on info extracted from CSV

2013-12-12 Thread Matt Graves
I have a CSV file containing a bunch of URLs I have to download a file from for clients (Column 7) and the clients names (Column 0) I tried making a script to go down the .csv file and just download each file from column 7, and save the file as [clientname].csv I am relatively new to python, so

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

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards wrote: >> Sockets reserve the right to split one socket.send() into multiple >> socket.recv()'s on the other end of the communication, or to aggregate >> multiple socket.send()'s into a single socket.recv() - pretty much any way >> the relevant IP st

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

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 12:28 AM, Jean Dubois wrote: > On Thursday, December 12, 2013 12:20:36 AM UTC+1, Dan Stromberg wrote: >> On Wed, Dec 11, 2013 at 3:08 PM, Jean Dubois wrote: >> >> I have an ethernet-rs232 adapter which allows me to connect to a measurement >> instrument by means of netcat

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

2013-12-12 Thread Larry Martell
On Thu, Dec 12, 2013 at 11:51 AM, bob gailer wrote: > On 12/11/2013 9:07 PM, Larry Martell wrote: > >> Nope. Long before that I was working on computers that didn't boot when >> you powered them up, You had to manually key in a bootstrap program from the >> front panel switches. > > PDP8? RIM load

Re:

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 12:06 AM, marcinmltd wrote: > Hello, > > I'm big fan of multiprocessing module, but recently I started looking at > threading in Python more closely and got couple of questions I hope You can > help me with: > > 1. When I run two or more threads in my python process are the

Re: Tree library - multiple children

2013-12-12 Thread Michael Torrie
On 12/12/2013 11:14 AM, Ricardo Aráoz wrote: > I need to use a tree structure. Is there a good and known library? > Doesn't have to be binary tree, I need to have multiple children per node. There are lots of types of tree structures that may or may not be applicable to your problem. And it depen

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

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 7:36 AM, 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. You might p

Code suggestion - List comprehension

2013-12-12 Thread Shyam Parimal Katti
Hello, I have a list of sql queries, some which are split across multiple list elements e.x. ['drop table sample_table;', 'create table sample_test', '(col1 int);', 'select col1 from', ' sample_test;'] A semi-colon in the string value indicates the termination of a sql query. So the expected out

Re: Tree library - multiple children

2013-12-12 Thread Mark Lawrence
On 12/12/2013 18:56, Terry Reedy wrote: On 12/12/2013 1:14 PM, Ricardo Aráoz wrote: I need to use a tree structure. Is there a good and known library? Search tools, both for the web and on pypi.python.org, are your friend. stackoverflow is another useful site to search and see also http://

Downloading file

2013-12-12 Thread Matt Graves
I have direct links to a number of csv files to download. Copying and pasting it to my browser would take too long, how would i go to this site for example and get the file? Right when you go to the site the download should start www.example.com/files/document.csv -- https://mail.python.org/mai

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

2013-12-12 Thread Wolfgang Keller
> I'm particularly interested to know if anyone can share experience of > switching to teaching Python as a first programming language in a > similar context. A written up case study that I could circulate among > the relevant staff would be especially useful. Just one experience from the "other"

Re: Tree library - multiple children

2013-12-12 Thread Joel Goldstick
On Thu, Dec 12, 2013 at 2:38 PM, MRAB wrote: > On 12/12/2013 19:30, Joel Goldstick wrote: > >> On Thu, Dec 12, 2013 at 2:26 PM, Neil Cerutti > > wrote: >> >> On 2013-12-12, Ricardo Aráoz > > wrote: >> > I need to use a tree structu

Re: Tree library - multiple children

2013-12-12 Thread MRAB
On 12/12/2013 19:30, Joel Goldstick wrote: On Thu, Dec 12, 2013 at 2:26 PM, Neil Cerutti mailto:ne...@norwich.edu>> wrote: On 2013-12-12, Ricardo Aráoz mailto:ricar...@gmail.com>> wrote: > I need to use a tree structure. Is there a good and known library? > Doesn't have to be binar

Re: ABC hackery

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 6:26 AM, Demian Brecht wrote: > Not recommended for anything outside of POC :) I love that kind of code :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list

ABC hackery

2013-12-12 Thread Demian Brecht
Hey all, Thought I'd share some fun I had some time ago when digging into abcs and metaclasses: https://gist.github.com/demianbrecht/6944269. The implementation piggy backs off of abcs to achieve "class A should look like class B" type functionality without using inheritance. Not recommended for

Re: Tree library - multiple children

2013-12-12 Thread Joel Goldstick
On Thu, Dec 12, 2013 at 2:26 PM, Neil Cerutti wrote: > On 2013-12-12, Ricardo Aráoz wrote: > > I need to use a tree structure. Is there a good and known library? > > Doesn't have to be binary tree, I need to have multiple children per > node. > > Have you tried nested lists? > > [[1, 2], [3, 4]

Re: Tree library - multiple children

2013-12-12 Thread Neil Cerutti
On 2013-12-12, Ricardo Aráoz wrote: > I need to use a tree structure. Is there a good and known library? > Doesn't have to be binary tree, I need to have multiple children per node. Have you tried nested lists? [[1, 2], [3, 4] Can represent root / \ 1-23-4 Python makes it ver

Re: Tree library - multiple children

2013-12-12 Thread Terry Reedy
On 12/12/2013 1:14 PM, Ricardo Aráoz wrote: I need to use a tree structure. Is there a good and known library? Search tools, both for the web and on pypi.python.org, are your friend. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Script

2013-12-12 Thread MRAB
On 12/12/2013 18:05, Amimo Benja wrote: I have an issue with a Python script that I will show as follows: http://codepad.org/G8Z2ConI Assume that you have three (well defined) classes: AirBase and VmNet, . VmNet has got a method that is called recursively each time an HTTP response is received.

Re: Python Script

2013-12-12 Thread Terry Reedy
On 12/12/2013 1:35 PM, Gary Herron wrote: On 12/12/2013 10:05 AM, Amimo Benja wrote: I have an issue with a Python script that I will show as follows: http://codepad.org/G8Z2ConI Assume that you have three (well defined) classes: AirBase and VmNet, . VmNet has got a method that is called recurs

Re: Optimizing list processing

2013-12-12 Thread Terry Reedy
On 12/12/2013 7:08 AM, Steven D'Aprano wrote: Please don't focus on the algorithm I gave. Focus on the fact that I could write it like this: if some condition to do with the computer's available memory: make modifications in place else: make a copy of the data containing the modific

PyDev 3.1.0 released

2013-12-12 Thread Fabio Zadrozny
Hi All, PyDev 3.1.0 has been released Details on PyDev: http://pydev.org Details on its development: http://pydev.blogspot.com LiClipse (PyDev standalone with goodies such as support for Django Templates, Mako Templates, Html, Javascript, etc): http://brainwy.github.io/liclipse/ Release Highl

Re: Python Script

2013-12-12 Thread Gary Herron
On 12/12/2013 10:05 AM, Amimo Benja wrote: I have an issue with a Python script that I will show as follows: http://codepad.org/G8Z2ConI Assume that you have three (well defined) classes: AirBase and VmNet, . VmNet has got a method that is called recursively each time an HTTP response is recei

Tree library - multiple children

2013-12-12 Thread Ricardo Aráoz
I need to use a tree structure. Is there a good and known library? Doesn't have to be binary tree, I need to have multiple children per node. Thanks -- https://mail.python.org/mailman/listinfo/python-list

Python Script

2013-12-12 Thread Amimo Benja
I have an issue with a Python script that I will show as follows: http://codepad.org/G8Z2ConI Assume that you have three (well defined) classes: AirBase and VmNet, . VmNet has got a method that is called recursively each time an HTTP response is received. The variable recordTuple needs to be bui

Re: Optimizing list processing

2013-12-12 Thread Terry Reedy
On 12/12/2013 6:09 AM, Stefan Behnel wrote: Terry Reedy, 12.12.2013 03:26: from itertools import count table = sorted(t for t in zip(iterable, count)) This is a useless use of a generator expression. sorted(zip(...)) is enough (and likely to be substantially faster also). Yes, definitely, an

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

2013-12-12 Thread Terry Reedy
On 12/12/2013 4:17 AM, wxjmfa...@gmail.com wrote: Windows, Py3, unicode. It is is infortunate, but it is a fact Python has some problems with that platform (file sytem encoding), -> potential problems which should not exist for a beginner. Some disappear if, for instance, one uses Idle. I am

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

2013-12-12 Thread Ned Batchelder
On 12/12/13 11:20 AM, wxjmfa...@gmail.com wrote: Le jeudi 12 décembre 2013 15:47:40 UTC+1, Chris Angelico a écrit : On Fri, Dec 13, 2013 at 1:34 AM, wrote: Le jeudi 12 décembre 2013 11:28:35 UTC+1, Chris Angelico a écrit : On Thu, Dec 12, 2013 at 8:17 PM, wrote: Windows, Py2.(7),

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

2013-12-12 Thread bob gailer
On 12/11/2013 9:07 PM, Larry Martell wrote: Nope. Long before that I was working on computers that didn't boot when you powered them up, You had to manually key in a bootstrap program from the front panel switches. PDP8? RIM loader, BIN loader? -- https://mail.python.org/mailman/listinfo/pyth

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

2013-12-12 Thread wxjmfauth
Le jeudi 12 décembre 2013 15:47:40 UTC+1, Chris Angelico a écrit : > On Fri, Dec 13, 2013 at 1:34 AM, wrote: > > > Le jeudi 12 décembre 2013 11:28:35 UTC+1, Chris Angelico a écrit : > > >> On Thu, Dec 12, 2013 at 8:17 PM, wrote: > > >> > > >> > Windows, Py2.(7), ascii. It is not a secret Py

Re: input() on python 2.7.5 vs 3.3.2

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 2:04 AM, Mark Lawrence wrote: > I much prefer Chris Angelico's response "The input() function in Python 2.x > is a very dangerous one - it's equivalent to eval(input()) in Python 3." Just to clarify: If you *want* eval, then you know you want it, and you are (or should be)

Re: min max from tuples in list

2013-12-12 Thread Mark Lawrence
On 12/12/2013 15:02, Roy Smith wrote: In article <52a9a1a0$0$29992$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: I'm afraid I don't know what you mean by "performant". I've heard the term used often. It means something like, "performs well" or "runs fast". It may or may not

Re: input() on python 2.7.5 vs 3.3.2

2013-12-12 Thread Mark Lawrence
On 12/12/2013 14:56, Amit Saha wrote: On Fri, Dec 13, 2013 at 12:45 AM, wrote: Can someone explain? Thanks. Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. x = input() Hell

Re: Optimizing list processing

2013-12-12 Thread Peter Otten
Steven D'Aprano wrote: > I have some code which produces a list from an iterable using at least > one temporary list, using a Decorate-Sort-Undecorate idiom. The algorithm > looks something like this (simplified): > > table = sorted([(x, i) for i,x in enumerate(iterable)]) > table = [i for x,i in

Re: min max from tuples in list

2013-12-12 Thread Roy Smith
In article <52a9a1a0$0$29992$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I'm afraid I don't know what you mean by "performant". I've heard the term used often. It means something like, "performs well" or "runs fast". It may or may not be an English word, but that doesn't s

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

2013-12-12 Thread Mark Lawrence
On 12/12/2013 14:34, wxjmfa...@gmail.com wrote: Le jeudi 12 décembre 2013 11:28:35 UTC+1, Chris Angelico a écrit : On Thu, Dec 12, 2013 at 8:17 PM, wrote: Windows, Py2.(7), ascii. It is not a secret Python uses ascii for the representation. Actually no, it doesn't. Python 2.7.4 (de

Re: input() on python 2.7.5 vs 3.3.2

2013-12-12 Thread Amit Saha
On Fri, Dec 13, 2013 at 12:45 AM, wrote: > Can someone explain? Thanks. > > Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit > (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. x = input() > Hello there print(x) > Hel

Re: input() on python 2.7.5 vs 3.3.2

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 1:45 AM, wrote: > Can someone explain? Thanks. > > Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit > (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. x = input() > Hello there print(x) > Hell

input() on python 2.7.5 vs 3.3.2

2013-12-12 Thread stephen . boulet
Can someone explain? Thanks. Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> x = input() Hello there >>> print(x) Hello there Python 2.7.5 (default, May 15 2013, 22:43:36) [M

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

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 1:34 AM, wrote: > Le jeudi 12 décembre 2013 11:28:35 UTC+1, Chris Angelico a écrit : >> On Thu, Dec 12, 2013 at 8:17 PM, wrote: >> >> > Windows, Py2.(7), ascii. It is not a secret Python uses >> > ascii for the representation. >> >> Actually no, it doesn't. > sys.ve

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

2013-12-12 Thread Mark Lawrence
On 12/12/2013 14:05, Alister wrote: you probably need to use something like wireshark to see what is actually happening and compare it to a good connection in the normal way. You've sent this twice old chap, you've a configuration issue somewhere I'd guess :) -- My fellow Pythonistas, ask

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

2013-12-12 Thread wxjmfauth
Le jeudi 12 décembre 2013 11:28:35 UTC+1, Chris Angelico a écrit : > On Thu, Dec 12, 2013 at 8:17 PM, wrote: > > > Windows, Py2.(7), ascii. It is not a secret Python uses > > > ascii for the representation. > > > > Actually no, it doesn't. > > > > Python 2.7.4 (default, Apr 6 2013, 19:54

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

2013-12-12 Thread Mark Lawrence
On 12/12/2013 13:52, Ned Batchelder wrote: I'd be glad to have an extended conversation with you offline if you don't want to get into details here. Would you please to kind enough to keep it online, I enjoy a good comedian and our erstwhile unicode expert is one of the best, if not the best

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

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 1:16 AM, Grant Edwards wrote: > And it _will_ fail someday in some odd circumstance when, for example, > some customer is be using it via a dial-up PPP connection, or there is > a satellite link in the path, or there's a flakey router somewhere, > or... Or you write, write

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

2013-12-12 Thread Grant Edwards
On 2013-12-11, Dan Stromberg wrote: > On Wed, Dec 11, 2013 at 3:08 PM, Jean Dubois wrote: > >> I have an ethernet-rs232 adapter which allows me to connect to a >> measurement instrument by means of netcat on a linux system. >> e.g. entering nc 10.128.59.63 7000 >> allows me to enter e.g. >> *IDN?

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

2013-12-12 Thread Alister
On Thu, 12 Dec 2013 01:21:27 -0800, Jean Dubois wrote: > On Thursday, December 12, 2013 9:21:32 AM UTC+1, Chris Angelico wrote: >> On Thu, Dec 12, 2013 at 7:08 PM, Jean Dubois >> wrote: >> >> > Thanks for the reply, I changed the line you mentioned to >> >> > s.send('*IDN?\n') >> >> >> >> Se

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

2013-12-12 Thread Alister
On Thu, 12 Dec 2013 01:21:27 -0800, Jean Dubois wrote: > On Thursday, December 12, 2013 9:21:32 AM UTC+1, Chris Angelico wrote: >> On Thu, Dec 12, 2013 at 7:08 PM, Jean Dubois >> wrote: >> >> > Thanks for the reply, I changed the line you mentioned to >> >> > s.send('*IDN?\n') >> >> >> >> Se

Re: Optimizing list processing

2013-12-12 Thread Chris Angelico
On Fri, Dec 13, 2013 at 12:32 AM, MRAB wrote: >> table[:] = [i for x,i in table] # Does slice assignment get optimized? >> > [snip] > > If you're trying that, you could also try: > > table[:] = (i for x,i in table) Right, a tweak which could be applied also to the split version. Thanks MRAB. Ch

Formatting text in a table with reportlab

2013-12-12 Thread Joseph L. Casale
I sent off a msg to the reportlab list but didn't find an answer, hoping someone here might have come across this... I am generating a table to hold text oriented by the specification of the label it gets printed on. I need to compress the vertical size of the table a little more but the larger te

Re: Movie (MPAA) ratings and Python?

2013-12-12 Thread Dave Angel
On Wed, 11 Dec 2013 23:22:14 -0700, Michael Torrie wrote: From what I can see gmail is producing a multipart message that has a plaint text part and an html part. This is what gmail normally does and as far as I know it's RFC-compliant and that's what gmail always does. "Always does" does

Re: Pep8 in SetupTools

2013-12-12 Thread Mark Lawrence
On 12/12/2013 11:13, Chandru Rajendran wrote: Hi all, Please help me with running Pep8 using setuptools. Also help me how to Pep8 for files in a folder. I don't understand what you're asking for. Can you please rephrase your question. Thanks & regards, Chandru -- My fellow Pythonista

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

2013-12-12 Thread Ned Batchelder
On 12/12/13 4:17 AM, wxjmfa...@gmail.com wrote: Le mercredi 11 décembre 2013 11:45:43 UTC+1, Chris Angelico a écrit : On Wed, Dec 11, 2013 at 7:43 PM, Chris Angelico wrote: When you tell a story, it's important to engage the reader from the start. On Wed, Dec 11, 2013 at 8:39 PM, wro

Re: Disable HTML in forum messages (was: Movie (MPAA) ratings and Python?)

2013-12-12 Thread Steve Hayes
On 12 Dec 2013 11:05:35 GMT, Steven D'Aprano wrote: >On Wed, 11 Dec 2013 19:23:39 -0800, rusi wrote: > >> The problem is that then your other mails (may) become plain text and >> your friends/recipients will wonder whether you've entered a >> time-machine and gone back to 1990!! > >Not everything

Re: Optimizing list processing

2013-12-12 Thread MRAB
On 12/12/2013 12:25, Chris Angelico wrote: On Thu, Dec 12, 2013 at 11:08 PM, Steven D'Aprano wrote: P.S. The algorithm I'm working on is a way of generating index and rank tables. Not that it really matters -- what matters is determining whether or not to shift from "make a copy of the list" to

Re: Pep8 in SetupTools

2013-12-12 Thread Glenn Hutchings
On Thursday, 12 December 2013 11:13:51 UTC, Chandru Rajendran wrote: > Please help me with running Pep8  using setuptools. Also help me how to Pep8 > for files in a folder. The tool you're looking for is flake8. It integrates with setuptools, so that you can run 'python setup.py flake8'. Mor

Re: min max from tuples in list

2013-12-12 Thread Peter Otten
Steven D'Aprano wrote: > In any case, sorting in Python is amazingly fast. You may be pleasantly > surprised that a version that sorts your data, while nominally > O(N log N), may be much faster than an O(N) solution that doesn't require > sorted data. If I were a betting man, I'd be willing to wa

Re: Optimizing list processing

2013-12-12 Thread Chris Angelico
On Thu, Dec 12, 2013 at 11:08 PM, Steven D'Aprano wrote: > P.S. The algorithm I'm working on is a way of generating index and rank > tables. Not that it really matters -- what matters is determining whether > or not to shift from "make a copy of the list" to "modify the list in > place". So you'r

Re: min max from tuples in list

2013-12-12 Thread MRAB
On 12/12/2013 11:44, Steven D'Aprano wrote: On Wed, 11 Dec 2013 23:25:53 -0800, Robert Voigtländer wrote: Hi, I have a list like this: a = [(52, 193), (52, 193), (52, 192), ... I need to find a -performant- way to transform this into a list with tuples (a[0],[a[0][1]min],[a[0][1]max]). I'

Re: Optimizing list processing

2013-12-12 Thread Steven D'Aprano
On Wed, 11 Dec 2013 21:26:51 -0500, Terry Reedy wrote: > On 12/11/2013 6:54 PM, Steven D'Aprano wrote: >> I have some code which produces a list from an iterable using at least >> one temporary list, using a Decorate-Sort-Undecorate idiom. > > It is a non-standard version thereof, as DSU usually

Re: min max from tuples in list

2013-12-12 Thread Tim Chase
On 2013-12-12 11:44, Steven D'Aprano wrote: > In any case, sorting in Python is amazingly fast. You may be > pleasantly surprised that a version that sorts your data, while > nominally O(N log N), may be much faster than an O(N) solution that > doesn't require sorted data. If I were a betting man,

Re: min max from tuples in list

2013-12-12 Thread Steven D'Aprano
On Wed, 11 Dec 2013 23:25:53 -0800, Robert Voigtländer wrote: > Hi, > > I have a list like this: > > a = [(52, 193), (52, 193), (52, 192), ... > > > I need to find a -performant- way to transform this into a list with > tuples (a[0],[a[0][1]min],[a[0][1]max]). I'm afraid I don't know what you

  1   2   >