Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread Ben Finney
Chris Angelico writes: > * Two people then go back and forth about whether or not the previous > three posts were offensive. I called out a specific gendered slur as such. Nothing to do with “offense”, and I made no such claim. > The whole field of getting vicariously offended is a mess. It's

Re: Python Worst Practices

2015-03-05 Thread Jonas Wielicki
On 01.03.2015 03:43, Chris Angelico wrote: > Imagine if all > your Python code ran twice as fast (that's slightly better than the > IronPython figure quoted!), but worked only on BSD Unix and Mac OS. Is > that something that'll make a fledgling language succeed? I heard that Swift and Objective

Speeding up permutations generation

2015-03-05 Thread Abhiram R
Hi all, Is there a way to generate permutations of large arrays of sizes say,in the hundreds, faster than in the time itertools.permutations() can return? ​-Abhiram.R *~Never give up* -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python 3.4] Rationale for readonly slice data attributes

2015-03-05 Thread Ian Kelly
On Thu, Mar 5, 2015 at 4:57 PM, Mario Figueiredo wrote: > What is the rationale behind making the slice class data attributes > readonly? > > I've built a __getitem__ method for a Map class that contains a list > of Cell instance objects. __getitem__ maps this list into a matrix:: > > # get ce

Re: Newbie question about text encoding

2015-03-05 Thread Chris Angelico
On Fri, Mar 6, 2015 at 3:53 PM, Rustom Mody wrote: > My conclusion: Early adopters of unicode -- Windows and Java -- were punished > for their early adoption. You can blame the unicode consortium, you can > blame the babel of human languages, particularly that some use characters > and some only

Re: Newbie question about text encoding

2015-03-05 Thread Rustom Mody
On Thursday, March 5, 2015 at 7:36:32 PM UTC+5:30, Steven D'Aprano wrote: > Rustom Mody wrote: > > > On Wednesday, March 4, 2015 at 10:25:24 AM UTC+5:30, Chris Angelico wrote: > >> On Wed, Mar 4, 2015 at 3:45 PM, Rustom Mody wrote: > >> > > >> > It lists some examples of software that somehow bre

Re: Is nan in (nan,) correct?

2015-03-05 Thread Mark Lawrence
On 06/03/2015 04:37, random...@fastmail.us wrote: On Thu, Mar 5, 2015, at 22:49, Chris Angelico wrote: I'm not sure it's just an optimization. Compare this post from python-dev, where Nick Coghlan discusses the same topic: https://mail.python.org/pipermail/python-dev/2014-July/135476.html If

Re: Is nan in (nan,) correct?

2015-03-05 Thread random832
On Thu, Mar 5, 2015, at 22:49, Chris Angelico wrote: > I'm not sure it's just an optimization. Compare this post from > python-dev, where Nick Coghlan discusses the same topic: > > https://mail.python.org/pipermail/python-dev/2014-July/135476.html If it is a bug for NaN to "infect" containers' be

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread Mark Lawrence
On 06/03/2015 03:23, Ben Finney wrote: Steven D'Aprano writes: Ben Finney wrote: “get their panties all up in a bunch” is a gendered slur. Why do you interpret that as insulting to women merely on the basis of being *female*? I think your question is in bad faith. You know as well as I d

How fast does your grass grow? [was Re: HELP!! How to ask a girl out with a simple witty Python code??]

2015-03-05 Thread Ethan Furman
On 03/05/2015 07:37 PM, Chris Angelico wrote: > I'm sure there's something more interesting to talk about... like the > rate at which the grass is growing. My grass doesn't grow -- I ripped it all out and put down pea-gravel and planter boxes. Oh, wait, I have some bamboo in the back -- that's

Re: Is nan in (nan,) correct?

2015-03-05 Thread Chris Angelico
On Fri, Mar 6, 2015 at 2:26 PM, Ben Finney wrote: > Isn't the point at issue that the Python interpreter *may* optimise by > assuming ‘is implies equality’, so the ‘in’ operator can fail if that > assumption is false? > > I thought the problem was that types with custom behaviour, as with the > ‘N

Re: Is nan in (nan,) correct?

2015-03-05 Thread Ethan Furman
On 03/05/2015 07:26 PM, Ben Finney wrote: > Ethan Furman writes: > >> On 03/05/2015 06:55 PM, Ben Finney wrote: >> >>> class NullType(object): >>> """ A type whose value never equals any other. >>> >>> This type's values will behave correctly when tested for >>>

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread Chris Angelico
On Fri, Mar 6, 2015 at 2:23 PM, Ben Finney wrote: > Steven D'Aprano writes: > >> Ben Finney wrote: >> >> > “get their panties all up in a bunch” is a gendered slur. >> >> Why do you interpret that as insulting to women merely on the basis of >> being *female*? > > I think your question is in bad

Re: Is nan in (nan,) correct?

2015-03-05 Thread Ben Finney
Ethan Furman writes: > On 03/05/2015 06:55 PM, Ben Finney wrote: > > > class NullType(object): > > """ A type whose value never equals any other. > > > > This type's values will behave correctly when tested for > > membership in a collection:: > > > >

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread Ben Finney
Steven D'Aprano writes: > Ben Finney wrote: > > > “get their panties all up in a bunch” is a gendered slur. > > Why do you interpret that as insulting to women merely on the basis of > being *female*? I think your question is in bad faith. You know as well as I do, and I'm confident the person

Re: Is nan in (nan,) correct?

2015-03-05 Thread Ethan Furman
On 03/05/2015 06:55 PM, Ben Finney wrote: > class NullType(object): > """ A type whose value never equals any other. > > This type's values will behave correctly when tested for > membership in a collection:: > > >>> foo = NullType() >

Re: Is nan in (nan,) correct?

2015-03-05 Thread Ben Finney
Steven D'Aprano writes: > Since reflexivity is *almost* universal, and using object identity > permits very substantial optimizations, the core developers agreed > that built-in contain types may assume that `x is y` implies `x == y`. > Users of NANs and other non-reflexive types can subclass or

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread Steven D'Aprano
Ben Finney wrote: > Steven D'Aprano writes: > >> Ben Finney wrote: >> >> > sohcahto...@gmail.com writes: >> > >> >> I should have known better than to make a joke on this mailing >> >> list. Someone is bound to get their panties all up in a bunch. >> > >> > You should have known better than to

Re: Is nan in (nan,) correct?

2015-03-05 Thread Steven D'Aprano
random...@fastmail.us wrote: > It's been brought up on Stack Overflow that the "in" operator (on > tuples, and by my testing on dict and list, as well as dict lookup) uses > object identity as a shortcut, and returns true immediately if the > object being tested *is* an element of the container. H

Re: Is nan in (nan,) correct?

2015-03-05 Thread Terry Reedy
Nothing about nans is 'correct'. They are a CS invention On 3/5/2015 5:26 PM, random...@fastmail.us wrote: It's been brought up on Stack Overflow that the "in" operator (on tuples, and by my testing on dict and list, as well as dict lookup) uses object identity as a shortcut, and returns true i

[Python 3.4] Rationale for readonly slice data attributes

2015-03-05 Thread Mario Figueiredo
What is the rationale behind making the slice class data attributes readonly? I've built a __getitem__ method for a Map class that contains a list of Cell instance objects. __getitem__ maps this list into a matrix:: # get cell at cartesian coordinates 12, 4 # will map to the 1048th positi

Re: Is nan in (nan,) correct?

2015-03-05 Thread Chris Angelico
On Fri, Mar 6, 2015 at 10:27 AM, wrote: > Do you have an example of where `a is b` but `a != b` in Python? `None == > None` is True. Check out the subject line. >>> nan = float("nan") >>> nan is nan # obviously True >>> nan != nan # IEEE 754 mandates True ChrisA -- https://mail.python.org

Re: Is nan in (nan,) correct?

2015-03-05 Thread Ben Finney
sohcahto...@gmail.com writes: > On Thursday, March 5, 2015 at 3:20:16 PM UTC-8, Ben Finney wrote: > > It is fine to define such a type in Python, because 'is' does not > > necessarily imply '=='. > > Do you have an example of where `a is b` but `a != b` in Python? Maybe I misunderstand your quest

Re: Is nan in (nan,) correct?

2015-03-05 Thread sohcahtoa82
On Thursday, March 5, 2015 at 3:20:16 PM UTC-8, Ben Finney wrote: > sohcahto...@gmail.com writes: > > > I would argue that if `a is b` then it is obvious that `a == b` > > It may be obvious, but it's not necessarily true. Some commonly-used > values - for example, an "null" - are not equal to the

Re: Is nan in (nan,) correct?

2015-03-05 Thread Chris Angelico
On Fri, Mar 6, 2015 at 10:11 AM, wrote: > I would argue that if `a is b` then it is obvious that `a == b` This is not true for float("nan"), though. The question is, is your above statement a valid optimization for the 'in' operator, or not? And no, it isn't, because it's not perfectly safe. How

Re: Is nan in (nan,) correct?

2015-03-05 Thread Ben Finney
sohcahto...@gmail.com writes: > I would argue that if `a is b` then it is obvious that `a == b` It may be obvious, but it's not necessarily true. Some commonly-used values – for example, an “null” – are not equal to themselves, by definition. It is fine to define such a type in Python, because ‘

Re: Is nan in (nan,) correct?

2015-03-05 Thread sohcahtoa82
On Thursday, March 5, 2015 at 2:27:12 PM UTC-8, rand...@fastmail.us wrote: > It's been brought up on Stack Overflow that the "in" operator (on > tuples, and by my testing on dict and list, as well as dict lookup) uses > object identity as a shortcut, and returns true immediately if the > object bei

[OT]Re: what is wrong with d.clear()?

2015-03-05 Thread m
W dniu 23.12.2014 o 11:25, Steve Hayes pisze: >[1] Or worse, one of those shitty messages that include a plain text part >that says "Your mail program cannot read this email. Please upgrade to a >better mail program." I usually reply to those saying "So why did you send it to me?" I suspect tha

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread Mark Lawrence
On 05/03/2015 22:59, Ben Finney wrote: Steven D'Aprano writes: Ben Finney wrote: sohcahto...@gmail.com writes: I should have known better than to make a joke on this mailing list. Someone is bound to get their panties all up in a bunch. You should have known better than to make gendered

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread Ben Finney
Steven D'Aprano writes: > Ben Finney wrote: > > > sohcahto...@gmail.com writes: > > > >> I should have known better than to make a joke on this mailing > >> list. Someone is bound to get their panties all up in a bunch. > > > > You should have known better than to make gendered slurs. Claiming

Re: Newbie question about text encoding

2015-03-05 Thread Steven D'Aprano
random...@fastmail.us wrote: > On Thu, Mar 5, 2015, at 09:06, Steven D'Aprano wrote: >> I mostly agree with Chris. Supporting *just* the BMP is non-trivial in >> UTF-8 >> and UTF-32, since that goes against the grain of the system. You would >> have >> to program in artificial restrictions that ot

Is nan in (nan,) correct?

2015-03-05 Thread random832
It's been brought up on Stack Overflow that the "in" operator (on tuples, and by my testing on dict and list, as well as dict lookup) uses object identity as a shortcut, and returns true immediately if the object being tested *is* an element of the container. However, the contains operation does no

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread Steven D'Aprano
Ben Finney wrote: > sohcahto...@gmail.com writes: > >> I should have known better than to make a joke on this mailing list. >> Someone is bound to get their panties all up in a bunch. > > You should have known better than to make gendered slurs. Claiming “it > was a joke” doesn't alter the sexis

Re: what is wrong with d.clear()?

2015-03-05 Thread Terry Reedy
On 12/22/2014 3:54 PM, Rick Johnson wrote: On Monday, December 22, 2014 12:16:03 PM UTC-6, sohca...@gmail.com wrote: On Monday, December 22, 2014 12:16:15 AM UTC-8, shawool wrote: [snip: OP's adolescent accessorizing] @_@ Is there a reason you're composing your messages with a large, colored f

Re: Make standalone gui-enabled app for LINUX

2015-03-05 Thread Christian Gollwitzer
Am 05.03.15 um 18:31 schrieb Mehdi: > Hi > I know there are tools like cx_freeze or nuitka for making a linux standalone > python app. but i couldn't find a good tutorial about how to making a > portable gui-enabled python3 app in linux. by gui-enabled i mean application > which use any gui libs

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-05 Thread Mark Lawrence
On 05/03/2015 03:38, Rustom Mody wrote: On Thursday, March 5, 2015 at 1:03:13 AM UTC+5:30, Marko Rauhamaa wrote: Steven D'Aprano: Care to enlighten us then? Because your anecdote doesn't appear to have even the most tenuous relationship to this discussion. Even more important, when you talk

Re: http: connection reset by peer

2015-03-05 Thread Chris Angelico
On Fri, Mar 6, 2015 at 5:37 AM, Ethan Furman wrote: > On 03/04/2015 01:26 AM, Chris Angelico wrote: > >> Do you have Mozilla Firebug, and if so, can you try the file >> attachment with Firebug active? At very least, you should be able to >> see exactly what request is getting reset, and then you c

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-05 Thread Marko Rauhamaa
Steve Hayes : > On Wed, 04 Mar 2015 21:33:01 +0200, Marko Rauhamaa >>English-speaker, when you name things in your Python programs, you had >>better stick to American spellings. >> >>Even more important, when you talk about Python or other computer stuff >>to a non-English-speaker, try to emulate

Re: Newbie question about text encoding

2015-03-05 Thread random832
On Thu, Mar 5, 2015, at 09:06, Steven D'Aprano wrote: > I mostly agree with Chris. Supporting *just* the BMP is non-trivial in > UTF-8 > and UTF-32, since that goes against the grain of the system. You would > have > to program in artificial restrictions that otherwise don't exist. UTF-8 is alread

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-05 Thread Steve Hayes
On Wed, 04 Mar 2015 21:33:01 +0200, Marko Rauhamaa wrote: >Steven D'Aprano : > >> Care to enlighten us then? Because your anecdote doesn't appear to >> have even the most tenuous relationship to this discussion. > >English-speaker, when you name things in your Python programs, you had >better sti

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread Ben Finney
sohcahto...@gmail.com writes: > I should have known better than to make a joke on this mailing list. > Someone is bound to get their panties all up in a bunch. You should have known better than to make gendered slurs. Claiming “it was a joke” doesn't alter the sexism of your remarks. Cut that out

Re: http: connection reset by peer

2015-03-05 Thread Ethan Furman
On 03/04/2015 01:26 AM, Chris Angelico wrote: > Do you have Mozilla Firebug, and if so, can you try the file > attachment with Firebug active? At very least, you should be able to > see exactly what request is getting reset, and then you could try to > simulate that exact request with a simpler ha

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-05 Thread sohcahtoa82
On Wednesday, March 4, 2015 at 7:08:34 PM UTC-8, Chris Angelico wrote: > On Thu, Mar 5, 2015 at 1:50 PM, wrote: > > On Wednesday, March 4, 2015 at 5:34:16 PM UTC-8, Xrrific wrote: > >> Guys, please Help!!! > >> > >> I am trying to impress a girl who is learning python and want ask her out > >> a

Re: Make standalone gui-enabled app for LINUX

2015-03-05 Thread Phil Thompson
On 05/03/2015 5:31 pm, Mehdi wrote: Hi I know there are tools like cx_freeze or nuitka for making a linux standalone python app. but i couldn't find a good tutorial about how to making a portable gui-enabled python3 app in linux. by gui-enabled i mean application which use any gui libs like pygob

Make standalone gui-enabled app for LINUX

2015-03-05 Thread Mehdi
Hi I know there are tools like cx_freeze or nuitka for making a linux standalone python app. but i couldn't find a good tutorial about how to making a portable gui-enabled python3 app in linux. by gui-enabled i mean application which use any gui libs like pygobject, qt or wx. I know most of linu

win32api.LoadKeyboardLayout; any solutions for OSX?

2015-03-05 Thread Timothy W. Grove
I was looking for a way to change keyboard layouts from within a Python 3 / PyQt4 application. Win32api.LoadKeyboardLayout has come to my rescue on Windows, but is anyone aware of a cross-platform or OSX specific solution for Apple Mac? Thanks for any suggestions. Best regards, Tim -- https://

Re: Newbie question about text encoding

2015-03-05 Thread Steven D'Aprano
Rustom Mody wrote: > On Wednesday, March 4, 2015 at 10:25:24 AM UTC+5:30, Chris Angelico wrote: >> On Wed, Mar 4, 2015 at 3:45 PM, Rustom Mody wrote: >> > >> > It lists some examples of software that somehow break/goof going from >> > BMP-only unicode to 7.0 unicode. >> > >> > IOW the suggestion

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-05 Thread Marko Rauhamaa
Mario Figueiredo : > If instead you prefer to demand british people to speak in your > accent, because you are in your country I'm in Finland, mind you. Finnish (the Häme dialect, specifically) is my native language. I'm not suggesting my international coworkers should address me in my language,

Re: Reading all buffered bytes without blocking

2015-03-05 Thread Oscar
In article , wrote: buffer = ('a'*998 + '\u20ac').encode('utf-8')[:1000] buffer.decode('utf-8') >Traceback (most recent call last): > File "", line 1, in >UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 998-999: >unexpected end of data # BOUM hmm... >>>

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-05 Thread Mario Figueiredo
On Thu, 05 Mar 2015 07:19:42 +0200, Marko Rauhamaa wrote: > >Where I work, people do use voice still occasionally to communicate. > Communications skills... the bane of any software developer. Pronunciation is just another obstacle to cross on top of the natural barrier that is transmitting compl

Re: Do not run this code.

2015-03-05 Thread Ian Kelly
On Thu, Mar 5, 2015 at 12:39 AM, Dave Farrance wrote: > Ben Finney wrote: > >>Chris Angelico writes: >> >>> import base64; exec(…) >> >>That's all I need to know. Code with ‘exec()’ calls, I consider unsafe >>by default. > > Indeed. replacing exec with print... > print(base64.b64decode(b"eD