Re: Assignment Versus Equality

2016-06-28 Thread Steven D'Aprano
On Wednesday 29 June 2016 15:51, Lawrence D’Oliveiro wrote: > On Wednesday, June 29, 2016 at 5:26:46 PM UTC+12, Steven D'Aprano wrote: >> BUT in Python 3, the distinction between int and long is gone by dropping >> int and renaming long as "int". So all Python ints are BIGNUMs. > > I don’t unders

Re: Assignment Versus Equality

2016-06-28 Thread Rustom Mody
On Wednesday, June 29, 2016 at 12:03:30 PM UTC+5:30, Rustom Mody wrote: > On Wednesday, June 29, 2016 at 11:57:03 AM UTC+5:30, Chris Angelico wrote: > > On Wed, Jun 29, 2016 at 3:55 PM, Rustom Mody wrote: > > >> The transparent shift from machine-word to bignum is what no longer > > >> exists. Both

Re: Assignment Versus Equality

2016-06-28 Thread Rustom Mody
On Wednesday, June 29, 2016 at 11:57:03 AM UTC+5:30, Chris Angelico wrote: > On Wed, Jun 29, 2016 at 3:55 PM, Rustom Mody wrote: > >> The transparent shift from machine-word to bignum is what no longer > >> exists. Both Py2 and Py3 will store large integers as bignums; Py2 has > >> two separate dat

Re: Assignment Versus Equality

2016-06-28 Thread Chris Angelico
On Wed, Jun 29, 2016 at 3:55 PM, Rustom Mody wrote: >> The transparent shift from machine-word to bignum is what no longer >> exists. Both Py2 and Py3 will store large integers as bignums; Py2 has >> two separate data types (int and long), with ints generally >> outperforming longs, but Py3 simply

Re: Iteration, while loop, and for loop

2016-06-28 Thread Lawrence D’Oliveiro
On Wednesday, June 29, 2016 at 1:30:04 AM UTC+12, BartC wrote: > I don't know if that helps; I've never heard of an induction variable. Perhaps it’s just a computability-theoretic way of saying “a variable whose value each time round the loop is a function of its value on the previous iteration

Re: Assignment Versus Equality

2016-06-28 Thread Rustom Mody
On Wednesday, June 29, 2016 at 10:37:25 AM UTC+5:30, Chris Angelico wrote: > On Wed, Jun 29, 2016 at 2:51 PM, Lawrence D’Oliveiro wrote: > > On Wednesday, June 29, 2016 at 4:20:24 PM UTC+12, Chris Angelico wrote: > >>> https://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/ > >

Re: Assignment Versus Equality

2016-06-28 Thread Lawrence D’Oliveiro
On Wednesday, June 29, 2016 at 5:26:46 PM UTC+12, Steven D'Aprano wrote: > BUT in Python 3, the distinction between int and long is gone by dropping > int and renaming long as "int". So all Python ints are BIGNUMs. I don’t understand what the problem is with this. Is there supposed to be some iss

Re: Assignment Versus Equality

2016-06-28 Thread Steven D'Aprano
On Wednesday 29 June 2016 14:51, Lawrence D’Oliveiro wrote: > On Wednesday, June 29, 2016 at 4:20:24 PM UTC+12, Chris Angelico wrote: >>> https://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and- stupid/ >> >> """It would also be reasonable to assume that any sane language >> runtime

Re: Assignment Versus Equality

2016-06-28 Thread Chris Angelico
On Wed, Jun 29, 2016 at 2:51 PM, Lawrence D’Oliveiro wrote: > On Wednesday, June 29, 2016 at 4:20:24 PM UTC+12, Chris Angelico wrote: >>> https://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/ >> >> """It would also be reasonable to assume that any sane language >> runtime wo

Re: Assignment Versus Equality

2016-06-28 Thread Lawrence D’Oliveiro
On Wednesday, June 29, 2016 at 4:20:24 PM UTC+12, Chris Angelico wrote: >> https://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/ > > """It would also be reasonable to assume that any sane language > runtime would have integers transparently degrade to BIGNUMs, making > the c

Re: Assignment Versus Equality

2016-06-28 Thread Random832
On Tue, Jun 28, 2016, at 22:27, Steven D'Aprano wrote: > Are you suggesting that email clients and newsreaders should silently > mangle the text of your message behind your back? Because that's what > it sounds like you're saying. That was how I was characterizing Rustom Mody's position; he seemed

Re: Assignment Versus Equality

2016-06-28 Thread Chris Angelico
On Wed, Jun 29, 2016 at 12:35 PM, Steven D'Aprano wrote: > > Whereas some decisions are just dumb: > > https://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/ """It would also be reasonable to assume that any sane language runtime would have integers transparently degrade to

Re: Assignment Versus Equality

2016-06-28 Thread Rustom Mody
On Wednesday, June 29, 2016 at 9:27:44 AM UTC+5:30, Rustom Mody wrote: > On Wednesday, June 29, 2016 at 7:58:04 AM UTC+5:30, Steven D'Aprano wrote: > > This is not a good idea. > [This is an experiment :-) ] Um... So now its working ie the offensive behavior (to me also) that Steven described is n

Re: Assignment Versus Equality

2016-06-28 Thread Rustom Mody
On Wednesday, June 29, 2016 at 7:58:04 AM UTC+5:30, Steven D'Aprano wrote: > On Wed, 29 Jun 2016 12:13 am, Random832 wrote: > > > On Tue, Jun 28, 2016, at 00:31, Rustom Mody wrote: > >> GG downgrades posts containing unicode if it can, thereby increasing > >> reach to recipients with unicode-broke

Re: "for/while ... break(by any means) ... else" make sense?

2016-06-28 Thread Steven D'Aprano
On Wed, 29 Jun 2016 11:41 am, jf...@ms4.hinet.net wrote: > Anyone who wrote the code below must be insane:-) > > for x in range(3): > print(x) > else: > print('I am done') *shrug* Insane or not, it's legal. import math pass import os pass import sys is "insane" too, but

Re: Assignment Versus Equality

2016-06-28 Thread Steven D'Aprano
On Tue, 28 Jun 2016 12:10 am, Rustom Mody wrote: > Analogy: Python's bool as 1½-class because bool came into python a good > decade after python and breaking old code is a bigger issue than fixing > control constructs to be bool-strict That analogy fails because Python bools being implemented as

Re: Assignment Versus Equality

2016-06-28 Thread Steven D'Aprano
On Wed, 29 Jun 2016 12:13 am, Random832 wrote: > On Tue, Jun 28, 2016, at 00:31, Rustom Mody wrote: >> GG downgrades posts containing unicode if it can, thereby increasing >> reach to recipients with unicode-broken clients > > That'd be entirely reasonable, except for the excessively broad > appl

Guys, can you please share me some sites where we can practice python programs for beginners and Intermediate.

2016-06-28 Thread Umar Yusuf
Websites to learn python programming? Try these links:- http://umar-yusuf.blogspot.com.ng/2016/03/70-free-python-programming-language.html http://www.sololearn.com/Course/Python/ http://www.afterhoursprogramming.com/tutorial/Python/Overview/ http://www.pyschools.com/ -- https://mail.python.or

"for/while ... break(by any means) ... else" make sense?

2016-06-28 Thread jfong
Anyone who wrote the code below must be insane:-) for x in range(3): print(x) else: print('I am done') But here it seems perfectly OK: for x in range(3): print(x) if x == 1: break else: print('I am done') To me, the "else" was bonded with

Re: Sharing package data across files

2016-06-28 Thread scottpakin1
Steven, Very helpful! Thanks for the thorough explanation. -- Scott -- https://mail.python.org/mailman/listinfo/python-list

Re: Sharing package data across files

2016-06-28 Thread Steven D'Aprano
On Wed, 29 Jun 2016 09:51 am, scottpak...@gmail.com wrote: > On Tuesday, June 28, 2016 at 4:37:45 PM UTC-6, Michael Selik wrote: >> Why do you want to? > > I have a standalone script that grew and grew until reaching an > unmaintainable size. I was hoping to refactor it into a relatively small >

Re: Assignment Versus Equality

2016-06-28 Thread Lawrence D’Oliveiro
On Tuesday, June 28, 2016 at 10:35:21 PM UTC+12, Chris Angelico wrote: > On Tue, Jun 28, 2016 at 6:49 PM, Lawrence D’Oliveiro wrote: > > On Tuesday, June 28, 2016 at 7:26:30 PM UTC+12, Chris Angelico wrote: >>> Why not: >>> >>> if (error) goto cleanup; >>> ... >>> cleanup: >>> do_cleanup; >> >> The

Re: Sharing package data across files

2016-06-28 Thread Steven D'Aprano
On Wed, 29 Jun 2016 08:07 am, John Pote wrote: >> from foo import bar >> bar = "oranges" >> >> No code outside of a will see bar as "oranges" because my setting of bar >> merely affected the name "bar" inside module a, it did not "reach into" >> the foo module object and update its "bar". zackba.

Re: Sharing package data across files

2016-06-28 Thread scottpakin1
On Tuesday, June 28, 2016 at 5:20:16 PM UTC-6, John Pote wrote: > Correct me if I'm wrong but is not the above only true if bar has been > assigned to and thus references an imutable object? In your example the > string "oranges". > If bar has been assigned to a mutable object in module foo then

Re: Sharing package data across files

2016-06-28 Thread scottpakin1
On Tuesday, June 28, 2016 at 4:37:45 PM UTC-6, Michael Selik wrote: > Why do you want to? I have a standalone script that grew and grew until reaching an unmaintainable size. I was hoping to refactor it into a relatively small top-level script plus a package containing a bunch of relatively sma

Re: Sharing package data across files

2016-06-28 Thread John Pote
On 28/06/2016 20:55, zackba...@gmail.com wrote: On Tuesday, June 28, 2016 at 1:17:23 PM UTC-6, scott...@gmail.com wrote: I'm trying to create a package in which the constituent files share some state. Apparently, I don't understand scopes, namespaces, and package semantics as well as I thou

Re: Sharing package data across files

2016-06-28 Thread Michael Selik
On Tue, Jun 28, 2016 at 3:21 PM wrote: > I'm trying to create a package in which the constituent files share some > state. Apparently, I don't understand scopes, namespaces, and package > semantics as well as I thought I did. Here's the directory structure for a > simplified example: > >exa

Re: Assignment Versus Equality

2016-06-28 Thread Gene Heskett
On Tuesday 28 June 2016 15:40:48 Marko Rauhamaa wrote: > Ian Kelly : > > On Tue, Jun 28, 2016 at 10:39 AM, Marko Rauhamaa wrote: > >> Inside the probe, we have a powerful electrical magnet that our > >> compass can detect from a safe distance away. > >> > >> [...] > >> > >> The compass needle sh

Re: Sharing package data across files

2016-06-28 Thread zackbaker
On Tuesday, June 28, 2016 at 1:17:23 PM UTC-6, scott...@gmail.com wrote: > I'm trying to create a package in which the constituent files share some > state. Apparently, I don't understand scopes, namespaces, and package > semantics as well as I thought I did. Here's the directory structure for

Re: Assignment Versus Equality

2016-06-28 Thread Marko Rauhamaa
Ian Kelly : > On Tue, Jun 28, 2016 at 10:39 AM, Marko Rauhamaa wrote: >> Inside the probe, we have a powerful electrical magnet that our >> compass can detect from a safe distance away. >> >> [...] >> >> The compass needle shows that the probe is "frozen" and won't budge no >> matter how long we

Sharing package data across files

2016-06-28 Thread scottpakin1
I'm trying to create a package in which the constituent files share some state. Apparently, I don't understand scopes, namespaces, and package semantics as well as I thought I did. Here's the directory structure for a simplified example: example/ __init__.py vars.py funcs.py

Re: Assignment Versus Equality

2016-06-28 Thread Ian Kelly
On Tue, Jun 28, 2016 at 10:39 AM, Marko Rauhamaa wrote: > > (sorry for the premature previous post) > > Random832 : >> All objects, not just black holes, have those properties. The point >> here is that we are in fact observing those properties of an object >> that is not yet (and never will be) a

Re: Processing text data with different encodings

2016-06-28 Thread Chris Angelico
On Wed, Jun 29, 2016 at 1:52 AM, Random832 wrote: > On Tue, Jun 28, 2016, at 06:25, Chris Angelico wrote: >> For the OP's situation, frankly, I doubt there'll be anything other >> than UTF-8, Latin-1, and CP-1252. The chances that someone casually >> mixes CP-1252 with (say) CP-1254 would be vanis

Re: Iteration, while loop, and for loop

2016-06-28 Thread Grant Edwards
On 2016-06-28, Tim Chase wrote: > On 2016-06-29 01:20, Steven D'Aprano wrote: >> While loops are great for loops where you don't know how many >> iterations there will be but you do know that you want to keep >> going while some condition applies: >> >> while there is still work to be done: >>

Re: Iteration, while loop, and for loop

2016-06-28 Thread Tim Chase
On 2016-06-29 01:20, Steven D'Aprano wrote: > While loops are great for loops where you don't know how many > iterations there will be but you do know that you want to keep > going while some condition applies: > > while there is still work to be done: > do some more work I find this particul

Re: Assignment Versus Equality

2016-06-28 Thread Random832
On Tue, Jun 28, 2016, at 12:39, Marko Rauhamaa wrote: > A physicist once clarified to me that an almost-black-hole is > practically identical with a black hole because all information about > anything falling in is very quickly red-shifted to oblivion. Subject to some definition of "quickly" and "

Re: Can math.atan2 return INF?

2016-06-28 Thread Marko Rauhamaa
(sorry for the premature previous post) Random832 : > All objects, not just black holes, have those properties. The point > here is that we are in fact observing those properties of an object > that is not yet (and never will be) a black hole in our frame of > reference. A physicist once clarifie

Re: Assignment Versus Equality

2016-06-28 Thread Marko Rauhamaa
Marko Rauhamaa : > (sorry for the premature previous post) Screw it! Wrong thread! Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Can math.atan2 return INF?

2016-06-28 Thread Marko Rauhamaa
Random832 : > All objects, not just black holes, have those properties. The point > here is that we are in fact observing those properties of an object > that is not yet (and never will be) a black hole in our frame of > reference. A physicist once clarified to me that an almost-black-hole is prac

Re: Assignment Versus Equality

2016-06-28 Thread Marko Rauhamaa
(sorry for the premature previous post) Random832 : > All objects, not just black holes, have those properties. The point > here is that we are in fact observing those properties of an object > that is not yet (and never will be) a black hole in our frame of > reference. A physicist once clarifi

Re: Processing text data with different encodings

2016-06-28 Thread Random832
On Tue, Jun 28, 2016, at 06:25, Chris Angelico wrote: > For the OP's situation, frankly, I doubt there'll be anything other > than UTF-8, Latin-1, and CP-1252. The chances that someone casually > mixes CP-1252 with (say) CP-1254 would be vanishingly small. So the > simple decode of "UTF-8, or faili

Re: __all__ attribute: bug and proposal

2016-06-28 Thread Ethan Furman
On 06/27/2016 09:31 PM, Zachary Ware wrote: On Mon, Jun 27, 2016 at 7:32 PM, Chris Angelico wrote: If you're primarily worried about classes and functions, here's a neat trick you can use: __all__ = [] def all(thing): __all__.append(thing.__name__) return thing Barry Warsaw has wr

Re: Iteration, while loop, and for loop

2016-06-28 Thread Jussi Piitulainen
Steven D'Aprano writes: > While loops are great for loops :) Thanks, I needed the laugh. > where you don't know how many iterations there will be but you do know > that you want to keep going while some condition applies: (Just keeping a bit of context so it doesn't seem like I'm laughing at t

Re: Can math.atan2 return INF?

2016-06-28 Thread Steven D'Aprano
On Tue, 28 Jun 2016 11:39 pm, Random832 wrote: > On Sun, Jun 26, 2016, at 22:59, Steven D'Aprano wrote: >> We have no way of seeing what goes on past the black hole's event >> horizon, since light cannot escape. But we can still see *some* >> properties of black holes, even through their event hor

Re: Iteration, while loop, and for loop

2016-06-28 Thread Steven D'Aprano
On Tue, 28 Jun 2016 10:36 pm, Elizabeth Weiss wrote: > Why do we use this code if we can use the simpler for loop? Nobody with any sense would use the more complex while loop when the for loop does the same thing. While loops are great for loops where you don't know how many iterations there wil

Re: Processing text data with different encodings

2016-06-28 Thread Steven D'Aprano
On Tue, 28 Jun 2016 10:30 pm, Michael Welle wrote: > I changed the code from my initial mail to: > > LOGGER = logging.getLogger() > LOGGER.addHandler(logging.FileHandler("tmp.txt", encoding="utf-8")) > > for l in sys.stdin.buffer: > l = l.decode('utf-8') > LOGGER.critical(l) I imagine y

Re: Processing text data with different encodings

2016-06-28 Thread Random832
On Tue, Jun 28, 2016, at 10:52, Steven D'Aprano wrote: > "you will find THREE OR FOUR different encodings in one email. > I think at the sending side they just glue different text > fragments from different sources together without thinking > about the encoding" > > But I'm not

!! Immediate Requirement: QlikView consultant with JDE experience (Somerset, NJ ) !!

2016-06-28 Thread sourav524 . itscient
Hi All Please revert me: soura...@itscient.com or sourav524.itsci...@gmail.com If i miss your call pls mail me. Position: QlikView consultant with JDE experience Location: Somerset, NJ Duration: 6+ Month Mandatory Skill : JD Edwards 9.1 ERP Overall experience of 8-10 yrs of experience Exper

Re: Processing text data with different encodings

2016-06-28 Thread Steven D'Aprano
On Tue, 28 Jun 2016 10:30 pm, Michael Welle wrote: > I look at the hex values of the bytes, get the win-1252 table and > translate the bytes to chars. If the result makes sense, it's win-1252 > (and maybe others, if the tables overlap). So in that sense I know what > I have. I least for this exper

Re: fastest way to read a text file in to a numpy array

2016-06-28 Thread Cody Piersall
On Tue, Jun 28, 2016 at 8:45 AM, Heli wrote: > Hi, > > I need to read a file in to a 2d numpy array containing many number of lines. > I was wondering what is the fastest way to do this? > > Is even reading the file in to numpy array the best method or there are > better approaches? > numpy.genf

Re: fastest way to read a text file in to a numpy array

2016-06-28 Thread Michael Selik
On Tue, Jun 28, 2016 at 10:08 AM Hedieh Ebrahimi wrote: > File 1 has : > x1,y1,z1 > x2,y2,z2 > > > and file2 has : > x1,y1,z1,value1 > x2,y2,z2,value2 > x3,y3,z3,value3 > ... > > I need to read the coordinates from file 1 and then interpolate a value > for these coordinates on file 2 to the

Re: Assignment Versus Equality

2016-06-28 Thread Random832
On Tue, Jun 28, 2016, at 00:31, Rustom Mody wrote: > GG downgrades posts containing unicode if it can, thereby increasing > reach to recipients with unicode-broken clients That'd be entirely reasonable, except for the excessively broad application of "if it can". Certainly it _can_ do it all the

Re: fastest way to read a text file in to a numpy array

2016-06-28 Thread Michael Selik
On Tue, Jun 28, 2016 at 9:51 AM Heli wrote: > Is even reading the file in to numpy array the best method or there are > better approaches? > What are you trying to accomplish? Summary statistics, data transformation, analysis...? -- https://mail.python.org/mailman/listinfo/python-list

Re: Iteration, while loop, and for loop

2016-06-28 Thread Michael Selik
On Tue, Jun 28, 2016 at 9:26 AM Joseph Lee wrote: > > -Original Message- > From: Michael Selik > Sent: Tuesday, June 28, 2016 6:16 AM > > MS: You should not. Use the first version, it's much better. Python > for-loops are preferable to while-loops. > > JL: For the most part, for loops are

Re: Iteration, while loop, and for loop

2016-06-28 Thread Michael Selik
On Tue, Jun 28, 2016 at 9:34 AM BartC wrote: > On 28/06/2016 14:15, Michael Selik wrote: > > On Tue, Jun 28, 2016 at 8:41 AM Elizabeth Weiss > wrote: > > > >> I do not understand the second code. What is counter? > >> > > > > It looks like someone wanted to make a loop induction variable. > > ht

fastest way to read a text file in to a numpy array

2016-06-28 Thread Heli
Hi, I need to read a file in to a 2d numpy array containing many number of lines. I was wondering what is the fastest way to do this? Is even reading the file in to numpy array the best method or there are better approaches? Thanks for your suggestions, -- https://mail.python.org/mailman/li

Re: Iteration, while loop, and for loop

2016-06-28 Thread Jussi Piitulainen
Elizabeth Weiss writes: [- -] > What I do not understand is: > > words=["hello", "world", "spam", "eggs"] > counter=0 > max_index=len(words)-1 > > while counter<=max_index: >word=words[counter] >print(word + "!") >counter=counter + 1 # make it so that counter == 0 counter=0 # make i

Re: Can math.atan2 return INF?

2016-06-28 Thread Random832
On Sun, Jun 26, 2016, at 22:59, Steven D'Aprano wrote: > We have no way of seeing what goes on past the black hole's event > horizon, since light cannot escape. But we can still see *some* > properties of black holes, even through their event horizon: their > mass, any electric charge they may hold

Re: What the deal with python3.5m.so and python3.5.so ??

2016-06-28 Thread eryk sun
On Tue, Jun 28, 2016 at 10:51 AM, Steven Truppe wrote: > > can someone tell me the difference between python3.5m.so and python3.5.so ?? The "m" suffix means that Python is configured "--with-pymalloc", i.e. using specialized mallocs, including the small-object allocator. This is the default confi

Re: Iteration, while loop, and for loop

2016-06-28 Thread BartC
On 28/06/2016 14:15, Michael Selik wrote: On Tue, Jun 28, 2016 at 8:41 AM Elizabeth Weiss wrote: I do not understand the second code. What is counter? It looks like someone wanted to make a loop induction variable. https://en.wikipedia.org/wiki/Induction_variable I don't know if that help

RE: Iteration, while loop, and for loop

2016-06-28 Thread Joseph Lee
Hi, Answers inline. -Original Message- From: Python-list [mailto:python-list-bounces+joseph.lee22590=gmail@python.org] On Behalf Of Michael Selik Sent: Tuesday, June 28, 2016 6:16 AM To: Elizabeth Weiss ; python-list@python.org Subject: Re: Iteration, while loop, and for loop On Tue,

Re: Iteration, while loop, and for loop

2016-06-28 Thread BartC
On 28/06/2016 13:36, Elizabeth Weiss wrote: I understand this code: words=["hello", "world", "spam", "eggs"] for words in words print(word + "!") What I do not understand is: words=["hello", "world", "spam", "eggs"] counter=0 max_index=len(words)-1 while counter<=max_index: word=words[c

Re: Iteration, while loop, and for loop

2016-06-28 Thread Michael Selik
On Tue, Jun 28, 2016 at 8:41 AM Elizabeth Weiss wrote: > I do not understand the second code. What is counter? > It looks like someone wanted to make a loop induction variable. https://en.wikipedia.org/wiki/Induction_variable > Why do we use this code if we can use the simpler for loop? > You

Iteration, while loop, and for loop

2016-06-28 Thread Elizabeth Weiss
I understand this code: words=["hello", "world", "spam", "eggs"] for words in words print(word + "!") What I do not understand is: words=["hello", "world", "spam", "eggs"] counter=0 max_index=len(words)-1 while counter<=max_index: word=words[counter] print(word + "!") counter=counte

Re: Question on compiling on linux

2016-06-28 Thread alister
On Mon, 27 Jun 2016 21:39:42 -0600, Michael Torrie wrote: > On 06/27/2016 08:28 PM, Steven D'Aprano wrote: >> On Tue, 28 Jun 2016 10:01 am, Dennis Lee Bieber wrote: >> >>> The Outlook style works well in a business environment where the >>> recipient is likely the original sender of the quoted te

Re: Processing text data with different encodings

2016-06-28 Thread Peter Otten
Michael Welle wrote: > With your help, I fixed logging. Somehow I had in mind that the > logging module would do the right thing if I don't specify the encoding. The default encoding depends on the environment (and platform): $ touch tmp.txt $ python3 -c 'print(open("tmp.txt").encoding)' UTF-8 $

Re: Processing text data with different encodings

2016-06-28 Thread Steven D'Aprano
On Tue, 28 Jun 2016 08:17 pm, Michael Welle wrote: > After a bit more 'fiddling' I found out that all test cases work if I > use .decode('utf-8') on the incoming bytes. In my first approach I tried > to find out at what I was looking and then used a specific .decode, e.g. > .decode('windows-1252')

Re: Processing text data with different encodings

2016-06-28 Thread Chris Angelico
On Tue, Jun 28, 2016 at 8:37 PM, Michael Welle wrote: > Steven D'Aprano writes: > >> On Tue, 28 Jun 2016 06:35 pm, Michael Welle wrote: >> >>> my original data is email. The mail header says it's utf-8, but you will >>> find three or four different encodings in one email. I think at the >>> sendi

What the deal with python3.5m.so and python3.5.so ??

2016-06-28 Thread Steven Truppe
Hi all, can someone tell me the difference between python3.5m.so and python3.5.so ?? Tanks in advance, Steven Truppe -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment Versus Equality

2016-06-28 Thread BartC
On 28/06/2016 01:11, Dennis Lee Bieber wrote: On Tue, 28 Jun 2016 00:08:00 +0100, BartC declaimed the following: You just design the compiler to do the same processing in each case, ie. parse a followed (), then mark the result AST fragment as either an Array term, or Format statement, depen

Re: Assignment Versus Equality

2016-06-28 Thread Chris Angelico
On Tue, Jun 28, 2016 at 6:49 PM, Lawrence D’Oliveiro wrote: > On Tuesday, June 28, 2016 at 7:26:30 PM UTC+12, Chris Angelico wrote: >> Why not: >> >> if (error) goto cleanup; >> ... >> cleanup: >> do_cleanup; > > They all fall into that same trap. Doesn’t scale. Try one with allocation > inside a

Re: Processing text data with different encodings

2016-06-28 Thread Steven D'Aprano
On Tue, 28 Jun 2016 06:35 pm, Michael Welle wrote: > my original data is email. The mail header says it's utf-8, but you will > find three or four different encodings in one email. I think at the > sending side they just glue different text fragments from different > sources together without think

Re: Processing text data with different encodings

2016-06-28 Thread Chris Angelico
On Tue, Jun 28, 2016 at 6:30 PM, Peter Otten <__pete...@web.de> wrote: > Does chardet ever return an encoding that fails to decode > the line? Only in that case the "ignore" error handler would make sense. Assuming the module the OP is using is functionally identical to the one I use from the comm

Re: argparse and subparsers

2016-06-28 Thread Michele Simionato
I did not know about docopt. It is basically the same idea of this recipe I wrote about 12 years ago: https://code.activestate.com/recipes/278844-parsing-the-command-line/?in=user-1122360 Good that it was reinvented :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment Versus Equality

2016-06-28 Thread Lawrence D’Oliveiro
On Tuesday, June 28, 2016 at 7:26:30 PM UTC+12, Chris Angelico wrote: > Why not: > > if (error) goto cleanup; > ... > cleanup: > do_cleanup; They all fall into that same trap. Doesn’t scale. Try one with allocation inside a loop, e.g. lines 488 onwards. -- https://mail.python.org/mailman/listin

Re: Meta decorator with parameters, defined in explicit functions

2016-06-28 Thread Steven D'Aprano
On Tuesday 28 June 2016 15:02, Ben Finney wrote: > Howdy all, > > I want an explicit replacement for a common decorator idiom. > > There is a clever one-line decorator that has been copy-pasted without > explanation in many code bases for many years:: > > decorator_with_args = lambda decora

Re: Processing text data with different encodings

2016-06-28 Thread Peter Otten
Michael Welle wrote: > Hello, > > I want to use Python 3 to process data, that unfortunately come with > different encodings. So far I have found ascii, iso-8859, utf-8, > windows-1252 and maybe some more in the same file (don't ask...). I read > the data via sys.stdin and the idea is to read a l

Pip 8.1.1 is installed in my system. when try to install few packages using pip I am getting the following error:

2016-06-28 Thread bharadwajsrivatsa
Pip 8.1.1 is installed in my system. when try to install few packages using pip I am getting the following error: Traceback (most recent call last): File "/usr/bin/pip2", line 5, in from pkgresources import load_entry_point File "build/bdist.linux-x86_64/egg/pkg_resources/init.py", line 3095,

Re: Assignment Versus Equality

2016-06-28 Thread Jussi Piitulainen
Marko Rauhamaa writes: > Chris Angelico wrote: > >> Or Windows-1252, but declared as Latin-1. (Bane of my life.) > > J J [1] uses ASCII. References: [1] https://en.wikipedia.org/wiki/J_(programming_language) -- https://mail.python.org/mailman/listinfo/python-list

Re: Processing text data with different encodings

2016-06-28 Thread Chris Angelico
On Tue, Jun 28, 2016 at 5:25 PM, Michael Welle wrote: > I want to use Python 3 to process data, that unfortunately come with > different encodings. So far I have found ascii, iso-8859, utf-8, > windows-1252 and maybe some more in the same file (don't ask...). I read > the data via sys.stdin and th

Re: Meta decorator with parameters, defined in explicit functions

2016-06-28 Thread dieter
Ben Finney writes: > I want an explicit replacement for a common decorator idiom. > > There is a clever one-line decorator that has been copy-pasted without > explanation in many code bases for many years:: > > decorator_with_args = lambda decorator: lambda *args, **kwargs: lambda > func: dec

Re: Assignment Versus Equality

2016-06-28 Thread Chris Angelico
On Tue, Jun 28, 2016 at 5:12 PM, Lawrence D’Oliveiro wrote: > . do { /* once */ if (error) break; ... } while (false); do_cleanup; Why not: if (error) goto cleanup; ... cleanup: do_cleanup; Oh, right. XKCD 292. I still thi

Re: Assignment Versus Equality

2016-06-28 Thread Lawrence D’Oliveiro
On Tuesday, June 28, 2016 at 6:14:28 PM UTC+12, Rustom Mody wrote: > Ive listed these spottinesses > See http://blog.languager.org/2015/03/whimsical-unicode.html > Specifically the section on ½-assed unicode support Remember how those UTF-16-using pieces of software got sucked into it. They were

Re: Assignment Versus Equality

2016-06-28 Thread Gregory Ewing
BartC wrote: On 27/06/2016 23:45, Lawrence D’Oliveiro wrote: FORMAT(...complex expression with lots of nested parentheses...) = You just design the compiler to do the same processing in each case, ie. parse a followed (), then mark the result AST fragment as either an Array term, or Fo

Re: [RELEASE] Python 2.7.12

2016-06-28 Thread Karim
On 28/06/2016 06:36, Benjamin Peterson wrote: It is my privilege to present you with another release in the Python 2.7 series, Python 2.7.12. Since the release candidate, there were two changes: - The Windows binaries have been changed to use OpenSSL 1.0.2h. - The "about" dialog in IDLE was fi