Re: OT: This Swift thing

2014-06-05 Thread Travis Griggs
> On Jun 5, 2014, at 1:14, Alain Ketterlin wrote: > > Swift's memory management is similar to python's (ref. counting). Which > makes me think that a subset of python with the same type safety would > be an instant success. Except that while you don't need to regularly worry about cycles in py

Re: OT: This Swift thing

2014-06-05 Thread Steven D'Aprano
On Fri, 06 Jun 2014 01:54:32 +0200, Sturla Molden wrote: > When is static analysis actually needed and for what purpose? The > problem seems to be that managers, team leaders, CEOs, or (insert your > favorite tite), are not qualified to answer this question. So to be on > the safe side they go for

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Ethan Furman
On 06/05/2014 04:30 PM, Marko Rauhamaa wrote: What I'm afraid of is that the Python developers are reserving the right to remove the buffer and detach attributes from the standard streams in a future version. Being afraid is silly. If you have a question, ask it. -- ~Ethan~ -- https://mail.

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Rustom Mody
On Friday, June 6, 2014 8:50:57 AM UTC+5:30, Chris Angelico wrote: > kernel doesn't actually do *anything* with the string, it just passes > it right along to the file system. Which is what Marko (and others like Armin) are asking of python (treated as a processing 'kernel'): "I know what I am do

Re: OT: This Swift thing

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 1:16 PM, Steven D'Aprano wrote: > On Fri, 06 Jun 2014 09:21:26 +1000, Chris Angelico wrote: > >> On Fri, Jun 6, 2014 at 9:02 AM, Sturla Molden >> wrote: >>> You cannot spoof the type of an object in Python. >> >> Not without fiddling around. Python 3.4 on win32: > [...] >>>

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 1:11 PM, Rustom Mody wrote: > All character strings, including > | filenames, are treated by the kernel in such a way that THEY > | APPEAR TO IT ONLY AS STRINGS OF BYTES. Yep, the real issue here is file systems, not the kernel. But yes, this is one of the very few places w

Re: OT: This Swift thing

2014-06-05 Thread Steven D'Aprano
On Fri, 06 Jun 2014 09:21:26 +1000, Chris Angelico wrote: > On Fri, Jun 6, 2014 at 9:02 AM, Sturla Molden > wrote: >> You cannot spoof the type of an object in Python. > > Not without fiddling around. Python 3.4 on win32: [...] x = Foo() x.spam() > <__main__.Foo object at 0x0169AB10> s

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Rustom Mody
On Friday, June 6, 2014 4:22:22 AM UTC+5:30, Chris Angelico wrote: > On Fri, Jun 6, 2014 at 8:35 AM, Rustom Mody wrote: > > And then ask how Linux (in your and Stallman's sense) differs from > > Windows in how the filesystem handles things like filenames? > What are you testing of the kernel? Mos

Re: OT: This Swift thing

2014-06-05 Thread Steven D'Aprano
On Thu, 05 Jun 2014 23:13:00 +0100, Mark Lawrence wrote: > I'll simply say that I > understand Python to be strongly, dynamically typed. Correct. Anyone who hasn't done so needs to read this: http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/ I wouldn't quite go so far as to say

Re: Missing stack frames?

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 12:16 PM, Nikolaus Rath wrote: > - Is there some way to make the call stack for destructors less confusing? First off, either don't have refloops, or explicitly break them. That'll at least make things a bit more predictable; in CPython, you'll generally see destructors ca

Re: Missing stack frames?

2014-06-05 Thread Nikolaus Rath
dieter writes: [...] > Someone else already mentioned that the "close" call > can come from a destructor. Destructors can easily be called > at not obvious places (e.g. "s = C(); ... x = [s for s in ...]"; > in this example the list comprehension calls the "C" destructor > which is not obvious whe

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Terry Reedy
On 6/5/2014 7:30 PM, Marko Rauhamaa wrote: Steven D'Aprano : "Can be replaced" by who? By the Python developers? By me? By random library calls? By you. sys.stdout and friends are writable. Any code you call may have replaced them with another file-like object, and you should honour that. I

Re: Missing stack frames?

2014-06-05 Thread Nikolaus Rath
Nikolaus Rath writes: > Chris Angelico writes: >> On Wed, Jun 4, 2014 at 12:30 PM, Nikolaus Rath wrote: >>> I've instrumented one of my unit tests with a conditional >>> 'pdb.set_trace' in some circumstances (specifically, when a function is >>> called by a thread other than MainThread). >> >> I

Re: How to use SQLite (sqlite3) more efficiently

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 8:57 AM, R Johnson wrote: > Sorry about that. As you can probably tell, I'm relatively new to using > mailing lists. I'm not exactly sure why that occurred like it did. I'll try > adding "Re:" in front of the subject when I send this e-mail, and see if it > works right this

Re: Missing stack frames?

2014-06-05 Thread Nikolaus Rath
Paul Rubin writes: > Nikolaus Rath writes: >> Still no context before the ominous close() call. I'm very confused. > > close() could be getting called from a destructor as the top level > function of a thread exits, or something like that. Shouldn't the destructor have its own stack frame then,

Re: How to use SQLite (sqlite3) more efficiently

2014-06-05 Thread R Johnson
Sorry for the attachment issue. I'm used to the wxPython-users Google group, where posters are instructed to attach code to their post instead of including it in the body of the message. I placed the latest version of my sample code below, since I made a few minor changes to it after posting it

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Ned Deily
In article , Roy Smith wrote: > In article , > Ned Deily wrote: > > Roy is using MT-NewsWatcher as a client. > Yes. Except for the fact that it hasn't kept up with unicode, I find > the U/I pretty much perfect. I imagine at some point I'll be force to > look elsewhere, but then again, netne

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
On 06/06/14 02:13, Roy Smith wrote: > Well, you *can* play evil games with the struct module :-) But then you are asking for it, it does not happen by accident. Sturla -- https://mail.python.org/mailman/listinfo/python-list

Re: Forking PyPI package

2014-06-05 Thread Wiktor
On Fri, 6 Jun 2014 03:37:56 +1000, Chris Angelico wrote: > On Fri, Jun 6, 2014 at 2:56 AM, Wiktor wrote: >> I guess, I'll try to do what Chris proposed. Forget about this >> implementation and write python script from the scratch looking only at the >> original JavaScript version. :-/ > > Sadl

Re: OT: This Swift thing

2014-06-05 Thread Roy Smith
In article , Sturla Molden wrote: > On 05/06/14 22:27, Alain Ketterlin wrote: > > I have seen dozens of projects where Python was dismissed because of the > > lack of static typing, and the lack of static analysis tools. > > If you are worried your code will bring down the next Ariane launch,

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Roy Smith
In article , Ned Deily wrote: > In article <8681edf0-7a1f-4110-9f87-a8cd0988c...@googlegroups.com>, > Rustom Mody wrote: > > > On Friday, June 6, 2014 2:30:26 AM UTC+5:30, Roy Smith wrote: > > > Just for fun, I took a screen-shot of what this looks like in my > > > newsreader. URL below. L

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Ian Kelly
On Thu, Jun 5, 2014 at 2:34 PM, Albert-Jan Roskam wrote: >> If you want to be really picky about removing exactly one line >> terminator, then this captures all the relatively modern variations: >> re.sub('\r?\n$|\n?\r$', line, '', count=1) > > or perhaps: re.sub("[^ \S]+$", "", line) That will r

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
On 06/06/14 01:41, Mark Lawrence wrote: > s/almost// :) Sometimes it is the right decision, like when your code is firmware for some avionics or medial life-support apparatus. Sturla -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
On 05/06/14 22:27, Alain Ketterlin wrote: > I have seen dozens of projects where Python was dismissed because of the > lack of static typing, and the lack of static analysis tools. If you are worried your code will bring down the next Ariane launch, I can understand this argument. If you are onl

Re: OT: This Swift thing

2014-06-05 Thread Mark Lawrence
On 06/06/2014 00:03, Sturla Molden wrote: Alain Ketterlin wrote: Many of these students suggest Python as the development language (they learned it and liked it), and the suggestion is (almost) always rejected, in favor of Java or C# or C/C++. And it was almost always the wrong decision...

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 9:30 AM, Marko Rauhamaa wrote: > Steven D'Aprano : > >>> "Can be replaced" by who? By the Python developers? By me? By random >>> library calls? >> >> By you. sys.stdout and friends are writable. Any code you call may >> have replaced them with another file-like object, and

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Marko Rauhamaa
Steven D'Aprano : >> "Can be replaced" by who? By the Python developers? By me? By random >> library calls? > > By you. sys.stdout and friends are writable. Any code you call may > have replaced them with another file-like object, and you should > honour that. I can of course overwrite even sys a

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Marko Rauhamaa
Steven D'Aprano : > In any case, I reject your premise. ALL data types are constructed on > top of bytes, Only in a very dull sense. > and so long as you allow applications *any way* to coerce data types > to different data types, you allow them to see "inside the black box". I can't see the by

Re: OT: This Swift thing

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 9:02 AM, Sturla Molden wrote: > You cannot spoof the type of an object in Python. Not without fiddling around. Python 3.4 on win32: >>> class Foo: def spam(self): print(self,"spams") >>> class Bar: def spam(self): print(self,"eats spam") >>> x = F

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Steven D'Aprano
On Thu, 05 Jun 2014 23:21:35 +0300, Marko Rauhamaa wrote: > Terry Reedy : > >> On 6/5/2014 5:53 AM, Marko Rauhamaa wrote: >>> Chris Angelico : >>> If the standard streams are so crucial, why are their most obvious interfaces insignificant to you? >>> >>> I want the standard streams to c

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
Alain Ketterlin wrote: > Many of these students suggest Python as the > development language (they learned it and liked it), and the suggestion > is (almost) always rejected, in favor of Java or C# or C/C++. And it was almost always the wrong decision... Sturla -- https://mail.python.org/mail

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
Chris Angelico wrote: > "Type safety" means many different things to different people. What > Python has is untyped variables, and hierarchically typed objects. > It's impossible to accidentally treat an integer as a float, and have > junk data [1]. It's impossible to accidentally call a base cla

Re: OT: This Swift thing

2014-06-05 Thread Steven D'Aprano
On Thu, 05 Jun 2014 22:07:18 +0200, Alain Ketterlin wrote: > Sturla Molden writes: > >> On 05/06/14 10:14, Alain Ketterlin wrote: >> >>> Type safety. >> >> Perhaps. Python has strong type safety. > > Come on. No, Sturla is correct. Python has strongly-typed values and dynamically- typed variab

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
Alain Ketterlin wrote: >> Perhaps. Python has strong type safety. > > Come on. You cannot spoof the type of an object in Python. In C++ you can downcast any address to void* and make an object be treated as anything. You cannot make Python treat an int as a float and return garbage. Types in Py

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Steven D'Aprano
On Thu, 05 Jun 2014 21:30:11 +0300, Marko Rauhamaa wrote: > Terry Reedy : > >> Different OSes *do* have different assumptions. Both MacOSX and current >> Windows use (UCS-2 or) UTF-16 for text. > > Linux can use anything for text; UTF-8 has become a de-facto standard. > > How text is represente

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
Alain Ketterlin wrote: >> And that's counting only CPU time. If you count wall time, your >> typical Python program spends most of its time deep inside kernel API >> calls, waiting for the user or I/O or something. > > But this is true of any IO-bound program, whatever the language. Exactly, th

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Ned Deily
In article <8681edf0-7a1f-4110-9f87-a8cd0988c...@googlegroups.com>, Rustom Mody wrote: > On Friday, June 6, 2014 2:30:26 AM UTC+5:30, Roy Smith wrote: > > Just for fun, I took a screen-shot of what this looks like in my > > newsreader. URL below. Looks like something chomped on unicode pretty

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 8:35 AM, Rustom Mody wrote: > On Thursday, June 5, 2014 10:58:43 PM UTC+5:30, Chris Angelico wrote: >> On Fri, Jun 6, 2014 at 2:52 AM, Marko Rauhamaa wrote: >> > That linux text is not the same thing as Python's text. Conceptually, >> > Python text is a sequence of 32-bit in

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Rustom Mody
On Thursday, June 5, 2014 10:58:43 PM UTC+5:30, Chris Angelico wrote: > On Fri, Jun 6, 2014 at 2:52 AM, Marko Rauhamaa wrote: > > That linux text is not the same thing as Python's text. Conceptually, > > Python text is a sequence of 32-bit integers. Linux text is a sequence > > of 8-bit integers.

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Rustom Mody
On Friday, June 6, 2014 2:30:26 AM UTC+5:30, Roy Smith wrote: > Just for fun, I took a screen-shot of what this looks like in my > newsreader. URL below. Looks like something chomped on unicode pretty > hard :-) > > http://www.panix.com/~roy/unicode.pdf Yii -- ht

Re: Tabs (was Re: OT: This Swift thing)

2014-06-05 Thread Terry Reedy
On 6/5/2014 3:05 PM, Terry Reedy wrote: On 6/5/2014 4:39 AM, Steven D'Aprano wrote: Treating \t as a single space would be pathetic but standard. Treating it as (up to) 8 spaces would be more useful, and standard. Rendering it as a picture of a banana dancing on the ceiling would be silly and

Re: OT: This Swift thing

2014-06-05 Thread Terry Reedy
On 6/5/2014 4:07 PM, Alain Ketterlin wrote: When I compile Cython modules I use LLVM on this computer. Cython is not Python, it is another language, with an incompatible syntax. Cython compiles Python with optional extensions that allow additional speed ups over compiling Python as is. In o

Re:How to use SQLite (sqlite3) more efficiently

2014-06-05 Thread Dave Angel
R Johnson Wrote in message: > > I've attached some new sample code in which I've attempted to correct > various things that you mentioned. Attachments don't work well for many people using this list. I for one can't even see them. -- DaveA -- https://mail.python.org/mailman/listinfo/py

Re: OT: This Swift thing

2014-06-05 Thread Mark Lawrence
On 05/06/2014 22:53, Marko Rauhamaa wrote: Mark Lawrence : On 05/06/2014 21:07, Alain Ketterlin wrote: Sturla Molden writes: On 05/06/14 10:14, Alain Ketterlin wrote: Type safety. Perhaps. Python has strong type safety. Come on. I don't understand that comment, please explain. I guess

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Terry Reedy
On 6/5/2014 4:21 PM, Marko Rauhamaa wrote: Terry Reedy : On 6/5/2014 5:53 AM, Marko Rauhamaa wrote: Chris Angelico : If the standard streams are so crucial, why are their most obvious interfaces insignificant to you? I want the standard streams to consume and produce bytes. Easy. Read th

Re: any wheel experts

2014-06-05 Thread Mark Lawrence
On 05/06/2014 22:42, Ned Deily wrote: In article , Rustom Mody wrote: On Thursday, June 5, 2014 10:21:06 PM UTC+5:30, Robin Becker wrote: I used to create exe files for windows, but the latest and greatest concept is wheels .whl files. If someone here knows (and answers!) great. Else you'

Re: OT: This Swift thing

2014-06-05 Thread Marko Rauhamaa
Mark Lawrence : > On 05/06/2014 21:07, Alain Ketterlin wrote: >> Sturla Molden writes: >>> On 05/06/14 10:14, Alain Ketterlin wrote: Type safety. >>> Perhaps. Python has strong type safety. >> Come on. > > I don't understand that comment, please explain. I guess what is referred to is stati

Re: any wheel experts

2014-06-05 Thread Ned Deily
In article , Rustom Mody wrote: > On Thursday, June 5, 2014 10:21:06 PM UTC+5:30, Robin Becker wrote: > > I used to create exe files for windows, but the latest and greatest concept > > is > > wheels .whl files. > > If someone here knows (and answers!) great. > Else you'll probably get more i

Re: OT: This Swift thing

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 7:23 AM, Mark Lawrence wrote: > On 05/06/2014 21:07, Alain Ketterlin wrote: >> >> Sturla Molden writes: >> >>> On 05/06/14 10:14, Alain Ketterlin wrote: >>> Type safety. >>> >>> Perhaps. Python has strong type safety. >> >> Come on. > > I don't understand that comment,

Re: Matplotlib - specifying bin widths

2014-06-05 Thread Mark Lawrence
On 05/06/2014 16:54, Jamie Mitchell wrote: Hello all! Instead of setting the number of bins I want to set the bin width. I would like my bins to go from 1.7 to 2.4 in steps of 0.05. How do I say this in the code? Cheers, Jamie This should help http://stackoverflow.com/questions/6986986/b

Re: OT: This Swift thing

2014-06-05 Thread Mark Lawrence
On 05/06/2014 21:27, Alain Ketterlin wrote: Chris Angelico writes: On Thu, Jun 5, 2014 at 7:42 PM, Alain Ketterlin wrote: Chris Angelico writes: On Thu, Jun 5, 2014 at 6:14 PM, Alain Ketterlin wrote: Swift's memory management is similar to python's (ref. counting). Which makes me think

Re: OT: This Swift thing

2014-06-05 Thread Mark Lawrence
On 05/06/2014 21:07, Alain Ketterlin wrote: Sturla Molden writes: On 05/06/14 10:14, Alain Ketterlin wrote: Type safety. Perhaps. Python has strong type safety. Come on. I don't understand that comment, please explain. -- My fellow Pythonistas, ask not what our language can do for yo

Re: OT: This Swift thing

2014-06-05 Thread Alain Ketterlin
Chris Angelico writes: > On Fri, Jun 6, 2014 at 6:07 AM, Alain Ketterlin > wrote: >>> Perhaps, perhaps not. My experience is that only a small percentage of >>> the CPU time is spent in the Python interpreter. >> >> Basically, you're saying that a major fraction of python programs is >> written

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Roy Smith
In article , Albert-Jan Roskam wrote: > - Original Message - > From: Ian Kelly > > To: Python > Cc: > Sent: Thursday, June 5, 2014 > 10:18 PM > Subject: Re: Unicode and Python - how often do you index strings? > > > On Thu, Jun 5, 2014 at 1:58 PM, Paul Rubin > > wrote: >>

Re: Pandas question

2014-06-05 Thread Mark Lawrence
On 05/06/2014 20:40, Albert-Jan Roskam wrote: Hi, [snipped as I can't answer directly] but see this http://pandas.pydata.org/community.html for support options. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- Thi

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Albert-Jan Roskam
- Original Message - > From: Ian Kelly > To: Python > Cc: > Sent: Thursday, June 5, 2014 10:18 PM > Subject: Re: Unicode and Python - how often do you index strings? > > On Thu, Jun 5, 2014 at 1:58 PM, Paul Rubin > wrote: >> Ryan Hiebert writes: >>> How so? I was using line=l

Re: OT: This Swift thing

2014-06-05 Thread Alain Ketterlin
Chris Angelico writes: > On Thu, Jun 5, 2014 at 7:42 PM, Alain Ketterlin > wrote: >> Chris Angelico writes: >> >>> On Thu, Jun 5, 2014 at 6:14 PM, Alain Ketterlin >>> wrote: Swift's memory management is similar to python's (ref. counting). Which makes me think that a subset of python

Re: How to use SQLite (sqlite3) more efficiently

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 6:12 AM, R Johnson wrote: > I forgot to mention that the scripts Peter pointed to used REPLACE instead > of INSERT OR REPLACE. The SQLite documentation says that REPLACE is an alias > for INSERT OR REPLACE provided for compatibility with other SQL database > engines. Is ther

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Marko Rauhamaa
Terry Reedy : > On 6/5/2014 5:53 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> If the standard streams are so crucial, why are their most obvious >>> interfaces insignificant to you? >> >> I want the standard streams to consume and produce bytes. > > Easy. Read the manual entry for stdxxx.

Pandas question

2014-06-05 Thread Albert-Jan Roskam
Hi, I am new to Pandas. I am trying to remove the lower and upper 15 percentiles of interest rates within a day. The index column is the date. Below is some code, but how do I apply the trim function day-by-day? I tried using grouped() in conjunction with apply(), but that turned out to be an e

How to use SQLite (sqlite3) more efficiently

2014-06-05 Thread R Johnson
I forgot to mention that the scripts Peter pointed to used REPLACE instead of INSERT OR REPLACE. The SQLite documentation says that REPLACE is an alias for INSERT OR REPLACE provided for compatibility with other SQL database engines. Is there a preference for one or the other? I had changed my

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Ian Kelly
On Thu, Jun 5, 2014 at 1:58 PM, Paul Rubin wrote: > Ryan Hiebert writes: >> How so? I was using line=line[:-1] for removing the trailing newline, and >> just replaced it with rstrip('\n'). What are you doing differently? > > rstrip removes all the newlines off the end, whether there are zero or >

Re: OT: This Swift thing

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 6:07 AM, Alain Ketterlin wrote: >> Perhaps, perhaps not. My experience is that only a small percentage of >> the CPU time is spent in the Python interpreter. > > Basically, you're saying that a major fraction of python programs is > written in another language. An interestin

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Ryan Hiebert
On Thu, Jun 5, 2014 at 2:59 PM, Chris Angelico wrote: > On Fri, Jun 6, 2014 at 4:52 AM, Ryan Hiebert wrote: > > 2014-06-05 13:42 GMT-05:00 Johannes Bauer : > > > >> On 05.06.2014 20:16, Paul Rubin wrote: > >> > Johannes Bauer writes: > >> >> line = line[:-1] > >> >> Which truncates the trailing

Re: OT: This Swift thing

2014-06-05 Thread Alain Ketterlin
Sturla Molden writes: > On 05/06/14 10:14, Alain Ketterlin wrote: > >> Type safety. > > Perhaps. Python has strong type safety. Come on. [...] >>(And with it comes better performance ---read battery >> life--- and better static analysis tools, etc.) > > Perhaps, perhaps not. My experience is th

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Paul Rubin
Ryan Hiebert writes: > How so? I was using line=line[:-1] for removing the trailing newline, and > just replaced it with rstrip('\n'). What are you doing differently? rstrip removes all the newlines off the end, whether there are zero or multiple. In perl the difference is chomp vs chop. line=l

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 4:52 AM, Ryan Hiebert wrote: > 2014-06-05 13:42 GMT-05:00 Johannes Bauer : > >> On 05.06.2014 20:16, Paul Rubin wrote: >> > Johannes Bauer writes: >> >> line = line[:-1] >> >> Which truncates the trailing "\n" of a textfile line. >> > >> > use line.rstrip() for that. >> >>

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Ryan Hiebert
2014-06-05 13:42 GMT-05:00 Johannes Bauer : > On 05.06.2014 20:16, Paul Rubin wrote: > > Johannes Bauer writes: > >> line = line[:-1] > >> Which truncates the trailing "\n" of a textfile line. > > > > use line.rstrip() for that. > > rstrip has different functionality than what I'm doing. How so

Tabs (was Re: OT: This Swift thing)

2014-06-05 Thread Terry Reedy
On 6/5/2014 4:39 AM, Steven D'Aprano wrote: On Wed, 04 Jun 2014 22:43:05 -0400, Terry Reedy wrote: Many mail readers treat \t as a null char since it actually has no standard translation into screen space. No *single* standard. I challenge that assertion. There are two standard translations

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Terry Reedy
On 6/5/2014 5:53 AM, Marko Rauhamaa wrote: Chris Angelico : If the standard streams are so crucial, why are their most obvious interfaces insignificant to you? I want the standard streams to consume and produce bytes. Easy. Read the manual entry for stdxxx. "To write or read binary data fr

Re: OT: This Swift thing

2014-06-05 Thread Mark H Harris
On 6/5/14 12:18 PM, Michael Torrie wrote: No they won't be used in the same niche. Objective C is certainly not used in the same niche as Python, so why would Swift? I don't expect to see any major OS X app written completely in Python, nor would I expect and of the core frameworks to be writte

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Johannes Bauer
On 05.06.2014 20:16, Paul Rubin wrote: > Johannes Bauer writes: >> line = line[:-1] >> Which truncates the trailing "\n" of a textfile line. > > use line.rstrip() for that. rstrip has different functionality than what I'm doing. Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vor

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Marko Rauhamaa
Terry Reedy : > Different OSes *do* have different assumptions. Both MacOSX and > current Windows use (UCS-2 or) UTF-16 for text. Linux can use anything for text; UTF-8 has become a de-facto standard. How text is represented is very different from whether text is a fundamental data type. A funda

Re: How to use SQLite (sqlite3) more efficiently

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 3:42 AM, R Johnson wrote: > Thank you all for your replies and suggestions. > > To Chris's "two small points": > I saw that using the mailing list was recommended to several other people > who posted here using Google Groups, so I thought it might be recommended to > me as w

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Paul Rubin
Johannes Bauer writes: > line = line[:-1] > Which truncates the trailing "\n" of a textfile line. use line.rstrip() for that. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Terry Reedy
On 6/5/2014 10:45 AM, Marko Rauhamaa wrote: Mostly I'm saying Python3 will not be able to hide the fact that linux data consists of bytes. It shouldn't even try. The linux OS outside the Python process talks bytes, not strings. A text file is a binary file wrapped with a codex to translate to

How to use SQLite (sqlite3) more efficiently

2014-06-05 Thread R Johnson
Thank you all for your replies and suggestions. To Chris's "two small points": I saw that using the mailing list was recommended to several other people who posted here using Google Groups, so I thought it might be recommended to me as well sometime :). I'll try to use it from now on. My code w

Re: Forking PyPI package

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 2:56 AM, Wiktor wrote: > I guess, I'll try to do what Chris proposed. Forget about this > implementation and write python script from the scratch looking only at the > original JavaScript version. :-/ Sadly, that may be your only safe option. Let this be a lesson to all:

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 2:54 AM, Rustom Mody wrote: > On Thursday, June 5, 2014 9:42:28 PM UTC+5:30, Chris Angelico wrote: >> On Fri, Jun 6, 2014 at 1:33 AM, Steven D'Aprano wrote: >> > In the Unix world, text formats and text >> > processing is much more common in user-space apps than binary proce

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread alister
On Thu, 05 Jun 2014 18:15:31 +0100, Mark Lawrence wrote: >>> >> The problem is that thing look fine in google groups. What helps is >> getting to see what the mess looks like from Thunderbird or equivalent. >> >> > Wrong. 99.99% of people when asked politely take action so there is no > problem.

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 2:52 AM, Marko Rauhamaa wrote: > That linux text is not the same thing as Python's text. Conceptually, > Python text is a sequence of 32-bit integers. Linux text is a sequence > of 8-bit integers. Point of terminology: Linux is the kernel, everything you say below here is t

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Ian Kelly
On Thu, Jun 5, 2014 at 10:17 AM, Robin Becker wrote: > in python 2 str and unicode were much more comparable. On balance I think > just reversing them ie str --> bytes and unicode --> str was probably the > right thing to do if the default conversions had been turned off. However > making bytes a

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Joshua Landau
On 4 June 2014 15:50, Michael Torrie wrote: > On 06/04/2014 12:50 AM, wxjmfa...@gmail.com wrote: >> [Things] > > [Reply to things] Please. Just don't. -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: This Swift thing

2014-06-05 Thread Michael Torrie
On 06/05/2014 10:09 AM, Sturla Molden wrote: > On 05/06/14 16:33, Michael Torrie wrote: > > > In any case I'm a bit surprised by people comparing Python to Swift at > > all, implying that Python would have worked just as well and Apple > > should have chosen it to replace Objective C. > > Beca

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Mark Lawrence
On 05/06/2014 16:57, Mark H Harris wrote: On 6/5/14 10:39 AM, alister wrote: {snipped all the mess} And you have may time been given a link explaining the problems with posting g=from google groups but deliberately choose to not make your replys readable. The problem is that thing look fine

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 2:17 AM, Robin Becker wrote: > in python 2 str and unicode were much more comparable. On balance I think > just reversing them ie str --> bytes and unicode --> str was probably the > right thing to do if the default conversions had been turned off. However > making bytes a c

Re: any wheel experts

2014-06-05 Thread Rustom Mody
On Thursday, June 5, 2014 10:21:06 PM UTC+5:30, Robin Becker wrote: > I used to create exe files for windows, but the latest and greatest concept > is > wheels .whl files. If someone here knows (and answers!) great. Else you'll probably get more info here: https://groups.google.com/forum/?pli=1#

Re: Forking PyPI package

2014-06-05 Thread Wiktor
On Thu, 29 May 2014 15:54:09 -0600, Ian Kelly wrote: > On Thu, May 29, 2014 at 1:40 AM, Chris Angelico wrote: >> If you absolutely can't get in touch with him, the only option is to >> go back to the original protocol and manually reimplement it, >> completely ignoring this code. It's sad but tru

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Rustom Mody
On Thursday, June 5, 2014 9:42:28 PM UTC+5:30, Chris Angelico wrote: > On Fri, Jun 6, 2014 at 1:33 AM, Steven D'Aprano wrote: > > In the Unix world, text formats and text > > processing is much more common in user-space apps than binary processing. > > Perhaps the definitive explanation and celebra

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Marko Rauhamaa
Steven D'Aprano : > Nevertheless, there are important abstractions that are written on top > of the bytes layer, and in the Unix and Linux world, the most > important abstraction is *text*. In the Unix world, text formats and > text processing is much more common in user-space apps than binary > p

any wheel experts

2014-06-05 Thread Robin Becker
I used to create exe files for windows, but the latest and greatest concept is wheels .whl files. Does anyone know how to make the created exes that the wheel can install have an icon for windows? How is one supposed to make the wheel install a desktop short cut etc etc? The wheel is just a

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Steven D'Aprano
On Thu, 05 Jun 2014 17:17:05 +0100, Robin Becker wrote: > Bytes are the underlying > concept and should have remained so for simplicity's sake. Bytes are the underlying concept for classes too. Do you think that an opaque unstructured blob of bytes is "simpler" to use than a class? How would an

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Steven D'Aprano
On Thu, 05 Jun 2014 16:37:23 +0100, Robin Becker wrote: > In python 3 byte strings > are second class which I think is wrong It certainly is wrong. bytes are just as much a first-class built-in type as list, int, float, bool, set, tuple and str. There may be missing functionality (relatively ea

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Robin Becker
On 05/06/2014 16:50, Chris Angelico wrote: .. I wouldn't say they're second-class; it's more that the bytes type was considered to be more like a list of ints than like a Unicode string, and now that there are a few years' worth of real-world usage information to learn from, it's known t

Re: Python 3.2 has some deadly infection

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 1:33 AM, Steven D'Aprano wrote: > In the Unix world, text formats and text > processing is much more common in user-space apps than binary processing. > Perhaps the definitive explanation and celebration of the Unix way is > Eric Raymond's "The Art Of Unix Programming": > >

Re: OT: This Swift thing

2014-06-05 Thread Sturla Molden
On 05/06/14 16:33, Michael Torrie wrote: > In any case I'm a bit surprised by people comparing Python to Swift at > all, implying that Python would have worked just as well and Apple > should have chosen it to replace Objective C. Because if you look at the spec, Swift is essentially a staticall

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Johannes Bauer
On 04.06.2014 02:39, Chris Angelico wrote: > I know the collective experience of python-list can't fail to bring up > a few solid examples here :) Just also grepped lots of code and have surprisingly few instances of index-search. Most are with constant indices. One particular example that comes

Re: Adding R squared value to scatter plot

2014-06-05 Thread Jamie Mitchell
On Wednesday, May 21, 2014 1:30:16 PM UTC+1, Jason Swails wrote: > > > > > > > On Wed, May 21, 2014 at 7:59 AM, Jamie Mitchell wrote: > > I have made a plot using the following code: > > > > python2.7 > > import netCDF4 > > import matplotlib.pyplot as plt > > import numpy as np > >

Re: Unicode and Python - how often do you index strings?

2014-06-05 Thread Mark H Harris
On 6/5/14 10:39 AM, alister wrote: {snipped all the mess} And you have may time been given a link explaining the problems with posting g=from google groups but deliberately choose to not make your replys readable. The problem is that thing look fine in google groups. What helps is getting to

Matplotlib - specifying bin widths

2014-06-05 Thread Jamie Mitchell
Hello all! Instead of setting the number of bins I want to set the bin width. I would like my bins to go from 1.7 to 2.4 in steps of 0.05. How do I say this in the code? Cheers, Jamie -- https://mail.python.org/mailman/listinfo/python-list

  1   2   >