Re: parse a csv file into a text file

2014-02-06 Thread Zhen Zhang
On Wednesday, February 5, 2014 7:17:17 PM UTC-5, Asaf Las wrote: > On Thursday, February 6, 2014 2:10:16 AM UTC+2, Zhen Zhang wrote: > > > Hi, every one. > > > Zhen > > str_t = '3520005,"Toronto (Ont.)",C > ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1' > > list_t = str_t.split

TypeError: 'list' object is not callable

2014-02-06 Thread wilsonmonde
import csv date1 = [] open = [] high = [] low = [] close = [] data = [] with open("C:/Documents and Settings/wilson/My Documents/Downloads/execution.csv", "rb") as csvfile: fastreader = csv.reader(csvfile, delimiter = ",", skipinitialspace=True) count = 0 for row in fastre

Re: parse a csv file into a text file

2014-02-06 Thread Zhen Zhang
On Wednesday, February 5, 2014 7:34:57 PM UTC-5, MRAB wrote: > On 2014-02-06 00:10, Zhen Zhang wrote: > > > Hi, every one. > > > > > > I am a second year EE student. > > > I just started learning python for my project. > > > > > > I intend to parse a csv file with a format like > > > > > >

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Terry Reedy
On 2/5/2014 10:02 PM, msus...@gmail.com wrote: if a == 1: x = y else: x = z y = z + y z = z + 1 While editing this file I accidentally pushed TAB on the line with 'y = z + y'. In this particular case, remove the indentation with x = y if a == 1 else z and indenting the next line is

Re: parse a csv file into a text file

2014-02-06 Thread Zhen Zhang
On Wednesday, February 5, 2014 7:46:04 PM UTC-5, Tim Chase wrote: > On 2014-02-05 16:10, Zhen Zhang wrote: > > > import csv > > > file = open('raw.csv') > > > > Asaf recommended using string methods to split the file. Keep doing > > what you're doing (using the csv module), as it attends to

Re: parse a csv file into a text file

2014-02-06 Thread Zhen Zhang
On Wednesday, February 5, 2014 7:57:26 PM UTC-5, Dave Angel wrote: > Zhen Zhang Wrote in message: > > > Hi, every one. > > > > > > I am a second year EE student. > > > I just started learning python for my project. > > > > > > I intend to parse a csv file with a format like > > > > > >

Re: parse a csv file into a text file

2014-02-06 Thread Asaf Las
On Thursday, February 6, 2014 9:52:43 AM UTC+2, Zhen Zhang wrote: > On Wednesday, February 5, 2014 7:33:00 PM UTC-5, Roy Smith wrote: > I failed to figure out why. OK, you had to look to what i posted second time. The first one is irrelevant. Note that file was emulated using StringIO. in your c

Re: TypeError: 'list' object is not callable

2014-02-06 Thread Peter Otten
wilsonmo...@gmail.com wrote: > TypeError: 'list' object is not callable Hint: > open = [] [...] > with open(..., "rb") as csvfile: -- https://mail.python.org/mailman/listinfo/python-list

Re: parse a csv file into a text file

2014-02-06 Thread Asaf Las
On Thursday, February 6, 2014 10:15:14 AM UTC+2, Asaf Las wrote: > On Thursday, February 6, 2014 9:52:43 AM UTC+2, Zhen Zhang wrote: > case it will be file name. little correction not a file name - file object, file_t is result from open() as you did in your example -- https://mail.python.org/

Re: parse a csv file into a text file

2014-02-06 Thread Jussi Piitulainen
Zhen Zhang writes: ... > I am currently running python 2.7. > > Yes, i thought there must be a print function in python like fprint > in C++ that allows you to print into a file directly. > > But i google about "print string into text file" I got answers using > f.write() instead. :) Indeed. The

Re: TypeError: 'list' object is not callable

2014-02-06 Thread Gary Herron
On 02/06/2014 12:01 AM, wilsonmo...@gmail.com wrote: import csv date1 = [] open = [] high = [] low = [] close = [] data = [] with open("C:/Documents and Settings/wilson/My Documents/Downloads/execution.csv", "rb") as csvfile: fastreader = csv.reader(csvfile, delimiter = ",", skipinitial

Re: TypeError: 'list' object is not callable

2014-02-06 Thread wilsonmonde
Peter Otten於 2014年2月6日星期四UTC+8下午4時22分45秒寫道: > wilsonmo...@gmail.com wrote: > > > > > TypeError: 'list' object is not callable > > > > Hint: > > > > > open = [] > > > > [...] > > > > > with open(..., "rb") as csvfile: i follow in http://www.dyinglovegrape.com/data_analysis/part1/1da

Re: TypeError: 'list' object is not callable

2014-02-06 Thread Asaf Las
On Thursday, February 6, 2014 11:11:13 AM UTC+2, wilso...@gmail.com wrote: > i follow in > http://www.dyinglovegrape.com/data_analysis/part1/1da3.php > still have error > what is the correct writing? give another name to list 'open' at line 'open= []' change it to dopen or whatever. you make name

Re: TypeError: 'list' object is not callable

2014-02-06 Thread Jussi Piitulainen
wilsonmo...@gmail.com writes: > Peter Otten wrote: > > wilsonmo...@gmail.com wrote: > > > > > TypeError: 'list' object is not callable > > > > Hint: > > > > > open = [] > > > > [...] > > > > with open(..., "rb") as csvfile: > > i follow in > http://www.dyinglovegrape.com/data_analysis/part1/1d

Re: Finding size of Variable

2014-02-06 Thread wxjmfauth
Le mercredi 5 février 2014 12:44:47 UTC+1, Chris Angelico a écrit : > On Wed, Feb 5, 2014 at 10:00 PM, Steven D'Aprano > > wrote: > > >> where stopWords.txt is a file of size 4KB > > > > > > My guess is that if you split a 4K file into words, then put the words > > > into a list, you'll proba

Re: Finding size of Variable

2014-02-06 Thread Ned Batchelder
On 2/6/14 5:15 AM, wxjmfa...@gmail.com wrote: sum([sys.getsizeof(c) for c in ['a', 'a EURO', 'aa EURO']*3]) 336 sum([sys.getsizeof(c) for c in ['aa EURO aa EURO']*3]) 150 sum([sys.getsizeof(c.encode('utf-32')) for c in ['a', 'a EURO', 'aa EURO']*3]) 261 sum([sys.getsizeof(c.encode('utf-32

Re: parse a csv file into a text file

2014-02-06 Thread Dave Angel
Zhen Zhang Wrote in message: > > I am currently running python 2.7. > > Yes, i thought there must be a print function in python like fprint in C++ > that allows you to print into a file directly. > But i google about "print string into text file" I got answers using > f.write() instead. :) >

Re: parse a csv file into a text file

2014-02-06 Thread Dave Angel
Dave Angel Wrote in message: > Zhen Zhang Wrote in message: >> > >> I am currently running python 2.7. >> >> Yes, i thought there must be a print function in python like fprint in C++ >> that allows you to print into a file directly. >> But i google about "print string into text file" I got

Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))

2014-02-06 Thread Rustom Mody
On Tuesday, February 4, 2014 8:51:25 PM UTC+5:30, jmf wrote: > Useless and really ugly. Evidently one can do worse: http://www.pip-installer.org/en/latest/installing.html#requirements -- https://mail.python.org/mailman/listinfo/python-list

Re: parse a csv file into a text file

2014-02-06 Thread MRAB
On 2014-02-06 07:52, Zhen Zhang wrote:> On Wednesday, February 5, 2014 7:33:00 PM UTC-5, Roy Smith wrote: >> In article <5c268845-003f-4e24-b27a-c89e9fbfc...@googlegroups.com>, >> Zhen Zhang wrote: >> >> > [code] >> > >> > import csv >> > file = open('raw.csv') >> > reader = csv.reader(file) >>

Re: parse a csv file into a text file

2014-02-06 Thread Rustom Mody
On Thursday, February 6, 2014 6:46:37 PM UTC+5:30, MRAB wrote: > > It's actually the comma that makes it a tuple (except for the 0-tuple > "()"); it's just that it's often necessary to wrap it in (...), and > people then think it's those that are making it a tuple, but it's not! Interesting viewp

Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))

2014-02-06 Thread wxjmfauth
Le jeudi 6 février 2014 13:23:03 UTC+1, Rustom Mody a écrit : > On Tuesday, February 4, 2014 8:51:25 PM UTC+5:30, jmf wrote: > > > > > Useless and really ugly. > > > > Evidently one can do worse: > > > > http://www.pip-installer.org/en/latest/installing.html#requirements or http://cx-free

python and matlab

2014-02-06 Thread Sam
is it able to utilize functions written in Python in Matlab? -- https://mail.python.org/mailman/listinfo/python-list

Re: Finding size of Variable

2014-02-06 Thread wxjmfauth
Le jeudi 6 février 2014 12:10:08 UTC+1, Ned Batchelder a écrit : > On 2/6/14 5:15 AM, wxjmfa...@gmail.com wrote: > > > > > > sum([sys.getsizeof(c) for c in ['a', 'a EURO', 'aa EURO']*3]) > > > 336 > > sum([sys.getsizeof(c) for c in ['aa EURO aa EURO']*3]) > > > 150 > > s

Re: python and matlab

2014-02-06 Thread Sturla Molden
Sam wrote: > is it able to utilize functions written in Python in Matlab? Yes, if you embed the Python interpreter in a MEX-file. -- https://mail.python.org/mailman/listinfo/python-list

Re: parse a csv file into a text file

2014-02-06 Thread Neil Cerutti
On 2014-02-06, Zhen Zhang wrote: > Hi, every one. > > I am a second year EE student. > I just started learning python for my project. > > I intend to parse a csv file with a format like > > 3520005,"Toronto (Ont.)",C > > ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1 [...] into a t

Re: Finding size of Variable

2014-02-06 Thread wxjmfauth
Some mysterious problem with the "euro". Let's take a real "French" char. >>> sys.getsizeof('abc' + 'œ') 46 >>> sys.getsizeof(('abc' + 'œ').encode('utf-32')) 37 or a "German" char, ẞ >>> sys.getsizeof('abc' + '\N{LATIN CAPITAL LETTER SHARP S}') 46 >>> sys.getsizeof(('abc' + '\N{LATIN CAPITAL

Re: python and matlab

2014-02-06 Thread Sam Adams
On Thursday, February 6, 2014 8:55:09 AM UTC-5, Sturla Molden wrote: > Sam wrote: > > > is it able to utilize functions written in Python in Matlab? > > > > Yes, if you embed the Python interpreter in a MEX-file. Thanks Sturla, could you please explain in more details, I am new to Python :) -

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Grant Edwards
On 2014-02-06, msus...@gmail.com wrote: > I had a bug in a Python script recently. The code in question was something > along the lines of: > > if a == 1: > x = y > else: > x = z > y = z + y > z = z + 1 > > While editing this file I accidentally pushed TAB on the line > with 'y = z + y'.

Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))

2014-02-06 Thread Chris Angelico
On Thu, Feb 6, 2014 at 11:23 PM, Rustom Mody wrote: > On Tuesday, February 4, 2014 8:51:25 PM UTC+5:30, jmf wrote: > >> Useless and really ugly. > > Evidently one can do worse: > > http://www.pip-installer.org/en/latest/installing.html#requirements Aside from using a little "chain link" icon rath

Re: parse a csv file into a text file

2014-02-06 Thread Mark Lawrence
On 06/02/2014 14:02, Neil Cerutti wrote: You must open the file in binary mode, as that is what the csv module expects in Python 2.7. newline handling can be enscrewed if you forget. file = open('raw.csv', 'b') I've never opened a file in binary mode to read with the csv module using any Py

Re: parse a csv file into a text file

2014-02-06 Thread Tim Chase
On 2014-02-06 17:40, Mark Lawrence wrote: > On 06/02/2014 14:02, Neil Cerutti wrote: > > > > You must open the file in binary mode, as that is what the csv > > module expects in Python 2.7. newline handling can be enscrewed > > if you forget. > > > > file = open('raw.csv', 'b') > > > > I've never

Using virtualenv to bypass sudoer issues

2014-02-06 Thread Jean-Michel Pichavant
Greetings, Assuming I have a debian workstation for which I don't have any sudo rights, i n order to be able to install / remove python packages, should I be using virtualenv ? Is it a suited solution ? JM -- IMPORTANT NOTICE: The contents of this email and any attachments are con

Re: parse a csv file into a text file

2014-02-06 Thread Tim Golden
On 06/02/2014 17:40, Mark Lawrence wrote: On 06/02/2014 14:02, Neil Cerutti wrote: You must open the file in binary mode, as that is what the csv module expects in Python 2.7. newline handling can be enscrewed if you forget. file = open('raw.csv', 'b') I've never opened a file in binary mod

Logging from a multiprocess application

2014-02-06 Thread Joseph L. Casale
I have a module that has one operation that benefits greatly from being multiprocessed. Its a console based module and as such I have a stream handler and filter associated to the console, obviously the mp based instances need special handling, so I have been experimenting with a socket server i

Re: parse a csv file into a text file

2014-02-06 Thread Neil Cerutti
On 2014-02-06, Tim Chase wrote: > On 2014-02-06 17:40, Mark Lawrence wrote: >> On 06/02/2014 14:02, Neil Cerutti wrote: >> > >> > You must open the file in binary mode, as that is what the csv >> > module expects in Python 2.7. newline handling can be enscrewed >> > if you forget. >> > >> > file =

Re: parse a csv file into a text file

2014-02-06 Thread Tim Chase
[first, it looks like you're posting via Google Groups which annoyingly double-spaces everything in your reply. It's possible to work around this, but you might want to subscribe via email or an actual newsgroup client. You can read more at https://wiki.python.org/moin/GoogleGroupsPython ] On 201

Re: parse a csv file into a text file

2014-02-06 Thread Tim Chase
On 2014-02-06 18:34, Neil Cerutti wrote: > They do actually mention it. > > From: http://docs.python.org/2/library/csv.html > > If csvfile is a file object, it must be opened with > the ‘b’ flag on platforms where that makes a difference. > > So it's stipulated only for file objects on syst

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread msustik
Thanks for all the suggestions! Best, -Matyas -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-06 Thread Robert Kern
On 2014-02-06 17:23, Chris Angelico wrote: On Thu, Feb 6, 2014 at 11:23 PM, Rustom Mody wrote: On Tuesday, February 4, 2014 8:51:25 PM UTC+5:30, jmf wrote: Useless and really ugly. Evidently one can do worse: http://www.pip-installer.org/en/latest/installing.html#requirements Aside from

Re: Logging from a multiprocess application

2014-02-06 Thread Mark Betz
On Thursday, February 6, 2014 1:24:17 PM UTC-5, Joseph L. Casale wrote: > I have a module that has one operation that benefits greatly from being > multiprocessed. > Its a console based module and as such I have a stream handler and filter > associated to > the console, obviously the mp based ins

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Roel Schroeven
msus...@gmail.com schreef: I had a bug in a Python script recently. The code in question was something along the lines of: if a == 1: x = y else: x = z y = z + y z = z + 1 While editing this file I accidentally pushed TAB on the line with 'y = z + y'. My changes were elsewhere and I d

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Larry Martell
On Thu, Feb 6, 2014 at 3:29 PM, Roel Schroeven wrote: > msus...@gmail.com schreef: >> >> I had a bug in a Python script recently. The code in question was >> something along the lines of: >> >> if a == 1: >> x = y >> else: >> x = z >> y = z + y >> z = z + 1 >> >> While editing this file I

ANN: A new version (0.3.6) of python-gnupg has been released.

2014-02-06 Thread Vinay Sajip
A new version of the Python module which wraps GnuPG has been released. What Changed? = This is an enhancement and bug-fix release, but the bug-fixes include some security improvements, so all users are encouraged to upgrade. See the project website ( http://code.google.com/p/python-gn

RE: Logging from a multiprocess application

2014-02-06 Thread Joseph L. Casale
> Maybe check out logstash (http://logstash.net/). That looks pretty slick, I am constrained to using something provided by the packaged modules in this scenario. I think I have it pretty close except for the fact that the LogRecordStreamHandler from the cookbook excepts when the sending proces

Re: ANN: A new version (0.3.6) of python-gnupg has been released.

2014-02-06 Thread Asaf Las
On Thursday, February 6, 2014 10:53:59 PM UTC+2, Vinay Sajip wrote: > A new version of the Python module which wraps GnuPG has been > released. > Cheers > > Vinay Sajip > > Red Dove Consultants Ltd. Hi Good job! One question - is this package runs executable when particular function must be

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Ethan Furman
On 02/06/2014 12:36 PM, Larry Martell wrote: On Thu, Feb 6, 2014 at 3:29 PM, Roel Schroeven wrote: msus...@gmail.com schreef: While editing this file I accidentally pushed TAB on the line with 'y = z + y'. My suggestion: configure your editor to insert the appropriate amount of spaces instea

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Larry Martell
On Thu, Feb 6, 2014 at 4:32 PM, Ethan Furman wrote: > On 02/06/2014 12:36 PM, Larry Martell wrote: >> >> On Thu, Feb 6, 2014 at 3:29 PM, Roel Schroeven wrote: >>> >>> msus...@gmail.com schreef: While editing this file I accidentally pushed TAB on the line with 'y = z + y'.

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 9:09 AM, Larry Martell wrote: > The Tab key is not evil, it's the tab character (Ctrl-I). I have been > bitten by this many time when I had to work on a program written by > another. They had their tab stops set at 5 or 6, mine is set at 4, or > they did not have expandtab s

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Asaf Las
On Friday, February 7, 2014 12:30:17 AM UTC+2, Chris Angelico wrote: > On Fri, Feb 7, 2014 at 9:09 AM, Larry Martell wrote: > > > The Tab key is not evil, it's the tab character (Ctrl-I). I have been > > bitten by this many time when I had to work on a program written by > > another. They had the

Re: ANN: A new version (0.3.6) of python-gnupg has been released.

2014-02-06 Thread Piet van Oostrum
Vinay Sajip writes: > A new version of the Python module which wraps GnuPG has been > released. > There seem to be 2 gnupg modules for Python. The other one has version number 1.2.5. Very confusing! -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mai

Question about `list.insert`

2014-02-06 Thread cool-RR
Hi, I'm curious. If I append an item to a list from the left using `list.insert`, will Python always move the entire list one item to the right (which can be super-slow) or will it check first to see whether it can just allocate more memory to the left of the list and put the item there, saving

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 10:01 AM, Asaf Las wrote: > pep8 pushed \t to dark side in Python. Only for the Python stdlib, and only because a decision has to be made one way or the other. I believe Guido stated at one point that there was only a very weak push toward "spaces only" rather than "tabs on

Re: Question about `list.insert`

2014-02-06 Thread Terry Reedy
On 2/6/2014 6:59 PM, cool-RR wrote: Hi, I'm curious. If I append an item to a list from the left using `list.insert`, will Python always move the entire list one item to the right (which can be super-slow) or will it check first to see whether it can just allocate more memory to the left of the

Re: Question about `list.insert`

2014-02-06 Thread MRAB
On 2014-02-06 23:59, cool-RR wrote: Hi, I'm curious. If I append an item to a list from the left using `list.insert`, will Python always move the entire list one item to the right (which can be super-slow) or will it check first to see whether it can just allocate more memory to the left of the

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Roy Smith
In article , Scott W Dunning wrote: > I am having trouble figuring out how to remove spacesŠ. > > Assume variables exist for minutes and seconds. Each variable is an integer. > How would you create a string in the format, > > 3:11 > > with no spaces. where 3 is minutes and 11 is seconds. >

Re: Question about `list.insert`

2014-02-06 Thread Asaf Las
On Friday, February 7, 2014 5:00:56 AM UTC+2, Roy Smith wrote: > In article , > > Dave Angel wrote: > > list does not promise better than O(1) behavior > I'm not aware of any list implementations, in any language, that > promises better than O(1) behavior for any operations. Perhaps there is >

Re: Question about `list.insert`

2014-02-06 Thread Rustom Mody
On Friday, February 7, 2014 8:44:43 AM UTC+5:30, Chris Angelico wrote: > On Fri, Feb 7, 2014 at 2:00 PM, Roy Smith wrote: > > Dave Angel wrote: > >> list does not promise better than O(1) behavior > > I'm not aware of any list implementations, in any language, that > > promises better than O(1) b

Re: Question about `list.insert`

2014-02-06 Thread Rustom Mody
On Friday, February 7, 2014 8:30:56 AM UTC+5:30, Roy Smith wrote: > Dave Angel wrote: > > > list does not promise better than O(1) behavior > > I'm not aware of any list implementations, in any language, that > promises better than O(1) behavior for any operations. Perhaps there is > O(j), wh

Re: Question about `list.insert`

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 2:00 PM, Roy Smith wrote: > In article , > Dave Angel wrote: > >> list does not promise better than O(1) behavior > > I'm not aware of any list implementations, in any language, that > promises better than O(1) behavior for any operations. Perhaps there is > O(j), where y

Re: Question about `list.insert`

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 2:29 PM, Rustom Mody wrote: > On Friday, February 7, 2014 8:44:43 AM UTC+5:30, Chris Angelico wrote: >> On Fri, Feb 7, 2014 at 2:00 PM, Roy Smith wrote: >> > Dave Angel wrote: >> >> list does not promise better than O(1) behavior >> > I'm not aware of any list implementati

Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
I am having trouble figuring out how to remove spaces…. Assume variables exist for minutes and seconds. Each variable is an integer. How would you create a string in the format, 3:11 with no spaces. where 3 is minutes and 11 is seconds. Obviously when I… print minutes, “:”, seconds I get 3

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread msustik
On Thursday, February 6, 2014 12:29:36 PM UTC-8, Roel Schroeven wrote: > > My suggestion: configure your editor to insert the appropriate amount of > > spaces instead of a tab when you press the tab key. You misunderstood the problem, but managed to start a Tab war! :-) My emacs inserts 4 spac

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
Is this what you’re talking about? minutes = “3” seconds = “11” print int(minutes), ”:" int(seconds) That’s what you mean by turning a string into an int right? Not sure how to add strings together though. On Feb 6, 2014, at 6:37 PM, Chris Angelico wrote: > On Fri, Feb 7, 2014 at 12:22

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
what exactly is the “%d:%02d”% saying? On Feb 6, 2014, at 6:25 PM, Roy Smith wrote: > In article , > Scott W Dunning wrote: > >> I am having trouble figuring out how to remove spacesŠ. >> >> Assume variables exist for minutes and seconds. Each variable is an integer. >> How would you cre

Re: Question about `list.insert`

2014-02-06 Thread Gregory Ewing
Roy Smith wrote: O(-1). In Soviet Russia, operation performs you! It's rumoured that the PSU is developing a time machine module that can achieve O(-n), but -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Roy Smith
On Feb 6, 2014, at 11:12 PM, Scott W Dunning wrote: > what exactly is the “%d:%02d”% saying? Python uses string format specifiers similar to C's printf() %d means, "convert an integer to a decimal string" %2d means the same, plus, "make the result 2 columns wide" and, finally, %02d means, "a

Re: Question about `list.insert`

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 2:11 PM, Tim Chase wrote: > On 2014-02-06 22:00, Roy Smith wrote: >> > list does not promise better than O(1) behavior >> >> I'm not aware of any list implementations, in any language, that >> promises better than O(1) behavior for any operations. Perhaps >> there is O(j),

Re: trivial import question

2014-02-06 Thread John Ladasky
On Wednesday, February 5, 2014 9:52:33 AM UTC-8, nevets...@gmail.com wrote: > The underscore relative to a prfixed abbb. Is to be noted Reviving a fourteen year-old thread? That has to be some kind of record. -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-06 Thread Rustom Mody
On Friday, February 7, 2014 12:59:19 AM UTC+5:30, Robert Kern wrote: > When I looked at it earlier today, I got a default "cannot find this glyph" > box > instead of the chain icon. I assumed that is what Rustom was referring to. > It's working for me now. Yes I was getting unicode number-box

Re: Question about `list.insert`

2014-02-06 Thread Roy Smith
In article , Tim Chase wrote: > On 2014-02-06 22:00, Roy Smith wrote: > > > list does not promise better than O(1) behavior > > > > I'm not aware of any list implementations, in any language, that > > promises better than O(1) behavior for any operations. Perhaps > > there is O(j), where yo

Re: Question about `list.insert`

2014-02-06 Thread Roy Smith
In article , Dave Angel wrote: > list does not promise better than O(1) behavior I'm not aware of any list implementations, in any language, that promises better than O(1) behavior for any operations. Perhaps there is O(j), where you just imagine the operation was performed? -- https://mail

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 3:09 PM, Scott W Dunning wrote: > Is this what you’re talking about? > > minutes = “3” > seconds = “11” > > print int(minutes), ”:" int(seconds) > > That’s what you mean by turning a string into an int right? Not sure how to > add strings together though. > Well, that's w

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 12:20 PM, wrote: > It would be possible to disable the Tab key completely and type in the spaces > all the time. (It is much less likely that one would press the space bar > accidentally four times or hold it down to get 4 spaces by mistake.) > > Unfortunately this means

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 12:22 PM, Scott W Dunning wrote: > Assume variables exist for minutes and seconds. Each variable is an integer. > How would you create a string in the format, > > 3:11 > > with no spaces. where 3 is minutes and 11 is seconds. > > > Obviously when I… > > print minutes, “:”, s

Re: Question about `list.insert`

2014-02-06 Thread Dan Stromberg
On Thu, Feb 6, 2014 at 3:59 PM, cool-RR wrote: > Hi, > > I'm curious. If I append an item to a list from the left using `list.insert`, > will Python always move the entire list one item to the right (which can be > super-slow) or will it check first to see whether it can just allocate more > me

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
Oops, thought you said turning a str into an int. Yeah, I’m actually using Idle on a mac. I keep trying differnt things but, I’m just very new to this. Is this what you’re talking about? minutes=3 seconds=11 print str(minutes) + ‘:’ + str(seconds) Unfortunately I keep getting an error. Al

Re: Question about `list.insert`

2014-02-06 Thread Terry Reedy
On 2/6/2014 7:42 PM, MRAB wrote: On 2014-02-06 23:59, cool-RR wrote: Hi, I'm curious. If I append an item to a list from the left using `list.insert`, will Python always move the entire list one item to the right (which can be super-slow) or will it check first to see whether it can just alloca

Re: Question about `list.insert`

2014-02-06 Thread Tim Chase
On 2014-02-06 22:00, Roy Smith wrote: > > list does not promise better than O(1) behavior > > I'm not aware of any list implementations, in any language, that > promises better than O(1) behavior for any operations. Perhaps > there is O(j), where you just imagine the operation was performed?

Re:Question about `list.insert`

2014-02-06 Thread Dave Angel
cool-RR Wrote in message: > Hi, > > I'm curious. If I append an item to a list from the left using `list.insert`, > will Python always move the entire list one item to the right (which can be > super-slow) or will it check first to see whether it can just allocate more > memory to the left of

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Chris Angelico
On Fri, Feb 7, 2014 at 4:01 PM, Scott W Dunning wrote: > Oops, thought you said turning a str into an int. Yeah, I’m actually using > Idle on a mac. I keep trying differnt things but, I’m just very new to this. > > Is this what you’re talking about? > > minutes=3 > seconds=11 > > print str(minu

Re: Question about `list.insert`

2014-02-06 Thread Asaf Las
On Friday, February 7, 2014 6:52:24 AM UTC+2, Dan Stromberg wrote: > On Thu, Feb 6, 2014 at 3:59 PM, cool-RR wrote: > > I'm pretty sure it'll slide all the existing elements right one > position, and add at the leftmost position just opened up - assuming > you're inserting at position 0. > > As

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Ben Finney
Scott W Dunning writes: > I keep trying differnt things but, I’m just very new to this. A few things that will make your communications more fruitful: * Please don't top-post. Trim the quoted material to the parts relevant for your response, and respond inline like a normal discussion. htt

Re: python and matlab

2014-02-06 Thread Sturla Molden
Sam Adams wrote: > Thanks Sturla, could you please explain in more details, I am new to Python :) All the information you need to extend or embed Python is in the docs. Apart from that, why do you need Matlab? A distro like Enthought Canopy or Anaconda has all the tools you will ever need for

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Scott W Dunning
> > A few things that will make your communications more fruitful: > > * Please don't top-post. Trim the quoted material to the parts relevant > for your response, and respond inline like a normal discussion. Oh, ok sorry about that. Like this? > > * Ensure that your message composer does

Re: Python 2.7.6 help with white spaces?

2014-02-06 Thread Ben Finney
Scott W Dunning writes: > > * Please don't top-post. Trim the quoted material to the parts > > relevant for your response, and respond inline like a normal > > discussion. > > Oh, ok sorry about that. Like this? Yes. You also need to preserve the attribution lines (the lines inserted for each

Re: python and matlab

2014-02-06 Thread Rustom Mody
On Friday, February 7, 2014 10:58:26 AM UTC+5:30, Sturla Molden wrote: > Sam Adams wrote: > > Thanks Sturla, could you please explain in more details, I am new to Python > > :) > All the information you need to extend or embed Python is in the docs. > Apart from that, why do you need Matlab?