Re: Oh look, another language (ceylon)
in 710625 20131119 091055 wxjmfa...@gmail.com wrote: Le lundi 18 novembre 2013 14:31:33 UTC+1, Steven D'Aprano a =E9crit=A0: ... choose one of the three bad choices: ... * choose UTF-16 or UTF-8, and have O(n) primitive string operations (like= =20 Haskell and, apparently, Ceylon); * or UTF-16 without support for the supplementary planes (which makes it= =20 virtually UCS-2), like Javascript; * choose UTF-32, and use two or four times as much memory as needed. Nothing can beat the coding schemes endorsed by Unicode. They are all working on the smallest possible entity level (Unicode Transformation *Units*) with a unique set of these entities. To not forget. Is that an egg-corn? -- https://mail.python.org/mailman/listinfo/python-list
Getting RuntimeError: invalid slot offset when importing a module
Hello all, I am getting above error when trying to import ssl module. In fact, the error showed up during the build and _ssl module was added to the failed module list. However, the compilation and link went well. Could anyone shed some lights on how to get it work? Thanks in advance! Br, -- https://mail.python.org/mailman/listinfo/python-list
Re: Getting RuntimeError: invalid slot offset when importing a module
Environment: Python: 3.3.2 OpenSSL: 0.9.8y (also tried 0.9.7) OS: AIX 6.1 (also tried on HPUX_1131_IA) Thanks, 在 2013年11月20日星期三UTC+1上午9时21分23秒,del...@gmail.com写道: Hello all, I am getting above error when trying to import ssl module. In fact, the error showed up during the build and _ssl module was added to the failed module list. However, the compilation and link went well. Could anyone shed some lights on how to get it work? Thanks in advance! Br, -- https://mail.python.org/mailman/listinfo/python-list
Re: Getting RuntimeError: invalid slot offset when importing a module
On Wed, 20 Nov 2013 00:21:23 -0800, dellair wrote: Hello all, I am getting above error when trying to import ssl module. In fact, the error showed up during the build and _ssl module was added to the failed module list. However, the compilation and link went well. If the _ssl module fails to compile correctly, the ssl module can't work. You're going to need to check the compilation error and see what it says. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Getting RuntimeError: invalid slot offset when importing a module
Steven, Thanks for the reply, There was no error on compilation and link phases, only some warnings. However, during Python build, there is an import phase right after the link, which shows the same error as stated. building '_ssl' extension xlc_r -DNDEBUG -O -IInclude -I. -I/usr/local/include -c /aix/Modules/_ssl.c -o build/temp.aix-6.1-3.3/aix/Modules/_ssl.o /aix/Modules/_ssl.c, line 262.17: 1506-196 (W) Initialization between types void* and struct _object*(*)(struct {...}*) is not allowed. /aix/Modules/ld_so_aix xlc_r -bI:/aix/Modules/python.exp build/temp.aix-6.1-3.3/aix/Modules/_ssl.o -L/usr/local/lib -lssl -lcrypto -o build/lib.aix-6.1-3.3/_ssl.so ld: 0711-224 WARNING: Duplicate symbol: .bcopy ld: 0711-224 WARNING: Duplicate symbol: .memcpy ld: 0711-224 WARNING: Duplicate symbol: .memmove ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. *** WARNING: importing extension _ssl failed with build/lib.aix-6.1-3.3/_ssl.so: class 'RuntimeError': invalid slot offset: traceback object at 0x3017e9e0 Any idea on how to debug? Thanks, 在 2013年11月20日星期三UTC+1上午9时29分41秒,Steven D'Aprano写道: On Wed, 20 Nov 2013 00:21:23 -0800, dellair wrote: Hello all, I am getting above error when trying to import ssl module. In fact, the error showed up during the build and _ssl module was added to the failed module list. However, the compilation and link went well. If the _ssl module fails to compile correctly, the ssl module can't work. You're going to need to check the compilation error and see what it says. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. -- I am practicing a fine point of ethics. It is acceptable to shoot back. It is not acceptable to shoot first. -- Zed Pobre -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. -- I am practicing a fine point of ethics. It is acceptable to shoot back. It is not acceptable to shoot first. -- Zed Pobre -- https://mail.python.org/mailman/listinfo/python-list
Re: How to install pip for python3 on OS X?
Mavericks? Homebrew all the way. Google Homebrew and install it brew install python3 pip3 install pyserial Craig reporting from the road 10550 N Torrey Pines Rd La Jolla CA 92037 work: 858 784 9208 cell: 619 623 2233 On Nov 19, 2013, at 10:55 PM, Travis Griggs travisgri...@gmail.com wrote: OSX (Mavericks) has python2.7 stock installed. But I do all my own personal python stuff with 3.3. I just flushed my 3.3.2 install and installed the new 3.3.3. So I need to install pyserial again. I can do it the way I've done it before, which is: Download pyserial from pypi untar pyserial.tgz cd pyserial python3 setup.py install But I'd like to do like the cool kids do, and just do something like pip3 install pyserial. But it's not clear how I get to that point. And just that point. Not interested (unless I have to be) in virtualenv yet. -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
zip list, variables
If c = map(sum, zip([1, 2, 3], [4, 5, 6])) c Out[7]: [5, 7, 9] why then can't I do this? a = ([1, 2], [3, 4]) b = ([5, 6], [7, 8]) c = map(sum, zip(a, b)) --- TypeError Traceback (most recent call last) ipython-input-3-cc046c85514b in module() 1 c = map(sum, zip(a, b)) TypeError: unsupported operand type(s) for +: 'int' and 'list' How can I do this legally? Sayth -- https://mail.python.org/mailman/listinfo/python-list
Re: zip list, variables
flebber wrote: If c = map(sum, zip([1, 2, 3], [4, 5, 6])) c Out[7]: [5, 7, 9] why then can't I do this? a = ([1, 2], [3, 4]) b = ([5, 6], [7, 8]) c = map(sum, zip(a, b)) --- TypeError Traceback (most recent call last) ipython-input-3-cc046c85514b in module() 1 c = map(sum, zip(a, b)) TypeError: unsupported operand type(s) for +: 'int' and 'list' How can I do this legally? You are obscuring the issue with your map-zippery. The initial value of sum() is 0, so if you want to sum lists you have to provide a start value, typically an empty list: sum([[1],[2]]) Traceback (most recent call last): File stdin, line 1, in module TypeError: unsupported operand type(s) for +: 'int' and 'list' sum([[1],[2]], []) [1, 2] Applying that to your example: def list_sum(items): ... return sum(items, []) ... map(list_sum, zip(a, b)) [[1, 2, 5, 6], [3, 4, 7, 8]] Alternatively, reduce() does not require an initial value: map(functools.partial(reduce, operator.add), zip(a, b)) [[1, 2, 5, 6], [3, 4, 7, 8]] But doing it with a list comprehension is the most pythonic solution here... -- https://mail.python.org/mailman/listinfo/python-list
Re: zip list, variables
flebber flebber.c...@gmail.com writes: If c = map(sum, zip([1, 2, 3], [4, 5, 6])) c Out[7]: [5, 7, 9] why then can't I do this? a = ([1, 2], [3, 4]) b = ([5, 6], [7, 8]) c = map(sum, zip(a, b)) --- TypeError Traceback (most recent call last) ipython-input-3-cc046c85514b in module() 1 c = map(sum, zip(a, b)) TypeError: unsupported operand type(s) for +: 'int' and 'list' The error message comes from sum(([1,2],[5,6])), where start defaults to 0. A way to understand what is happening is to inspect zip(a,b), notice that the first element of zip(a,b) is ([1,2],[5,6]), and then find out what sum(([1,2],[5,6])) is. The extra parentheses may seem a bit subtle, and at least in Python 3, zip and map return opaque objects, so it does take a bit to get used to all the details, The offending operands to '+' are 0 and [1,2]. How can I do this legally? I think the easiest is [ x + y for x, y in zip(a,b) ] if you want concatenation, and something like the following if you want a nested numerical addition: [ [ x + y for x, y in zip(x,y) ] for x, y in zip(a,b) ] [[6, 8], [10, 12]] There is probably a way to use map and sum for this, together with the mechanisms that change arguments to lists or vice versa (the syntax involves *), and partial application to specify a different start for sum if you want concatenation, but I doubt you can avoid some sort of nesting in the expression, and I doubt it will be clearer than the above suggestions. But someone may well show a way. (Sorry if this paragraph sounds like so much gibberish.) -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
Denis McMahon denismfmcma...@gmail.com wrote: 1) Find all the numbers less than n that are not divisible by a, b, or c. ask the user for x; assign the value 0 to some other variable i; while i is not greater than than x do the following [ if i is not divisible by a and i is not divisible by b and i is not divisible by c then display i to the user; add 1 to i; ] The question didn't ask to find all the numbers, it asked to count how many there are. Also even if you change this to count instead of print, it could be very inefficient for large values of x. If x is greater than a*b*c, find how many numbers up to a*b*c are not divisible by a, b, or c. (Depending on your interpretation of the English language for 2, 3, 5 this is either 8 or 1, you could check whether the system is set to Australian English to determine the correct action here.) You may then store these numbers in a list for easy reference. Now the answer you want is the length of that list times the integer part of x divided by a*b*c plus the number of values in the list that are less than the remainder you get when dividing x by a*b*c. If x is less than a*b*c then just find how many numbers up to x are not divisible by a, b, or c, which would be a case of re-using some of the above code. For extra credit, calculate and use the least common multiple of a,b and c instead of just using their product. -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list
Re: parsing RSS XML feed for item value
feed.entries[0].w_current {'temperature': u'20.3', 'dewpoint': u'18.6', 'windgusts': u'29.6', 'rain': u'0.6', 'humidity': u'90', 'pressure': u'0.0', 'windspeed': u'22.2', 'winddirection': u'SSW'} in the above I get the subitem as shown. How do I extract the label, values pairs? -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On 20/11/2013 09:29, Alister wrote: On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. Ambiguity is the reason that some of the most expensive language lessons in the world are at places like Sandhurst and West Point. Giving crystal clear orders, whether verbally or in writing, is considered quite important in the military. By the way, this is double posted and there were four identical messages from you yesterday, finger trouble or what? :) -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Setting longer default decimal precision
Hi Kay, You emailed me off-list, but your email address is bouncing or invalid, so I have no way to email you back. Unless you have something private or personal to say, you should keep replies on the list here so that others can either answer your questions or learn from the responses. If you do have something private to say, you should use a real email address that accepts replies :-) I'm taking the liberty of republishing your comments to me here: [you wrote] Okay,but after I import math and decimal, py decimal.getcontext().prec=75 py print decimal.Decimal(math.atan(1)) 0.78539816339744827899949086713604629039764404296875 though I set precision to 75, it only did the trig function to 50 places AND it is only right to 16 places, 0.785398163397448309615660845819875721049292349843776...(actual). [end quote] Here, you calculate the atan of 1 using floating point maths, that is, to the precision of C doubles (about 17 decimal places). After the calculation is performed using float, you then convert it to a Decimal, but it is too late, you can't retroactively regain precision. In a perfect world, this would work: math.atan(Decimal(1)) but alas, all the functions in the math module convert their arguments to float first, so even though your Decimal(1) could perform calculations to 75 decimal places, the math.atan function downgrades it to a regular float. Unfortunately, Decimals don't support high-precision trig functions. If you study the decimal.py module, you could possibly work out how to add support for trig functions, but they have no current support for them. You could try this third-party module: http://code.google.com/p/mpmath/ which claims to be arbitrary-precision maths for Python, but I've never used it. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: How to install pip for python3 on OS X?
On 20/11/2013 06:55, Travis Griggs wrote: OSX (Mavericks) has python2.7 stock installed. But I do all my own personal python stuff with 3.3. I just flushed my 3.3.2 install and installed the new 3.3.3. So I need to install pyserial again. Just idle curiosity but why do you have to do this? On Windows I just whack 3.3.3 over the top of 3.3.2, job done. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Suggest an open-source issue tracker, with github integration and kanban boards?
I actually did end up finding one; but now need bitbucket integration also. Anyway, here is the link: https://github.com/rauhryan/huboard On Mon, Nov 18, 2013 at 5:47 AM, Kevin Walzer k...@codebykevin.com wrote: On 11/13/13, 7:46 AM, Alec Taylor wrote: Started to build this on my own; then was like, hang on! - This is probably something very commonly requested… Can you recommend an open source project (or two) written in Python; which covers multi project + sub project issue tracking linked across github repositories? [on the github side, want to be able to reference commit hash solved by patch from issue #; fine to have that extra annotation only present on my server] Also would be perfect if it has kanban board support, issue prioritisation and distribution/assignment amongst team members; as well as related analytics. Thanks for all suggestions! =) Not written in Python, but Fossil (http://www.fossil-scm.org/) offers an all-in-one, lightweight DCVS/issue-tracking/wiki/blog package. Written the author of SQLite. --Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Setting longer default decimal precision
On 20 November 2013 14:02, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: but alas, all the functions in the math module convert their arguments to float first, so even though your Decimal(1) could perform calculations to 75 decimal places, the math.atan function downgrades it to a regular float. Unfortunately, Decimals don't support high-precision trig functions. If you study the decimal.py module, you could possibly work out how to add support for trig functions, but they have no current support for them. The documentation has examples for how to make high precision sin() and cos() functions that work with Decimals. http://docs.python.org/2/library/decimal.html#recipes The basic idea is to sum terms of the Maclaurin series until it converges. For atan(x) the Maclaurin series is atan(x) = x - (1/3)x**3 + (1/5)x**5 - (1/7)x**7 + (1/9)x**9 + ... The nth term is given by f(n) = ((-1)**n)*(1/(2n+1))*x**(2n+1). The ratio test gives that that |f(n+1)/f(n)| = (2(n+1)+1)/(2n + 1) * x**2 which has a limiting value of x**2 so the series converges for |x| 1 (unlike sin() and cos() that converge for all x). For values outside this range you can use the identity arctan(1/x) == sign(x)*pi/2 - arctan(x) to map the values back into the convergent range. This may still be problematic when x is close to 1 in which case an alternate Taylor series around x=1 could be used. You'd need to ensure that you were using enough digits for pi as well if you wanted to make this work. It's probably easiest just to use the mpmath library as Steven suggested (or gmpy2, or sympy which includes mpmath). Oscar -- https://mail.python.org/mailman/listinfo/python-list
run command line on Windows without showing DOS console window
is there anyway to run command line on Windows without showing DOS console window ? can you use the following command line to give a little example ? wget -r -np -nd http://example.com/packages/ the path to wget is C:\Program Files\GnuWin32\bin\wget.exe -- https://mail.python.org/mailman/listinfo/python-list
Fwd: parsing RSS XML feed for item value
Larry Wilson itd...@gmail.com via python.org 10:39 PM (10 hours ago) wrote: Wanting to parse out the the temperature value in the w:current element, just after the guid element using ElementTree or xml.sax. Since you aren't building up a complex data structure, xml.sax will be an OK choice. Here's a quick and dirty job: import io import xml.sax as sax the_xml = io.StringIO(SNIPPED XML) class WeatherHandler(sax.handler.ContentHandler): def startDocument(self): self.temperatures = [] def startElement(self, name, attrs): if name == 'w:current': # Nice namespace handling, eh? self.temperatures.append(attrs) handler = WeatherHandler() sax.parse(the_xml, handler) for temp in handler.temperatures: for key, val in temp.items(): print({}: {}.format(key, val)) Output (from your example): windGusts: 29.6 dewPoint: 18.6 pressure: 0.0 windDirection: SSW humidity: 90 rain: 0.6 temperature: 20.3 windSpeed: 22.2 For most jobs you would want to keep track of your nesting level, but that's left out here. I didn't try to capture location or info you might want but didn't specify, either; left that as an exercise. -- https://mail.python.org/mailman/listinfo/python-list
Re: run command line on Windows without showing DOS console window
On 20/11/2013 14:44, iMath wrote: is there anyway to run command line on Windows without showing DOS console window ? can you use the following command line to give a little example ? wget -r -np -nd http://example.com/packages/ the path to wget is C:\Program Files\GnuWin32\bin\wget.exe subprocess.call([wget, -r, -np, -nd, http://example.com;]) TJG -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
Here's a response from a full-blooded Scot on the subject. On Wed, Nov 20, 2013 at 8:29 PM, Derrick McCLURE j.d.mccl...@virgin.net wrote: No, Chris, you haven't been led astray. The language is referred to as Scots, not Scottish. There is an academic journal called Scottish Language, which I edited for many years, but the meaning of that is language in Scotland - it publishes articles on Scots, Gaelic, and English as used in Scotland. So there you are. Your piece of random linguistics trivia for the day. :) Enjoy! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 13:57:30 +, Mark Lawrence wrote: On 20/11/2013 09:29, Alister wrote: On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. Ambiguity is the reason that some of the most expensive language lessons in the world are at places like Sandhurst and West Point. Giving crystal clear orders, whether verbally or in writing, is considered quite important in the military. By the way, this is double posted and there were four identical messages from you yesterday, finger trouble or what? :) I don't think the problem is at my end. I am only sending once to the best of my knowledge (using Pan newsreader to Comp.lang.python) -- Thou shalt not put policy into the kernel. - Al Viro on linux-kernel -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 13:57:30 +, Mark Lawrence wrote: On 20/11/2013 09:29, Alister wrote: On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. Ambiguity is the reason that some of the most expensive language lessons in the world are at places like Sandhurst and West Point. Giving crystal clear orders, whether verbally or in writing, is considered quite important in the military. By the way, this is double posted and there were four identical messages from you yesterday, finger trouble or what? :) I don't think the problem is at my end. I am only sending once to the best of my knowledge (using Pan newsreader to Comp.lang.python) -- Thou shalt not put policy into the kernel. - Al Viro on linux-kernel -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 13:57:30 +, Mark Lawrence wrote: On 20/11/2013 09:29, Alister wrote: On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. Ambiguity is the reason that some of the most expensive language lessons in the world are at places like Sandhurst and West Point. Giving crystal clear orders, whether verbally or in writing, is considered quite important in the military. By the way, this is double posted and there were four identical messages from you yesterday, finger trouble or what? :) I don't think the problem is at my end. I am only sending once to the best of my knowledge (using Pan newsreader to Comp.lang.python) -- Thou shalt not put policy into the kernel. - Al Viro on linux-kernel -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 13:57:30 +, Mark Lawrence wrote: On 20/11/2013 09:29, Alister wrote: On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. Ambiguity is the reason that some of the most expensive language lessons in the world are at places like Sandhurst and West Point. Giving crystal clear orders, whether verbally or in writing, is considered quite important in the military. By the way, this is double posted and there were four identical messages from you yesterday, finger trouble or what? :) I don't think the problem is at my end. I am only sending once to the best of my knowledge (using Pan newsreader to Comp.lang.python) -- Thou shalt not put policy into the kernel. - Al Viro on linux-kernel -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Thu, Nov 21, 2013 at 1:49 AM, Alister alister.w...@ntlworld.com wrote: On Wed, 20 Nov 2013 13:57:30 +, Mark Lawrence wrote: On 20/11/2013 09:29, Alister wrote: On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: By the way, this is double posted and there were four identical messages from you yesterday, finger trouble or what? :) I don't think the problem is at my end. I am only sending once to the best of my knowledge (using Pan newsreader to Comp.lang.python) Exactly four again. https://mail.python.org/pipermail/python-list/2013-November/660769.html https://mail.python.org/pipermail/python-list/2013-November/660770.html https://mail.python.org/pipermail/python-list/2013-November/660771.html https://mail.python.org/pipermail/python-list/2013-November/660772.html Might be a problem with the mail-news gateway, or might be that something's sending through by multiple routes for redundancy. The timestamps differ, not sure if that helps track it down. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Using try-catch to handle multiple possible file types?
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info via python.org 8:56 PM (12 hours ago) wrote: Write a helper function: def process(opener): with opener('blah.txt', 'rb') as f: for line in f: print(line) As another option, you can enter the context manager after you decide. try: f = gzip.open('blah.txt', 'rb') except IOError: f = open('blah.txt', 'rb') with f: # processing for line in f: print(line) contextlib.ExitStack was designed to handle cases where entering context is optional, and so also works for this use case. with contextlib.ExitStack() as stack: try: f = gzip.open('blah.txt', 'rb') except IOError: f = open('blah.txt', 'rb') stack.enter_context(f) for line in f: print(line) -- Neil Cerutti On Tue, Nov 19, 2013 at 8:56 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 19 Nov 2013 16:30:46 -0800, Victor Hooi wrote: Hi, Is either approach (try-excepts, or using libmagic) considered more idiomatic? What would you guys prefer yourselves? Specifically in the case of file types, I consider it better to use libmagic. But as a general technique, using try...except is a reasonable approach in many situations. Also, is it possible to use either approach with a context manager (with), without duplicating lots of code? For example: try: with gzip.open('blah.txt', 'rb') as f: for line in f: print(line) except IOError as e: with open('blah.txt', 'rb') as f: for line in f: print(line) I'm not sure of how to do this without needing to duplicating the processing lines (everything inside the with)? Write a helper function: def process(opener): with opener('blah.txt', 'rb') as f: for line in f: print(line) try: process(gzip.open) except IOError: process(open) If you have many different things to try: for opener in [gzip.open, open, ...]: try: process(opener) except IOError: continue else: break [...] Also, on another note, python-magic will return a string as a result, e.g.: gzip compressed data, was blah.txt, from Unix, last modified: Wed Nov 20 10:48:35 2013 I suppose it's enough to just do a? if gzip compressed data in results: or is there a better way? *shrug* Read the docs of python-magic. Do they offer a programmable API? If not, that kinda sucks. -- Steven -- https://mail.python.org/mailman/listinfo/python-list -- Neil Cerutti mr.cerutti+pyt...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 14:49:59 +, Alister wrote: On Wed, 20 Nov 2013 13:57:30 +, Mark Lawrence wrote: On 20/11/2013 09:29, Alister wrote: On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. Ambiguity is the reason that some of the most expensive language lessons in the world are at places like Sandhurst and West Point. Giving crystal clear orders, whether verbally or in writing, is considered quite important in the military. By the way, this is double posted and there were four identical messages from you yesterday, finger trouble or what? :) I don't think the problem is at my end. I am only sending once to the best of my knowledge (using Pan newsreader to Comp.lang.python) Ok this is now silly Apologies to everyone I am monitoring my network connection to confirm that i am not sending multiple times. -- T-1's congested due to porn traffic to the news server. -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 15:06:44 +, Alister wrote: On Wed, 20 Nov 2013 14:49:59 +, Alister wrote: On Wed, 20 Nov 2013 13:57:30 +, Mark Lawrence wrote: On 20/11/2013 09:29, Alister wrote: On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. Ambiguity is the reason that some of the most expensive language lessons in the world are at places like Sandhurst and West Point. Giving crystal clear orders, whether verbally or in writing, is considered quite important in the military. By the way, this is double posted and there were four identical messages from you yesterday, finger trouble or what? :) I don't think the problem is at my end. I am only sending once to the best of my knowledge (using Pan newsreader to Comp.lang.python) Ok this is now silly Apologies to everyone I am monitoring my network connection to confirm that i am not sending multiple times. that last one seemed good must be a strange quirk of pan turned off hide to system tray allow multiple instances. not sure why either of them should cause the problem, I only have 1 copie running -- Next to being shot at and missed, nothing is really quite as satisfying as an income tax refund. -- F. J. Raymond -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 14:49:59 +, Alister wrote: On Wed, 20 Nov 2013 13:57:30 +, Mark Lawrence wrote: On 20/11/2013 09:29, Alister wrote: On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote: On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano st...@pearwood.info wrote: 2 does count because it isn't divisible by 3. The question states, [count] how many positive integers less than N are not divisible by 2,3 or 5. Two is not divisible by 3, so not divisible by 2,3 or 5 is true, so two gets counted. The first number which is divisible by *all* of 2, 3 and 5 (i.e. fails the test, and therefore doesn't get counted) is 30. The next few that fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ... Remember, these are the numbers which should not be counted. I count 1, not 6 Out of curiosity, which number did you count? 1 of course. It's the only one that's not divisible by any of the factors. Apparently we disagree about precedence and associativity in English. I believe the not applies to the result of (divisible by 2, 3, or 5), so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49. If I were trying to get the series you describe, I'd phrase it as Not divisible by 2, and not divisible by 3, and not divisible by 5 This ambiguity is a great example of why teachers (and enayone else responsible for specifying a programming project) should take greater care when specifying tasks. if it is to late to ask for clarification (the correct step in a real world case) I suggest you write 2 programs 1 for each interpretation, it will be good for your personal learning even if the teacher does not give any extra credit. Ambiguity is the reason that some of the most expensive language lessons in the world are at places like Sandhurst and West Point. Giving crystal clear orders, whether verbally or in writing, is considered quite important in the military. By the way, this is double posted and there were four identical messages from you yesterday, finger trouble or what? :) I don't think the problem is at my end. I am only sending once to the best of my knowledge (using Pan newsreader to Comp.lang.python) Ok this is now silly Apologies to everyone I am monitoring my network connection to confirm that i am not sending multiple times. -- T-1's congested due to porn traffic to the news server. -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On 20/11/2013 15:06, Alister wrote: Ok this is now silly Apologies to everyone I am monitoring my network connection to confirm that i am not sending multiple times. Still arriving multiple times, shoot the messenger? :) -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives -- You can fool all the people all of the time if the advertising is right and the budget is big enough. -- Joseph E. Levine -- https://mail.python.org/mailman/listinfo/python-list
Multiple postings
On Wed, 20 Nov 2013 15:35:14 +, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives that seemed fine with multiple instances enabled (only 1 running though) now trying with just hide in sys tray -- Our similarities are different. -Dale Berra, son of Yogi -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives -- You can fool all the people all of the time if the advertising is right and the budget is big enough. -- Joseph E. Levine -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives -- You can fool all the people all of the time if the advertising is right and the budget is big enough. -- Joseph E. Levine -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On Wed, Nov 20, 2013 at 2:11 AM, Chris Angelico ros...@gmail.com wrote: On Wed, Nov 20, 2013 at 2:06 AM, MRAB pyt...@mrabarnett.plus.com wrote: You need to distinguish between Scottish English and Scots, the latter being related to English, but isn't English, much as Danish is related to Swedish, but isn't Swedish. Ah. When I referred to a Scots word, I was talking about the Gaelic language, which has a number of delightfully expressive terms just waiting to be borrowed! By the way: I've since been corrected, and what I meant was not actually the Scottish Gaelic language but the one that is actually referred to as Scots. My clarification was unhelpfully unclear, and I apologize. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Total Python Newbie needs geting started info.
I am learning Python and wish to develop GUI applications to run on Windows. I have installed the Visual Studio integrated shell (Ver. 12.0.21005.1 REL) IDE and the Python 3.3 interpreter. I have gone through some of the 3.3 tutorial available at http://docs.python.org/3.3/tutorial/. The tutorial is all about using the interactive interrupter and writing little console programs to learn the language. Before I go too far down this road, I need to know if I can/should use this environment to develop GUI applications. Is there graphical support for this - for example I can I just insert/move/set properties of buttons, combo boxes, etc. using an interface like the one in VBA? If not, what is the best free IDE for me to use? What is the best tutorial for the IDE? I am a bit overwhelmed as to how to get started. Thanks for any help. -- https://mail.python.org/mailman/listinfo/python-list
Re: Total Python Newbie needs geting started info.
On Thu, Nov 21, 2013 at 3:03 AM, Ev J shorepoin...@gmail.com wrote: Before I go too far down this road, I need to know if I can/should use this environment to develop GUI applications. Is there graphical support for this - for example I can I just insert/move/set properties of buttons, combo boxes, etc. using an interface like the one in VBA? Yes, you most certainly can. In the Microsoft world, you get a language and its one GUI toolkit as a package deal; but in most of the rest of the world, they're quite separate. Python can be used with GTK, wx, TK, and a variety of other GUI toolkits; I happen to quite like GTK, which I also use with Pike, a quite different language, and can also be used with C and various other languages. So you can get to know Python, and then later on choose one of several GUI toolkits, and figure out how you want to lay out your window from there. The tutorial sticks with the console because it's simple and easy to work with; adding a GUI adds extra complexity, which can be left for later. I don't know how much of an interface like VBA you'll get, but there are graphical window builders. Personally, I don't use them; but if you want them, they do exist. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On 2013-11-19, Chris Angelico ros...@gmail.com wrote: Anyway, we Aussies know more about your geography than you know about ours, I reckon. Which of these is not a real place: Parramatta, Warrnambool, Cerinabbin, Mordialloc? No fair Googling them, see if you can call it. Next thing you'll be telling us that the Eels are a real rugby team. -- Grant Edwards grant.b.edwardsYow! If I had a Q-TIP, I at could prevent th' collapse gmail.comof NEGOTIATIONS!! -- https://mail.python.org/mailman/listinfo/python-list
Re: parsing RSS XML feed for item value
On Wednesday 2013 November 20 05:44, Larry Wilson wrote: {'temperature': u'20.3', 'dewpoint': u'18.6', 'windgusts': u'29.6', 'rain': u'0.6', 'humidity': u'90', 'pressure': u'0.0', 'windspeed': u'22.2', 'winddirection': u'SSW'} Python 2.7.2 (default, Oct 10 2011, 10:47:36) [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2 Type help, copyright, credits or license for more information. w_current = {'temperature': u'20.3', 'dewpoint': u'18.6', 'windgusts': u'29.6', 'rain': u'0.6', 'humidity': u'90', 'pressure': u'0.0', 'windspeed': u'22.2', 'winddirection': u'SSW'} for label, value in w_current.iteritems(): ... print label, value ... pressure 0.0 windspeed 22.2 temperature 20.3 dewpoint 18.6 windgusts 29.6 winddirection SSW rain 0.6 humidity 90 -- Yonder nor sorghum stenches shut ladle gulls stopper torque wet strainers. -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On Thu, Nov 21, 2013 at 3:14 AM, Grant Edwards invalid@invalid.invalid wrote: On 2013-11-19, Chris Angelico ros...@gmail.com wrote: Anyway, we Aussies know more about your geography than you know about ours, I reckon. Which of these is not a real place: Parramatta, Warrnambool, Cerinabbin, Mordialloc? No fair Googling them, see if you can call it. Next thing you'll be telling us that the Eels are a real rugby team. Wouldn't have the foggiest. I don't follow sport, so I don't know which teams are real and which are integer. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On 2013-11-19, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, Nov 15, 2013 at 1:45 PM, Alister alister.w...@ntlworld.com wrote: and if you haven't seen it before :- Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer be at the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. And the obligatory response: Iltnsegnetiry I'm sdutynig tihs crsrootaivnel pnoheenmon at the Dptmnearet of Liuniigctss at Absytrytewh Uivsreitny and my exartrnairdoy doisiervecs waleoetderhlhy cndairotct the picsbeliud fdnngiis rrgdinaeg the rtlvaeie dfuictlify of ialtnstny ttalrisanng sentences. My rsceeerhars deplveeod a cnionevent ctnoiaptorn at hnasoa/tw.nartswdbvweos/utrtek:p./il taht dosnatterems that the hhpsteyios uuiqelny wrtaarns criieltidby if the aoussmpitn that the prreoecandpne of your wrods is not eendetxd is uueniqtolnabse. Aoilegpos for aidnoptg a cdocianorttry vwpiienot but, ttoheliacrley spkeaing, lgitehnneng the words can mnartafucue an iocnuurgons samenttet that is vlrtiauly isbpilechmoenrne. While I certainly couldn't read that at normal speed, there were only a few words that I had to stop and actually puzzle over... -- Grant Edwards grant.b.edwardsYow! ... My pants just went at on a wild rampage through a gmail.comLong Island Bowling Alley!! -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On 20/11/2013 16:19, Chris Angelico wrote: On Thu, Nov 21, 2013 at 3:14 AM, Grant Edwards invalid@invalid.invalid wrote: On 2013-11-19, Chris Angelico ros...@gmail.com wrote: Anyway, we Aussies know more about your geography than you know about ours, I reckon. Which of these is not a real place: Parramatta, Warrnambool, Cerinabbin, Mordialloc? No fair Googling them, see if you can call it. Next thing you'll be telling us that the Eels are a real rugby team. Wouldn't have the foggiest. I don't follow sport, so I don't know which teams are real and which are integer. Which one was it, by the way? (Which was the fake place name?) Did I miss an email in this gripping series? TJG -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On 20/11/2013 15:34, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives Three. You're not Greek are you, and using a typical shabby Nazi trick to hide behind an ntlworld email address in order to spam us? :) -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: parsing RSS XML feed for item value
On Wednesday 2013 November 20 05:44, Larry Wilson wrote: feed.entries[0].w_current {'temperature': u'20.3', 'dewpoint': u'18.6', 'windgusts': u'29.6', 'rain': u'0.6', 'humidity': u'90', 'pressure': u'0.0', 'windspeed': u'22.2', 'winddirection': u'SSW'} in the above I get the subitem as shown. How do I extract the label, values pairs? Python 3.3.0 (default, Sep 30 2012, 09:02:56) [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux Type help, copyright, credits or license for more information. w_current = {'temperature': u'20.3', 'dewpoint': u'18.6', 'windgusts': u'29.6', 'rain': u'0.6', 'humidity': u'90', 'pressure': u'0.0', 'windspeed': u'22.2', 'winddirection': u'SSW'} for label, value in w_current.items(): ...print (label, value) ... dewpoint 18.6 temperature 20.3 rain 0.6 pressure 0.0 windspeed 22.2 humidity 90 winddirection SSW windgusts 29.6 -- Yonder nor sorghum stenches shut ladle gulls stopper torque wet strainers. -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On Thu, Nov 21, 2013 at 3:28 AM, Tim Golden m...@timgolden.me.uk wrote: On 20/11/2013 16:19, Chris Angelico wrote: On Thu, Nov 21, 2013 at 3:14 AM, Grant Edwards invalid@invalid.invalid wrote: On 2013-11-19, Chris Angelico ros...@gmail.com wrote: Anyway, we Aussies know more about your geography than you know about ours, I reckon. Which of these is not a real place: Parramatta, Warrnambool, Cerinabbin, Mordialloc? No fair Googling them, see if you can call it. Next thing you'll be telling us that the Eels are a real rugby team. Wouldn't have the foggiest. I don't follow sport, so I don't know which teams are real and which are integer. Which one was it, by the way? (Which was the fake place name?) Did I miss an email in this gripping series? I got a private email guessing (correctly), but nobody who actually _knew_, and nobody who was able to deduce the answer based on the structure of the words, which means I picked a sufficiently plausible fake :) But the actual fake is Cerinabbin, utterly and completely made up for the post. Parramatta is apparently known to a few people - it's in Sydney; Warrnambool and Mordialloc are both places in Victoria. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Total Python Newbie needs geting started info.
On Thu, 21 Nov 2013 03:14:44 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 3:03 AM, Ev J shorepoin...@gmail.com wrote: Before I go too far down this road, I need to know if I can/should use this environment to develop GUI applications. Is there graphical support for this - for example I can I just insert/move/set properties of buttons, combo boxes, etc. using an interface like the one in VBA? Yes, you most certainly can. In the Microsoft world, you get a language and its one GUI toolkit as a package deal; but in most of the rest of the world, they're quite separate. Python can be used with GTK, wx, TK, and a variety of other GUI toolkits; I happen to quite like GTK, which I also use with Pike, a quite different language, and can also be used with C and various other languages. So you can get to know Python, and then later on choose one of several GUI toolkits, and figure out how you want to lay out your window from there. The tutorial sticks with the console because it's simple and easy to work with; adding a GUI adds extra complexity, which can be left for later. I don't know how much of an interface like VBA you'll get, but there are graphical window builders. Personally, I don't use them; but if you want them, they do exist. ChrisA Glade works quite well for GTK I believe there is a WX version as well although i have never used it i am not sure about gt or tk -- Consensus Terrorism: The process that decides in-office attitudes and behavior. -- Douglas Coupland, Generation X: Tales for an Accelerated Culture -- https://mail.python.org/mailman/listinfo/python-list
Re: Total Python Newbie needs geting started info.
On 11/20/2013 11:03 AM, Ev J wrote: I am learning Python and wish to develop GUI applications to run on Windows. I have installed the Visual Studio integrated shell (Ver. 12.0.21005.1 REL) IDE and the Python 3.3 interpreter. I have gone through some of the 3.3 tutorial available at http://docs.python.org/3.3/tutorial/. The tutorial is all about using the interactive interrupter and writing little console programs to learn the language. Before I go too far down this road, I need to know if I can/should use this environment to develop GUI applications. Is there graphical support for this - for example I can I just insert/move/set properties of buttons, combo boxes, etc. using an interface like the one in VBA? If not, what is the best free IDE for me to use? What is the best tutorial for the IDE? I am a bit overwhelmed as to how to get started. Thanks for any help. The integrated shell for Visual Studio does not give you the drag and drop GUI builder like is available for VB or C#. I would say for a newbie you at Eric IDE: http://eric-ide.python-projects.org/ It uses the QT widget set and intergrated with QTBuilder to allow you to design GUI via dragging and dropping components. There are other GUI builders like GLADE for gtk, but QtBuilder is probably the closes to what you would be familiar with from using Visual Studio. -- Rod So little pains do the vulgar take in the investigation of truth, accepting readily the first story that comes to hand. -Thucydides History of The Peloponnesian War, 432BC -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wed, 20 Nov 2013 16:29:54 +, Mark Lawrence wrote: On 20/11/2013 15:34, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives Three. You're not Greek are you, and using a typical shabby Nazi trick to hide behind an ntlworld email address in order to spam us? :) Certainly not I hope i never cause that much offence It looks like some settings in Pan cause it to misbehave. now it is O.K. (i think) i am going to leave it alone. -- Christ was born in 4 B.C. -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On Thu, 21 Nov 2013 03:33:02 +1100, Chris Angelico wrote: But the actual fake is Cerinabbin You might have included Woolloomooloo in the list! -- https://mail.python.org/mailman/listinfo/python-list
Re: Suggest an open-source issue tracker, with github integration and kanban boards?
On Wednesday, November 20, 2013 6:36:56 AM UTC-8, Alec Taylor wrote: Anyway, here is the link: https://github.com/rauhryan/huboard I thought you wanted a Python bases solution. -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wednesday, November 20, 2013 11:29:54 AM UTC-5, Mark Lawrence wrote: On 20/11/2013 15:34, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives Three. You're not Greek are you, and using a typical shabby Nazi trick to hide behind an ntlworld email address in order to spam us? :) Mark Lawrence Nazi? Perhaps we could stick to more appropriate analogies? --Ned. -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On 20/11/2013 17:12, Ned Batchelder wrote: On Wednesday, November 20, 2013 11:29:54 AM UTC-5, Mark Lawrence wrote: On 20/11/2013 15:34, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives Three. You're not Greek are you, and using a typical shabby Nazi trick to hide behind an ntlworld email address in order to spam us? :) Mark Lawrence Nazi? Perhaps we could stick to more appropriate analogies? --Ned. It's an excellent analogy that I've used before, hence the smiley. Clearly you don't do any research before bothering to say anything. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wednesday, November 20, 2013 12:37:31 PM UTC-5, Mark Lawrence wrote: On 20/11/2013 17:12, Ned Batchelder wrote: On Wednesday, November 20, 2013 11:29:54 AM UTC-5, Mark Lawrence wrote: On 20/11/2013 15:34, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives Three. You're not Greek are you, and using a typical shabby Nazi trick to hide behind an ntlworld email address in order to spam us? :) Mark Lawrence Nazi? Perhaps we could stick to more appropriate analogies? --Ned. It's an excellent analogy that I've used before, hence the smiley. Clearly you don't do any research before bothering to say anything. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence You think these two things make an excellent analogy? 1) a newsgroup mishap being actively investigated, and 2) calculated genocide. It is not an excellent analogy, it's wildly disproportionate. Using a smiley doesn't fix it, and using it previously doesn't give you a free pass. What research was I supposed to have done? Examine your previous posts to see you overreacting before? That would hardly have convinced me that this was OK. --Ned. -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On 20/11/2013 17:51, Ned Batchelder wrote: On Wednesday, November 20, 2013 12:37:31 PM UTC-5, Mark Lawrence wrote: On 20/11/2013 17:12, Ned Batchelder wrote: On Wednesday, November 20, 2013 11:29:54 AM UTC-5, Mark Lawrence wrote: On 20/11/2013 15:34, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives Three. You're not Greek are you, and using a typical shabby Nazi trick to hide behind an ntlworld email address in order to spam us? :) Mark Lawrence Nazi? Perhaps we could stick to more appropriate analogies? --Ned. It's an excellent analogy that I've used before, hence the smiley. Clearly you don't do any research before bothering to say anything. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence You think these two things make an excellent analogy? 1) a newsgroup mishap being actively investigated, and 2) calculated genocide. It is not an excellent analogy, it's wildly disproportionate. Using a smiley doesn't fix it, and using it previously doesn't give you a free pass. What research was I supposed to have done? Examine your previous posts to see you overreacting before? That would hardly have convinced me that this was OK. --Ned. I suggest that you write to the BBC and get all episodes of the extremely popular *COMEDY* Dad's Army withdrawn as typical shabby Nazi trick was one of Captain Mainwearing's main lines. And if I want to overreact, I'll overreact, as I couldn't care two hoots whether I'm dealing with an arsehole from the Python Software Foundation or one who's not. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wednesday, November 20, 2013 1:09:42 PM UTC-5, Mark Lawrence wrote: On 20/11/2013 17:51, Ned Batchelder wrote: On Wednesday, November 20, 2013 12:37:31 PM UTC-5, Mark Lawrence wrote: On 20/11/2013 17:12, Ned Batchelder wrote: On Wednesday, November 20, 2013 11:29:54 AM UTC-5, Mark Lawrence wrote: On 20/11/2013 15:34, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives Three. You're not Greek are you, and using a typical shabby Nazi trick to hide behind an ntlworld email address in order to spam us? :) Mark Lawrence Nazi? Perhaps we could stick to more appropriate analogies? --Ned. It's an excellent analogy that I've used before, hence the smiley. Clearly you don't do any research before bothering to say anything. Mark Lawrence You think these two things make an excellent analogy? 1) a newsgroup mishap being actively investigated, and 2) calculated genocide. It is not an excellent analogy, it's wildly disproportionate. Using a smiley doesn't fix it, and using it previously doesn't give you a free pass. What research was I supposed to have done? Examine your previous posts to see you overreacting before? That would hardly have convinced me that this was OK. --Ned. I suggest that you write to the BBC and get all episodes of the extremely popular *COMEDY* Dad's Army withdrawn as typical shabby Nazi trick was one of Captain Mainwearing's main lines. I see what you are getting at. You were referring to a TV show popular in your part of the world 30 years ago. As this is a world-wide group, you might understand that I didn't get the reference, and perhaps many others did not either. Humor is tricky, you need to know your audience. And if I want to overreact, I'll overreact, as I couldn't care two hoots whether I'm dealing with an arsehole from the Python Software Foundation or one who's not. I have no idea why you feel the need to insult me. As to the PSF, this is relevant: http://www.python.org/psf/codeofconduct. Members of the community are respectful. Could you please be? --Ned. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Beginner
can someone really help to give me a more details answer please. what can i do with python? -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On 20/11/2013 18:18, Ned Batchelder wrote: On Wednesday, November 20, 2013 1:09:42 PM UTC-5, Mark Lawrence wrote: On 20/11/2013 17:51, Ned Batchelder wrote: On Wednesday, November 20, 2013 12:37:31 PM UTC-5, Mark Lawrence wrote: On 20/11/2013 17:12, Ned Batchelder wrote: On Wednesday, November 20, 2013 11:29:54 AM UTC-5, Mark Lawrence wrote: On 20/11/2013 15:34, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives Three. You're not Greek are you, and using a typical shabby Nazi trick to hide behind an ntlworld email address in order to spam us? :) Mark Lawrence Nazi? Perhaps we could stick to more appropriate analogies? --Ned. It's an excellent analogy that I've used before, hence the smiley. Clearly you don't do any research before bothering to say anything. Mark Lawrence You think these two things make an excellent analogy? 1) a newsgroup mishap being actively investigated, and 2) calculated genocide. It is not an excellent analogy, it's wildly disproportionate. Using a smiley doesn't fix it, and using it previously doesn't give you a free pass. What research was I supposed to have done? Examine your previous posts to see you overreacting before? That would hardly have convinced me that this was OK. --Ned. I suggest that you write to the BBC and get all episodes of the extremely popular *COMEDY* Dad's Army withdrawn as typical shabby Nazi trick was one of Captain Mainwearing's main lines. I see what you are getting at. You were referring to a TV show popular in your part of the world 30 years ago. As this is a world-wide group, you might understand that I didn't get the reference, and perhaps many others did not either. Humor is tricky, you need to know your audience. It was 45 years ago, at very much the same time that another very popular comedy was on, but its name escapes me right now. And if I want to overreact, I'll overreact, as I couldn't care two hoots whether I'm dealing with an arsehole from the Python Software Foundation or one who's not. I have no idea why you feel the need to insult me. As to the PSF, this is relevant: http://www.python.org/psf/codeofconduct. Members of the community are respectful. Could you please be? --Ned. Mark Lawrence You mean after I had to plonk you from my own email because you kept sending messages despite the fact that I'd asked you not to. So the references above only apply to me but not to you? You bloody two faced hypocrite, excuse me while I go off and barf. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
RE: Python Beginner
Pretty much anything you can think off. You can create games. Also, you can make python a front-end program attach to a back-end MySQL database as well make websites. Pretty much anything you can think off. You just have to think about layout what you are trying to accomplish. Is there anything you are trying to accomplish by coming into programming? -Original Message- From: ngangsia akumbo [mailto:ngang...@gmail.com] Sent: Wednesday, November 20, 2013 12:35 PM To: python-list@python.org Subject: Re: Python Beginner can someone really help to give me a more details answer please. what can i do with python? -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Beginner
Yes a lot, i come from a third world country. It will be a big opportunity for me and my community to study and being able to create programs, web apps etc which can solve a lot of problems in my country and around. Each day i go out i see at least one problem that technology can solve. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Beginner
On Wed, Nov 20, 2013 at 1:41 PM, Hector Chapa hch...@lrgvdc911.org wrote: Pretty much anything you can think off. You can create games. Also, you can make python a front-end program attach to a back-end MySQL database as well make websites. Pretty much anything you can think off. You just have to think about layout what you are trying to accomplish. Is there anything you are trying to accomplish by coming into programming? -Original Message- From: ngangsia akumbo [mailto:ngang...@gmail.com] Sent: Wednesday, November 20, 2013 12:35 PM To: python-list@python.org Subject: Re: Python Beginner can someone really help to give me a more details answer please. what can i do with python? -- https://mail.python.org/mailman/listinfo/python-list you can cook dinner with python... really.. this isn't a real question -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Beginner
On 20/11/2013 19:04, ngangsia akumbo wrote: Yes a lot, i come from a third world country. It will be a big opportunity for me and my community to study and being able to create programs, web apps etc which can solve a lot of problems in my country and around. Each day i go out i see at least one problem that technology can solve. Things to get you going? Browse for stuff in the Global Module Index http://docs.python.org/3/py-modindex.html to see if there's anything in the standard library that you can use to write code. Check out the package index https://pypi.python.org/pypi for anything that already solves a problem. Check out other code repositories such as sourceforge http://sourceforge.net/ or google http://code.google.com/hosting/ HTH and the best of luck with your endeavours :) -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Setting longer default decimal precision
On 13.Nov.20.Wed 14:02, Steven D'Aprano wrote: Hi Kay, You emailed me off-list, but your email address is bouncing or invalid, so I have no way to email you back. So THAT's where it went! Sorry about that...yes, it WAS meant for the group :/! [you wrote] Okay,but after I import math and decimal, py decimal.getcontext().prec=75 py print decimal.Decimal(math.atan(1)) 0.78539816339744827899949086713604629039764404296875 though I set precision to 75, it only did the trig function to 50 places AND it is only right to 16 places, 0.785398163397448309615660845819875721049292349843776... (actual). [end quote] Here, you calculate the atan of 1 using floating point maths, that is, to the precision of C doubles (about 17 decimal places). After the calculation is performed using float, you then convert it to a Decimal, but it is too late, you can't retroactively regain precision. In a perfect world, this would work: math.atan(Decimal(1)) but alas, all the functions in the math module convert their arguments to float first, so even though your Decimal(1) could perform calculations to 75 decimal places, the math.atan function downgrades it to a regular float. Then that is useless! :( You could try this third-party module: http://code.google.com/p/mpmath/ Ah, that looks like just the puppy I'm looking for. :) Okay then, I just installed the PortableApps version of Python, but when I downloaded mpmath-0.17.win32 the installer aborted with No Python installation found in the registry. So I'm trying to install setuptools 1.4 (and do it that way) at https://pypi.python.org/pypi/setuptools/1.4 but where is the Download link (Downloads just shifts down to the page section)? I'm just looking for the .zip file version (if one exists), not .tar.gz. Thx! -- Kill Hector dead, because Desi sent Milli. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Beginner
On Wednesday, November 20, 2013 8:21:44 PM UTC+1, Mark Lawrence wrote: On 20/11/2013 19:04, ngangsia akumbo wrote: Yes a lot, i come from a third world country. It will be a big opportunity for me and my community to study and being able to create programs, web apps etc which can solve a lot of problems in my country and around. Each day i go out i see at least one problem that technology can solve. Things to get you going? Browse for stuff in the Global Module Index http://docs.python.org/3/py-modindex.html to see if there's anything in the standard library that you can use to write code. Check out the package index https://pypi.python.org/pypi for anything that already solves a problem. Check out other code repositories such as sourceforge http://sourceforge.net/ or google http://code.google.com/hosting/ HTH and the best of luck with your endeavours :) -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence Thanks bro -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Wednesday, November 20, 2013 1:35:06 PM UTC-5, Mark Lawrence wrote: On 20/11/2013 18:18, Ned Batchelder wrote: On Wednesday, November 20, 2013 1:09:42 PM UTC-5, Mark Lawrence wrote: On 20/11/2013 17:51, Ned Batchelder wrote: On Wednesday, November 20, 2013 12:37:31 PM UTC-5, Mark Lawrence wrote: On 20/11/2013 17:12, Ned Batchelder wrote: On Wednesday, November 20, 2013 11:29:54 AM UTC-5, Mark Lawrence wrote: On 20/11/2013 15:34, Alister wrote: On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: On Thu, Nov 21, 2013 at 2:09 AM, Alister alister.w...@ntlworld.com wrote: must be a strange quirk of pan turned off hide to system tray allow multiple instances. Hmm. Hard to know, but I can imagine that having multiple instances MIGHT cause a problem. But if that's confirmed (maybe fire up three copies and then post to a test newsgroup??), I'd be reporting that as a bug in Pan. ChrisA As a quick test lets see how may times this one arrives Three. You're not Greek are you, and using a typical shabby Nazi trick to hide behind an ntlworld email address in order to spam us? :) Mark Lawrence Nazi? Perhaps we could stick to more appropriate analogies? --Ned. It's an excellent analogy that I've used before, hence the smiley. Clearly you don't do any research before bothering to say anything. Mark Lawrence You think these two things make an excellent analogy? 1) a newsgroup mishap being actively investigated, and 2) calculated genocide. It is not an excellent analogy, it's wildly disproportionate. Using a smiley doesn't fix it, and using it previously doesn't give you a free pass. What research was I supposed to have done? Examine your previous posts to see you overreacting before? That would hardly have convinced me that this was OK. --Ned. I suggest that you write to the BBC and get all episodes of the extremely popular *COMEDY* Dad's Army withdrawn as typical shabby Nazi trick was one of Captain Mainwearing's main lines. I see what you are getting at. You were referring to a TV show popular in your part of the world 30 years ago. As this is a world-wide group, you might understand that I didn't get the reference, and perhaps many others did not either. Humor is tricky, you need to know your audience. It was 45 years ago, at very much the same time that another very popular comedy was on, but its name escapes me right now. And if I want to overreact, I'll overreact, as I couldn't care two hoots whether I'm dealing with an arsehole from the Python Software Foundation or one who's not. I have no idea why you feel the need to insult me. As to the PSF, this is relevant: http://www.python.org/psf/codeofconduct. Members of the community are respectful. Could you please be? --Ned. Mark Lawrence You mean after I had to plonk you from my own email because you kept sending messages despite the fact that I'd asked you not to. So the references above only apply to me but not to you? You bloody two faced hypocrite, excuse me while I go off and barf. Mark Lawrence I apologize for sending you off-list emails. I'm still baffled why you find them so objectionable, but I won't do it any more. I often send emails to people when I want to communicate privately with them, I didn't mean any offense. Next time someone doesn't understand one of your jokes, perhaps you could simply explain the joke, rather than calling them an arsehole. Or I guess you were already angry with me, and others would have been treated better. My membership in the PSF seems to irritate you, but again, I don't know why. --Ned. -- https://mail.python.org/mailman/listinfo/python-list
Re: Setting longer default decimal precision
On 20/11/2013 19:34, Kay Y. Jheallee wrote: Ah, that looks like just the puppy I'm looking for. :) Okay then, I just installed the PortableApps version of Python, but when I downloaded mpmath-0.17.win32 the installer aborted with No Python installation found in the registry. So I'm trying to install setuptools 1.4 (and do it that way) at https://pypi.python.org/pypi/setuptools/1.4 but where is the Download link (Downloads just shifts down to the page section)? I'm just looking for the .zip file version (if one exists), not .tar.gz. Thx! Advice from a long time Python Windows user that's aimed at everybody, not just the OP. Always try and find a binary installer, it's far easier than messing about with .zip or .tar.gz files. In particular it avoids the infamous error: Unable to find vcvarsall.bat, which in plain English means you've not got Visual C++ installed or you've got the wrong version. A very good site to find binaries is this http://www.lfd.uci.edu/~gohlke/pythonlibs/. You can safely ignore the Unofficial at the top of the page, I've been using stuff from there for years and never, ever had a problem. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Setting longer default decimal precision
On 20/11/2013 19:59, Mark Lawrence wrote: On 20/11/2013 19:34, Kay Y. Jheallee wrote: Ah, that looks like just the puppy I'm looking for. :) Okay then, I just installed the PortableApps version of Python, but when I downloaded mpmath-0.17.win32 the installer aborted with No Python installation found in the registry. So I'm trying to install setuptools 1.4 (and do it that way) at https://pypi.python.org/pypi/setuptools/1.4 but where is the Download link (Downloads just shifts down to the page section)? I'm just looking for the .zip file version (if one exists), not .tar.gz. Thx! Advice from a long time Python Windows user that's aimed at everybody, not just the OP. Always try and find a binary installer, it's far easier than messing about with .zip or .tar.gz files. In particular it avoids the infamous error: Unable to find vcvarsall.bat, which in plain English means you've not got Visual C++ installed or you've got the wrong version. A very good site to find binaries is this http://www.lfd.uci.edu/~gohlke/pythonlibs/. You can safely ignore the Unofficial at the top of the page, I've been using stuff from there for years and never, ever had a problem. While Mark's advice here is fairly sound, the OP pointed out that they are using PortableApps Python (which I've never tried myself). The key point is that the binary installers expect to find a Python entry in the registry to show them where to go. For now I'm lazily going to point to the effbot's 10-year-old page on the subject: http://effbot.org/zone/python-register.htm with the proviso that, if that doesn't work, the OP should come back and we'll try to help some more. If it's any consolation, this business (bootstrapping installation on Windows) is improving, piece by piece. It's just not all there yet. TJG -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Beginner
On 20/11/2013 19:33, ngangsia akumbo wrote: On Wednesday, November 20, 2013 8:21:44 PM UTC+1, Mark Lawrence wrote: On 20/11/2013 19:04, ngangsia akumbo wrote: Yes a lot, i come from a third world country. It will be a big opportunity for me and my community to study and being able to create programs, web apps etc which can solve a lot of problems in my country and around. Each day i go out i see at least one problem that technology can solve. Things to get you going? Browse for stuff in the Global Module Index http://docs.python.org/3/py-modindex.html to see if there's anything in the standard library that you can use to write code. Check out the package index https://pypi.python.org/pypi for anything that already solves a problem. Check out other code repositories such as sourceforge http://sourceforge.net/ or google http://code.google.com/hosting/ HTH and the best of luck with your endeavours :) -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence Thanks bro I'll act as your big bro if you'd like to read and action this https://wiki.python.org/moin/GoogleGroupsPython, thanks :) A quick glance above will show you why, but then consider what happens if multiple responses are sent all adding unwanted newlines, it's a total mess. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: zip list, variables
Thank you for the replies. Looking at the replies I am wondering which solution is more scalable. At the moment it is only 2 nested lists but what about 5, 10, 20 or more? Should I start looking into numpy to handle this or will list comprehension [ [ x + y for x, y in zip(x,y) ] for x, y in zip(a,b) ] Be sufficient ? Thanks Sayth -- https://mail.python.org/mailman/listinfo/python-list
Re: Setting longer default decimal precision
On 20/11/2013 19:34, Kay Y. Jheallee wrote: Ah, that looks like just the puppy I'm looking for. :) Okay then, I just installed the PortableApps version of Python, but when I downloaded mpmath-0.17.win32 the installer aborted with No Python installation found in the registry. So I'm trying to install setuptools 1.4 (and do it that way) at https://pypi.python.org/pypi/setuptools/1.4 but where is the Download link (Downloads just shifts down to the page section)? I'm just looking for the .zip file version (if one exists), not .tar.gz. Yes, unfortunately you seem to have hit the sour spot of installation: Windows with a Portable Python. I note that the setuptools page has a .whl, which is the brand new Python binary installer. Although designed to be installed with tool support, it is in fact a .zip file which you should be able to unpack into c:\pythonxy\lib\site-packages. It might be worth a try. Please feel to come back for more help if needs be: you've hit an unfortunately bumpy patch in the Python experience and I'd prefer to smooth things out for you than have to turn away in disgust :) TJG -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie - Trying to Help a Friend
On Thu, Nov 21, 2013 at 5:18 AM, Ned Batchelder n...@nedbatchelder.com wrote: On Wednesday, November 20, 2013 1:09:42 PM UTC-5, Mark Lawrence wrote: I suggest that you write to the BBC and get all episodes of the extremely popular *COMEDY* Dad's Army withdrawn as typical shabby Nazi trick was one of Captain Mainwearing's main lines. I see what you are getting at. You were referring to a TV show popular in your part of the world 30 years ago. As this is a world-wide group, you might understand that I didn't get the reference, and perhaps many others did not either. Humor is tricky, you need to know your audience. The solution is really quite simple. The insertion of a single footnote will do it. Let it stand that every obscure reference is explained after your signature, and there you are, out of your difficulty at once! [1] ChrisA [1] See Gilbert Sullivan's Iolanthe, eg http://math.boisestate.edu/gas/iolanthe/web_op/iol23d.html -- https://mail.python.org/mailman/listinfo/python-list
Re: Several Topics - Nov. 19, 2013
El 19/11/13 23:43, glen herrmannsfeldt escribió: And, importantly, the code runs fairly slow. Some years ago, I was working with simple PERL programs that could process data at 1 megabyte per minute. Rewriting in C, I got one megabyte per second. It is not too unusual to run 10 times slower, but 60 was rediculous. -- glen Can you provide more information on the topic? Perl version, method to read/write, etc. Thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On 2013-11-20, Walter Hurry walterhu...@lavabit.com wrote: On Thu, 21 Nov 2013 03:33:02 +1100, Chris Angelico wrote: But the actual fake is Cerinabbin You might have included Woolloomooloo in the list! Anybody from the early days of TCP/IP networking on PC-DOS and Mac OS would also recognize Wollongong even if they couldn't tell you where it was. -- Grant Edwards grant.b.edwardsYow! I had pancake makeup at for brunch! gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: run command line on Windows without showing DOS console window
Tim Golden wrote: On 20/11/2013 14:44, iMath wrote: is there anyway to run command line on Windows without showing DOS console window ? can you use the following command line to give a little example ? wget -r -np -nd http://example.com/packages/ the path to wget is C:\Program Files\GnuWin32\bin\wget.exe subprocess.call([wget, -r, -np, -nd, http://example.com;]) Complement: use .pyw extension for your main Python module (avoid Python opening a console). A+ -- Laurent POINTAL - laurent.poin...@laposte.net -- https://mail.python.org/mailman/listinfo/python-list
ANN: stepford 0.1 release
Hi all, If you never have to deal with Facebook integration tests, feel free to stop reading here. Otherwise, hopefully this proves to be of some use to you: https://github.com/Demonware/stepford Integration testing is generally a pain. Stepford attempts to alleviate as much of that pain as possible for apps requiring integration with the Facebook Graph API. Stepford is a Python implementation of the Facebook test user API as defined at https://developers.facebook.com/docs/test_users. Documentation can be found at: http://pythonhosted.org/stepford/ -- Demian Brecht http://demianbrecht.github.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Re: HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3)
On 11/20/2013 02:05 AM, Chris Angelico wrote: On Wed, Nov 20, 2013 at 1:14 PM, Logan lo...@s1network.com wrote: Chris, That is genius. Thank you! Then it works? Awesome!! (Permit me an evil laugh. Muahahah!) This is why I love working with open source languages. Even if you don't end up actually changing anything, you can go and snoop the code and see what happens - sometimes you can tweak your code based on that knowledge. And hey. This is duck typing at its best! ChrisA Not exactly as written, but close enough to get me working. At one point the following code is executed, turning the value into a string to be titled next time it is called: name = name.title() So, I worked around it with the following class, adapted from yours: class CaseSensitiveHeader(object): def __init__(self, name): self.name = name def capitalize(self): return self def title(self): return self def lower(self): return self.name def encode(self, encoding): return self.name.encode(encoding) With that, I am now able to post a case sensitive HTTP header. -- Logan -- https://mail.python.org/mailman/listinfo/python-list
Re: parsing RSS XML feed for item value
Thank you folks, now I know what I don't know and have a solution. -- https://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] PEP 0404 and VS 2010
On 20/11/2013 23:36, Christian Tismer wrote: Hey Barry, On 20.11.13 23:30, Barry Warsaw wrote: On Nov 20, 2013, at 09:52 PM, Christian Tismer wrote: Many customers are forced to stick with Python 2.X because of other products, but they require a Python 2.X version which can be compiled using Visual Studio 2010 or better. This is considered an improvement and not a bug fix, where I disagree. I'm not so sure about that. Python 2.7 can still get patches to help extend its useful life by allowing it to be built with newer compiler suites. I believe this has already been done for various Linux compilers. I see no non-technical reason why Python 2.7 can't be taught how to build with VS 2010 or newer. Details are subject to RM approval, IMHO. I have created a very clean Python 2.7.6+ based CPython with the Stackless additions, that compiles with VS 2010, using the adapted project structure of Python 3.3.X, and I want to publish that on the Stackless website as the official Stackless Python 2.8. If you consider Stackless as official ;-) . This compiler change is currently the only deviation from CPython 2.7, but we may support a few easy back-ports on customer demand. We don'd add any random stuff, of course. I think you're just going to confuse everyone if you call it Stackless Python 2.8 and it will do more harm than good. Barry, that's a good thing! This way I have a chance to get my build in at all. And that's the question, after re-thinking: Where can I check my change in, if it is going to be accepted as a valid 2.7 bug fix (concerning VS 2008 as a bug, that is is)? I was intending to do this since a year but was stopped by MVL's influence. Maybe this needs to be re-thought, since I think different. What I do not know: Should I simply check this in to a python 2.7.x-VS2010 branch? Or what do you suggest, then? In any case, my question still stands, and I will do something with the Stackless branch by end of November. Please influence me ASAP, I don't intend to do any harm, but that problem is caused simply by my existence, and I want to stick with that for another few decades. If I think something must be done, then I have my way to do it. If you have good reasons to prevent this, then you should speak up in the next 10 days, or it will happen. Is that ok with you? Hugs -- your friend Chris You could call it Spython instead! -- https://mail.python.org/mailman/listinfo/python-list
Off-topic: Pop culture references [was Re: Newbie - Trying to Help a Friend]
On Wed, 20 Nov 2013 18:09:42 +, Mark Lawrence defended his reference to Nazism: It's an excellent analogy that I've used before, hence the smiley. Clearly you don't do any research before bothering to say anything. I for one *have* done extensive research on the Nazis, not to a professional academic standard, but certainly to the point where I like to flatter myself that I know a thing or two about them, their political philosophy, and their actions. I must say that your analogy multiple postings to a newsgroup implies Nazi perplexes me too. [...] I suggest that you write to the BBC and get all episodes of the extremely popular *COMEDY* Dad's Army withdrawn as typical shabby Nazi trick was one of Captain Mainwearing's main lines. I fully support the right of everyone to make cryptic references to movies, television shows, science fiction and fantasy novels, internet memes, and assorted pop culture references. Offler knows I've done it myself. But, if the reference falls flat, or worse is misunderstood, and sometimes they will, can I suggest there are two appropriate responses? 1) Sheepish apology for making a reference too obscure, e.g.: Oh, sorry, I was quoting Captain Mainwearing's catchphrase from Dad's Army, it isn't intended to imply that Alister is an actual goose-stepping fascist who believes a lot of racial pseudo-scientific rubbish. 2) Incredulity that anyone might have missed the reference, e.g.: What? How can anyone not recognise that reference? Everyone I know in the UK over the age of 60 loves the show Dad's Army! This is one of the funniest lines from it! Oh how me dear ol' mum used to laugh every time Captain Mainwearing said it! (Listen very carefully, I shall say this only once. I'm more of a 'Ello 'Ello person myself.) And if I want to overreact, I'll overreact, as I couldn't care two hoots whether I'm dealing with an arsehole from the Python Software Foundation or one who's not. This, however, is very rarely an appropriate response for anyone over the age of two. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic: Pop culture references [was Re: Newbie - Trying to Help a Friend]
On 21/11/2013 00:27, Steven D'Aprano wrote: On Wed, 20 Nov 2013 18:09:42 +, Mark Lawrence defended his reference to Nazism: It's an excellent analogy that I've used before, hence the smiley. Clearly you don't do any research before bothering to say anything. I for one *have* done extensive research on the Nazis, not to a professional academic standard, but certainly to the point where I like to flatter myself that I know a thing or two about them, their political philosophy, and their actions. I must say that your analogy multiple postings to a newsgroup implies Nazi perplexes me too. [snip] The Nazis were known for many bad things, but multiple postings wasn't one of them. (Nor spam, now I think about it...) -- https://mail.python.org/mailman/listinfo/python-list
Re: Re: HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3)
On Thu, Nov 21, 2013 at 10:26 AM, Logan lo...@s1network.com wrote: Not exactly as written, but close enough to get me working. Excellent. Sometimes it's fun to be just that evil. :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Off-topic: Aussie place names [was Re: Automation]
On Wed, 20 Nov 2013 17:58:27 -0500, Dennis Lee Bieber wrote: On Tue, 19 Nov 2013 21:48:10 +1100, Chris Angelico ros...@gmail.com declaimed the following: Anyway, we Aussies know more about your geography than you know about ours, I reckon. Which of these is not a real place: Parramatta, Warrnambool, Cerinabbin, Mordialloc? No fair Googling them, see if you can call it. I've been to three of the above places, the other one came up in a fantasy name generator. Parramatta reads like a accented parameter Cerinabbin and Mordialloc sound like names from the Welsh influenced Arthurian mythos: cf: Ceredwyn, Mordred (or a new word for a core dump caused by memory faults: morte-alloc, death in allocation) Cerinabbin is the fake name, although there is a suburb Morrabbin in Melbourne (and Darebin as well, which is pronounced Darra Bin not Dare Bin). Many placenames in Australia are borrowed from the UK, or named after British Royalty or explorers. Melbourne itself was, for a short time, named Batmania, after the explorer John Batman. Others are based on native Australian Aboriginal words or placenames, such as Wagga Wagga, Woolloomoloo (a real place with an imaginary university, notable for the famous Monty Python Philosopher's Sketch), Coolangatta, Kalgoorlie, Moe (pronounced Mo-e, not Mow), Koo Wee Rup, Didjabringabeeralong, and our capital city, Canberra. Actually, Didjabringabeeralong is a town in the land of Fourecks (or for those who can't spell), invented by Terry Pratchett for the novel The Lost Continent. But the others are real. For a serious look at Australian placenames named after Australian Aboriginal words, see wikipedia: http://en.wikipedia.org/wiki/List_of_Australian_place_names_of_Aboriginal_origin -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: zip list, variables
On Wed, 20 Nov 2013 12:05:38 -0800, flebber wrote: Thank you for the replies. Looking at the replies I am wondering which solution is more scalable. At the moment it is only 2 nested lists but what about 5, 10, 20 or more? Should I start looking into numpy to handle this or will list comprehension [ [ x + y for x, y in zip(x,y) ] for x, y in zip(a,b) ] Be sufficient ? Be sufficient for what? You've deleted all context from your post, so I have no clue what you're talking about. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic: Aussie place names [was Re: Automation]
On 21 November 2013 11:58, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: For a serious look at Australian placenames named after Australian Aboriginal words, see wikipedia: http://en.wikipedia.org/wiki/List_of_Australian_place_names_of_Aboriginal_origin Just noticed that my town was missing - added it: https://en.wikipedia.org/wiki/Mittagong,_New_South_Wales Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list
how to deal with deprecating API functionality in python module?
Hi, I'm pretty new to python, I'm trying to figure out how a python module is supposed to make non-backwards-compatible changes without blowing up the applications that use it. In the C world this is straightforward, an application is linked against version X of the library, and if the library developers make a non-compatible change (remove a deprecated function, or change a function signature) they bump the version to X+1. Then versions X and X+1 can both be installed on the system at the same time and applications will link against whichever one they were compiled against. How would something like this work in a python application? I don't see any way to do the equivalent of import foo version X Is the only way to incorporate the version in the name? Like: import fooX Any guidance would be appreciated... Thanks, Chris -- https://mail.python.org/mailman/listinfo/python-list
Re: Total Python Newbie needs geting started info.
On 11/20/2013 10:03 AM, Ev J wrote: I am learning Python and wish to develop GUI applications to run on Windows. I have installed the Visual Studio integrated shell (Ver. 12.0.21005.1 REL) IDE and the Python 3.3 interpreter. I have gone through some of the 3.3 tutorial available at http://docs.python.org/3.3/tutorial/. The tutorial is all about using the interactive interrupter and writing little console programs to learn the language. Before I go too far down this road, I need to know if I can/should use this environment to develop GUI applications. Is there graphical support for this - for example I can I just insert/move/set properties of buttons, combo boxes, etc. using an interface like the one in VBA? If not, what is the best free IDE for me to use? What is the best tutorial for the IDE? I am a bit overwhelmed as to how to get started. Thanks for any help. +1 for GTK. It takes a minute to get used to coming from a VB background (VB spoils people with its easy GUI builder). You write your own signal handlers with GTK (and other GUI libs also), instead of having it 'auto-created' along with the button when its dropped. You also learn a lot more. Qt and Wx look good, I just don't have any experience with them. Glade for GTK is a very good GUI builder, but again, coming from VB it's not what you think. It only generates a glade file (XML-like file containing the layout for the GUI), but it's up to you to fill in the actual code. The process is something like this: Build a gui with glade and save it. Load .glade file in your python code. (builder.add_from_file(myfile)) (where builder is a Gtk.Builder()) Grab objects from it. (self.button1 = builder.get_object('Button1')) (where Button1 is the name of a GtkButton in the glade file.) Write signal handlers. (def button1_clicked_cb(self, btn):) (signal names can be defined in glade) Connect signals (builder.connect_signals(self)) (where self is a class containing the signal handlers) I'm no expert at it, but I really like using it. There are different approaches and styles for using Gtk, so don't think my 'process' is set in stone. Someone else here may have a different view. The great thing about Gtk is the amount of control you have over everything. Large projects may require a different style than small ones. -- - Christopher Welborn cjwelb...@live.com http://welbornprod.com -- https://mail.python.org/mailman/listinfo/python-list
Re: how to deal with deprecating API functionality in python module?
Chris Friesen chris.frie...@windriver.com writes: I'm pretty new to python, I'm trying to figure out how a python module is supposed to make non-backwards-compatible changes without blowing up the applications that use it. The short answer is that Python doesn't have a library linker, so we do it through co-operative APIs and bundled third-party libraries, rather than versioned linking to shared libraries. How would something like this work in a python application? I don't see any way to do the equivalent of import foo version X You can have the library expose a ‘foo.version’ attribute (or, sometimes, a ‘foo.__version__’ attribute) and have the library user check for that. Ideally, make its value a tuple of integers (as Python does for its run-time version) so the library user can choose the level of precision it will match. Sadly, there's no way to have multiple versions of a library with the same name installed and available to the same application. You'll probably receive advice to install all your application's dependencies together in a so-called “virtualenv” with the application. This is dreadful practice – it ignores the OS package managed libraries, it requires every deployment to manage dependencies separately, it promotes needless duplication and potentially divergent code, it makes security updates a nightmare, etc. – but it appears to be the best Python has for this, given the lack of a versioned linking feature. -- \ “The trouble with the world is that the stupid are cocksure and | `\ the intelligent are full of doubt.” —Bertrand Russell | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: how to deal with deprecating API functionality in python module?
On Thu, Nov 21, 2013 at 11:02 AM, Chris Friesen chris.frie...@windriver.com wrote: I'm pretty new to python, I'm trying to figure out how a python module is supposed to make non-backwards-compatible changes without blowing up the applications that use it. First and foremost, the best way to break backward compatibility is to not do so! Which means: 1) Keep deprecated APIs around for as long as you can, even if they're implemented messily on top of your current API. 2) Design your API with future-proofing in mind. 3) Batch up all the compatibility-breaks into one big change. Then, since #3 will be such a rare operation, you can just put it into the file name. There's an sqlite3 package which works with, well, SQLite v3, I guess, and it's not compatible with version 2 which (I think) was called just sqlite. Ideally, you should be able to do this seldom enough that your users won't have more than two current versions to deal with at any given time (unless they're supporting both RHEL and Ubuntu, in which case their tolerance for pain is to be admired!). You might be able to do some weird package magic so your users type: import foo.v1 # Get the old API import foo.v2 # Get the new API - will throw if you do both But I'm not sure how you'd go about doing this cleanly, given that it'd need to change which symbols get imported as foo.bar etc. At best, you could certainly do: import foo1 as foo # Get the old API import foo2 as foo # Get the new API which is pretty much how a lot of Py2/Py3 compatibility code works. But again, you want to do this as rarely as possible. Of course, backward-compatible API changes (new APIs and such) can easily be signalled with a version tuple, as Ben mentioned. Two apps can demand different minimums and be satisfied by the same current version. That's the easy bit! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Recursive generator for combinations of a multiset?
Short story: the subject says it all, so if you have an answer already, fire away. Below is the long story of what I'm using it for, and why I think it needs to be recursive. It may even be of more general interest in terms of filtering the results of generators. I'm playing with an anagram-generating module which works like this: 1) Generate the integer partitions of the length of the input string. 2) For each partition, replace its elements with a list of all dictionary words which are a) the same length as the partition element and b) a sub-multiset of the input string. eg: cat in hat - ... , [3,5], ... - [[act, ant, ...], [antic, attic, ...]] 3) Pass each resulting list of wordlists to itertools.product, filtering the output of anything which is not the same multiset of characters as the input string. This works but gets very slow for long strings. It spends most of its time at the filtering stage because most of the results have too many of some characters (and therefore not enough of others). I do some optimising of the lists prior to running product, but this only shaves off smallish percentages. I got a big speedup (factor of five for medium-length inputs, much more for longer strings) by replacing itertools.product with this recursive generator: def cartesian_product(args, input_str): if not args: yield (), input_str return for words, check_str in cartesian_product(args[:-1], input_str): for word in args[-1]: #this bit prevents bothering with anything useless new_str = check_str for letter in word: if letter in new_str: new_str = new_str.replace(letter, '', 1) else: break else: yield words + (word,), new_str Despite being inherently much slower than itertools.product, it can prune branches of the recursion as soon as it accumulates too many of any character. This means it's much faster and produces correct results without further filtering. But there is another problem. The initial partitions contain repeated elements, so the corresponding wordlists are also repeated. This means that any cartesian product will contain many redundant results - the same words in a different order. For a medium-sized string, this is most of them. A solution for repeated sections of a partition of wordlists is to use r-combinations (where r is the number of repeats). In this scenario, though, some words may be usable more than once, and the right number of copies of these words must be added to the list to allow this. This means I need the combinations of a multiset (so I can't use itertools.combinations). I found a verbal description of such an algorithm and came up with this: def multicombs(it, r): result = it[:r] yield result while 1: for i in range(-1, -r - 1, -1): rep = result[i] if rep it[i]: break else: break for j, n in enumerate(it): if n rep: break result = result[:i] + it[j:j - i] yield result I added a call to this generator in a branch to the main generator above to deal with repeated elements. This eliminates redundant results, but with a substantial slowdown. The program now spends most of its time inside multicombs. I'm hoping that if I could find a recursive multiset combination generator, I could speed it up using the same pruning approach. Any suggestions? -- John -- https://mail.python.org/mailman/listinfo/python-list
Re: Setting longer default decimal precision
On 11/20/2013 11:34 AM, Kay Y. Jheallee wrote: On 13.Nov.20.Wed 14:02, Steven D'Aprano wrote: Hi Kay, You emailed me off-list, but your email address is bouncing or invalid, so I have no way to email you back. So THAT's where it went! Sorry about that...yes, it WAS meant for the group :/! I don't know if this applies to you or not but... I'm using Thunderbird with the News Group (not the News List) and it has two buttons, Reply and Followup. Reply sends e-mail, Followup sends to the group. Very easy to use the wrong one (and I have).:-( -=- Larry -=- -- https://mail.python.org/mailman/listinfo/python-list
[issue19661] Python: RuntimeError: invalid slot offset when importing a module
New submission from dellair jie: Dear all, I am getting above error when trying to import ssl module. In fact, the error showed up during the build and _ssl module was added to the failed module list. However, the compilation and link went well. There was no error on compilation and link phases, only some warnings. However, during Python build, there is an import phase right after the link, which shows the same error as stated. building '_ssl' extension xlc_r -DNDEBUG -O -IInclude -I. -I/usr/local/include -c /aix/Modules/_ssl.c -o build/temp.aix-6.1-3.3/aix/Modules/_ssl.o /aix/Modules/_ssl.c, line 262.17: 1506-196 (W) Initialization between types void* and struct _object*(*)(struct {...}*) is not allowed. /aix/Modules/ld_so_aix xlc_r -bI:/aix/Modules/python.exp build/temp.aix-6.1-3.3/aix/Modules/_ssl.o -L/usr/local/lib -lssl -lcrypto -o build/lib.aix-6.1-3.3/_ssl.so ld: 0711-224 WARNING: Duplicate symbol: .bcopy ld: 0711-224 WARNING: Duplicate symbol: .memcpy ld: 0711-224 WARNING: Duplicate symbol: .memmove ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. *** WARNING: importing extension _ssl failed with build/lib.aix-6.1-3.3/_ssl.so: class 'RuntimeError': invalid slot offset: traceback object at 0x3017e9e0 I went through google to search for similar issue/solution however no succeeds. Hence I suppose it is a bug. Env: Python: 3.3.2 OpenSSL: 0.9.8y (also tried 0.9.7) OS: AIX 6.1 (also tried on HPUX_1131_IA, same problem) -- components: Build messages: 203465 nosy: dellair.jie priority: normal severity: normal status: open title: Python: RuntimeError: invalid slot offset when importing a module type: compile error versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19661 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19183] PEP 456 Secure and interchangeable hash algorithm
Roundup Robot added the comment: New changeset adb471b9cba1 by Christian Heimes in branch 'default': ssue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'. http://hg.python.org/cpython/rev/adb471b9cba1 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19183 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19662] smtpd.py should not decode utf-8
New submission from Leslie P. Polzer: http://hg.python.org/cpython/file/3.3/Lib/smtpd.py#l289 as of now decodes incoming bytes as UTF-8. An SMTP server must not attempt to interpret characters beyond ASCII, however. Originally mail servers were not 8-bit clean, meaning they would only guarantee the lower 7 bits of each octet to be preserved. However even then they were not expected to choke on any input because of attempts to decode it into a specific extended charset. Whenever a mail server does not need to interpret data (like base64-encoded auth information) it is simply left alone and passed through. I am not aware of the reasons that caused the current state, but to correct this behavior and make it possible to support the 8BITMIME feature I suggest decoding received bytes as latin1, leaving it to the user to reinterpret it as UTF-8 or whatever charset they need. Any other simple extended encoding could be used for this, but latin1 is the default in asynchat. The documentation should also mention charset handling. I'll be happy to submit a patch for both code and docs. -- components: Library (Lib) messages: 203467 nosy: skypher priority: normal severity: normal status: open title: smtpd.py should not decode utf-8 type: enhancement versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19662 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19662] smtpd.py should not decode utf-8
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19662 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12816] smtpd uses library outside of the standard libraries
Changes by Leslie P. Polzer pol...@port-zero.com: -- nosy: +lpolzer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12816 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16462] smtpd should return greeting
Changes by Leslie P. Polzer pol...@port-zero.com: -- nosy: +lpolzer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16462 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8503] smtpd SMTPServer does not allow domain filtering
Changes by Leslie P. Polzer pol...@port-zero.com: -- nosy: +lpolzer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8503 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3802] smtpd.py __getaddr insufficient handling
Changes by Leslie P. Polzer pol...@port-zero.com: -- nosy: +lpolzer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3802 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com