Re: Unicode in Python

2014-04-21 Thread Chris Angelico
On Tue, Apr 22, 2014 at 4:30 PM, Rustom Mody wrote: > So instead of using λ (0x3bb) we should use 𝝀 (0x1d740) or something > thereabouts like 𝜆 You still have a major problem: How do you type that? It gives you very little advantage over the word "lambda", it introduces readability issues, it'

Re: Unicode in Python

2014-04-21 Thread Rustom Mody
On Tuesday, April 22, 2014 11:41:56 AM UTC+5:30, Steven D'Aprano wrote: > On Mon, 21 Apr 2014 20:57:39 -0700, Rustom Mody wrote: > > As a unicode user (ok wannabe unicode user :D ) Ive written up some > > unicode ideas that have been discussed here in the last couple of weeks: > > http://blog.lang

Re: Unicode in Python

2014-04-21 Thread Chris Angelico
On Tue, Apr 22, 2014 at 4:18 PM, Rustom Mody wrote: > Ive reworded it to make it clear that I am referring to the character-sets and > not encodings. It's still false, and was in Python 2 as well. The only difference on that front is that, in the absence of an encoding cookie, Python 2 defaults t

Re: Unicode in Python

2014-04-21 Thread Ian Kelly
On Apr 22, 2014 12:01 AM, "Rustom Mody" wrote: > As a unicode user (ok wannabe unicode user :D ) Ive > written up some unicode ideas that have been discussed here in the > last couple of weeks: > > http://blog.languager.org/2014/04/unicoded-python.html I'm reminded of this satire: http://www.ojoh

Re: Unicode in Python

2014-04-21 Thread Rustom Mody
On Tuesday, April 22, 2014 11:14:17 AM UTC+5:30, Terry Reedy wrote: > On 4/21/2014 11:57 PM, Rustom Mody wrote: > > As a unicode user (ok wannabe unicode user :D ) Ive > > written up some unicode ideas that have been discussed here in the > > last couple of weeks: > > http://blog.languager.org/201

Re: Unicode in Python

2014-04-21 Thread Steven D'Aprano
On Mon, 21 Apr 2014 20:57:39 -0700, Rustom Mody wrote: > As a unicode user (ok wannabe unicode user :D ) Ive written up some > unicode ideas that have been discussed here in the last couple of weeks: > > http://blog.languager.org/2014/04/unicoded-python.html What you are talking about is not ha

Re: Why Python 3?

2014-04-21 Thread Gregory Ewing
Chris Angelico wrote: As it is, we have the case that most lowish integers have equivalent floats (all integers within the range that most people use them), and beyond that, you have problems. No, I don't. I'm not talking about representing ints using floats, I'm talking about representing floa

Re: Unicode in Python

2014-04-21 Thread Terry Reedy
On 4/21/2014 11:57 PM, Rustom Mody wrote: As a unicode user (ok wannabe unicode user :D ) Ive written up some unicode ideas that have been discussed here in the last couple of weeks: http://blog.languager.org/2014/04/unicoded-python.html "With python 3 we are at a stage where python programs

Unicode in Python

2014-04-21 Thread Rustom Mody
On Sunday, April 20, 2014 3:29:00 PM UTC+5:30, Steven D'Aprano wrote: > On Fri, 18 Apr 2014 23:40:18 -0700, Paul Rubin wrote: > > > It's just that the improvement > > from 2 to 3 is rather small, and 2 works perfectly well and people are > > used to it, so they keep using it. > > > Spoken like a

How to properly get the microseconds from the timestamps?

2014-04-21 Thread Igor Korot
Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\My Documents\GitHub\webapp\django\mysql_db_loader>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> datetime.date

Re: Why Python 3?

2014-04-21 Thread Chris Angelico
On Tue, Apr 22, 2014 at 8:28 AM, Gregory Ewing wrote: > The reason it doesn't work well is because of the > automatic promotion of ints to floats when they meet > other floats. This leads to a style where people often > use ints to stand for int-valued floats and expect > them to be promoted where

Re: Why Python 3?

2014-04-21 Thread Gregory Ewing
Chris Angelico wrote: All other basic arithmetic operations on two numbers of the same type results in another number of that type. ... There's just one special case: dividing an integer by an integer yields a float, if and only if you use truediv. It sticks out as an exception. I take your poi

Re: Why Python 3?

2014-04-21 Thread Gregory Ewing
Chris Angelico wrote: Earlier it was said that having both / and // lets you explicitly choose whether you want a float result or an int by picking an operator. I'm saying that's not so; the operator and the type aren't quite orthogonal, but close to. I don't think I said that, or if I did I wa

Re: which book to read next??

2014-04-21 Thread Emile van Sebille
On 4/21/2014 7:13 AM, lee wrote: 4, the python standard library by examples I'd take this on -- it provides a comprehensive overview of what's where in the standard library which you'll likely use a lot. which one is suitable for me?? That we can't answer. :) Emile -- https://mail.py

Re: selective (inheriting?) dir()?

2014-04-21 Thread Terry Reedy
On 4/21/2014 10:06 AM, Skip Montanaro wrote: Before I get up to my neck in gators over this, I was hoping perhaps someone already had a solution. Suppose I have two classes, A and B, the latter inheriting from the former: class A: def __init__(self): self.x = 0 class B(A): de

Re: Recommended exception for objects that can't be pickled

2014-04-21 Thread Terry Reedy
On 4/21/2014 9:23 AM, Stefan Schwarzer wrote: Hi, Recently, I got a request [1] to support pickling of `FTPHost` instances in my `ftplib` library. I explained in the ticket why I think it's a bad idea and now want to make explicit that `FTPHost` objects can't be pickled. The usual way to do thi

Re: [OT] Testing and credentials best practices?

2014-04-21 Thread Miki Tebeka
>> How do you deal with tests (both on dev machine and Jenkins) that need >> credentials (such as AWS keys)?. > I've done several of these. Another option that may work in some > contexts is to mock the test altogether; Thanks, but mocking is last resort for me, it reduces the value of testing gr

which book to read next??

2014-04-21 Thread lee
Thanks for all of the respones, Writing a game in pygame is a good idea. Thank you! -- 发自 Android 网易邮箱-- https://mail.python.org/mailman/listinfo/python-list

Re: which book to read next??

2014-04-21 Thread Mark Lawrence
On 21/04/2014 17:22, Chris Angelico wrote: On Tue, Apr 22, 2014 at 2:20 AM, Tim Chase wrote: Problem: I'm bored Solution: write yourself a game in pygame Alternative solution: Join python-ideas as well as python-list, and pledge to read *every* post. ChrisA Alternative alternative solutio

Re: which book to read next??

2014-04-21 Thread Chris Angelico
On Tue, Apr 22, 2014 at 2:20 AM, Tim Chase wrote: > Problem: I'm bored > Solution: write yourself a game in pygame Alternative solution: Join python-ideas as well as python-list, and pledge to read *every* post. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: which book to read next??

2014-04-21 Thread Tim Chase
On 2014-04-21 22:13, lee wrote: > Hi, I have read the book 'a byte of python' and now I want to read > another book. But I just get confused about which one to read next. > There is a book list below: 1, pro python > 2, python algorithms > 3, python cookbook > 4, the python standard library by exam

Re: which book to read next??

2014-04-21 Thread Joel Goldstick
On Mon, Apr 21, 2014 at 11:41 AM, Alan Gauld wrote: > On 21/04/14 15:13, lee wrote: > >> Hi, I have read the book 'a byte of python' and now I want to read >> another book. But I just get confused about which one to read next. >> There is a book list below: >> 1, pro python >> 2, python algorithms

Re: selective (inheriting?) dir()?

2014-04-21 Thread Skip Montanaro
Thanks for the responses. I'm not really interested in perfection here. I do most of my programming in a mature internally developed platform written in Python. As the platform has grown and approaches to different problems have changed 12-15 year period, some of the classes which are instantiated

Re: which book to read next??

2014-04-21 Thread Alan Gauld
On 21/04/14 15:13, lee wrote: Hi, I have read the book 'a byte of python' and now I want to read another book. But I just get confused about which one to read next. There is a book list below: 1, pro python 2, python algorithms 3, python cookbook 4, the python standard library by examples which o

Re: selective (inheriting?) dir()?

2014-04-21 Thread Steven D'Aprano
On Mon, 21 Apr 2014 09:06:14 -0500, Skip Montanaro wrote: [...] > Now, dir(inst_b) will list both 'x' and 'y' as attributes (along with > the various under under attributes). Without examining the source, is it > possible to define some kind of "selective" dir, with a API like > > def selecti

Re: selective (inheriting?) dir()?

2014-04-21 Thread Chris Angelico
On Tue, Apr 22, 2014 at 12:06 AM, Skip Montanaro wrote: > Without examining the source, is > it possible to define some kind of "selective" dir, with a API like > > def selective_dir(inst, class_): pass > > which will list only those attributes of inst which were first defined > in (some metho

which book to read next??

2014-04-21 Thread lee
Hi, I have read the book 'a byte of python' and now I want to read another book. But I just get confused about which one to read next. There is a book list below: 1, pro python 2, python algorithms 3, python cookbook 4, the python standard library by examples which one is suitable for me?? Or I ne

selective (inheriting?) dir()?

2014-04-21 Thread Skip Montanaro
Before I get up to my neck in gators over this, I was hoping perhaps someone already had a solution. Suppose I have two classes, A and B, the latter inheriting from the former: class A: def __init__(self): self.x = 0 class B(A): def __init__(self): A.__init__(self)

Re: symple programming task

2014-04-21 Thread Chris Angelico
On Mon, Apr 21, 2014 at 11:21 PM, Ivan Ivanivich wrote: > if "basis" is 15, then "mod" == 0 twice - when the "divider" is 3 and 15 Good! Yes, you worked out exactly what the problem is. :) There are ways to simplify your code, but it's now giving the correct result, so that's the most important

Re: symple programming task

2014-04-21 Thread Tim Chase
On 2014-04-21 06:21, Ivan Ivanivich wrote: > > Find the sum of all the multiples of 3 or 5 below 1000. > my new version of script: > > total = 0 > div1 = 3 > div2 = 5 > for basis in range(0, 1000): > mod = basis % div1 > if mod == 0: > total = total + basis >

Recommended exception for objects that can't be pickled

2014-04-21 Thread Stefan Schwarzer
Hi, Recently, I got a request [1] to support pickling of `FTPHost` instances in my `ftplib` library. I explained in the ticket why I think it's a bad idea and now want to make explicit that `FTPHost` objects can't be pickled. The usual way to do this seems to be defining a `__getstate__` method a

Re: symple programming task

2014-04-21 Thread Ivan Ivanivich
On Sunday, April 20, 2014 10:43:37 PM UTC+4, Ivan Ivanivich wrote: > hi all, i have simple programming task: > > > > [quot] > > If we list all the natural numbers below 10 that are multiples of 3 or 5, we > get 3, 5, 6 and 9. The sum of these multiples is 23. > > > > Find the sum of all the

Re: symple programming task

2014-04-21 Thread Joshua Landau
On 20 April 2014 20:27, Ivan Ivanivich wrote: > thanks, i found the bag G'day. This [https://xkcd.com/979/] applies to threads ending in "nvm, solved it" too. I know the problem in your case isn't likely to be widely useful, but there are other benefits of pointing out what you've done. For exam

Re: Why Python 3?

2014-04-21 Thread wxjmfauth
wxPhoenix. The funny side of wxPhoenix is, that it *also* has its own understanding of unicode and it finally only succeeds to produce mojibakes. I've tried to explained... (I was an early wxPython user from wxPython 2.0 (!). I used, tested, reported about, all wxPython versions up to the shift t

Read TLS cert serial number?

2014-04-21 Thread Anthony Papillion
Is there a way to read the serial number of a TLS cert my app receives? Anthony Sent from my mobile device -- https://mail.python.org/mailman/listinfo/python-list

Re: how to string format when string have {

2014-04-21 Thread Chris Angelico
On Mon, Apr 21, 2014 at 6:51 PM, Peter Otten <__pete...@web.de> wrote: > Some regex gymnastics in the morning (not recommended): You ask me to believe that a regex would be the best solution here? There's no use trying; one CAN'T believe impossible things. ChrisA (There goes the shawl again!) --

Re: how to string format when string have {

2014-04-21 Thread Peter Otten
Chris Angelico wrote: > On Mon, Apr 21, 2014 at 8:34 AM, Mariano DAngelo > wrote: >> And I want to format like this: >> >> context = { >> "project_name":project_name, >> "project_url":project_url, >> } >> >> nginx_conf.format(**context) >> >> >> but since the string have { i can't. >> Is there