Re: Python handles globals badly.

2015-09-04 Thread Ian Kelly
On Fri, Sep 4, 2015 at 1:48 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Fri, Sep 4, 2015 at 1:11 PM, <t...@freenet.de> wrote: >> 6- "include" script statement (extending namespace to another script, like >> PHP) > > def include(filename

Re: Python handles globals badly.

2015-09-03 Thread Ian Kelly
On Thu, Sep 3, 2015 at 7:22 AM, wrote: > I think this has lead to some confusing. I don't think so. > First topic: > "sharing globals between modules" > Where globals is meant as vars used throughout the app. > > This is the topic why Skybuck starts the thread. > And yes I

Re: Python handles globals badly.

2015-09-03 Thread Ian Kelly
On Thu, Sep 3, 2015 at 1:47 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Thu, Sep 3, 2015 at 1:05 PM, <t...@freenet.de> wrote: > >> But then I ask you from high-level point of view >> (if my high level view is correct at all): >> Would you remove thi

Re: Python handles globals badly.

2015-09-03 Thread Ian Kelly
On Thu, Sep 3, 2015 at 1:05 PM, wrote: > If this would be under the developer responsibility than this > is simply achieved by giving well-written var names. So, adopt a rule whereby you prefix all your global variable names with "global" or "g_"? How is this superior

Re: Python handles globals badly.

2015-09-03 Thread Ian Kelly
On Thu, Sep 3, 2015 at 4:13 PM, Mark Lawrence <breamore...@yahoo.co.uk> wrote: > On 03/09/2015 20:47, Ian Kelly wrote: >> >> On Thu, Sep 3, 2015 at 1:05 PM, <t...@freenet.de> wrote: >>> >>> Or does anyone really name a global var xxx and a funct

Re: Python handles globals badly.

2015-09-02 Thread Ian Kelly
On Wed, Sep 2, 2015 at 12:47 PM, wrote: > Using the keyword global inside each(!) function only > to mark the global var writeable in each of the functions > is really an over-regulation and very annoying from my point of view. To me, marking a variable as global in a large

Re: packing unpacking depends on order.

2015-09-02 Thread Ian Kelly
On Sep 2, 2015 7:51 PM, "Steven D'Aprano" wrote: > > What's the alternative? I asked this question earlier, and got no answer -- > apparently at least three people prefer behaviour that they cannot explain > how to get the results they want :-) > > As far as I am concerned,

Re: packing unpacking depends on order.

2015-09-02 Thread Ian Kelly
On Wed, Sep 2, 2015 at 11:42 AM, Terry Reedy wrote: > On 9/2/2015 6:01 AM, Antoon Pardon wrote: >> >> > a = [1, 2, 3, 4, 5] > b = 1 > b, a[b] = a[b], b > a >> >> [1, 2, 1, 4, 5] > > a = [1, 2, 3, 4, 5] > b = 1 > a[b], b = b, a[b] > a >> >> [1,

Re: Python handles globals badly.

2015-09-02 Thread Ian Kelly
On Wed, Sep 2, 2015 at 4:25 PM, wrote: > That said, it is not an overusing of globals cause globals are module vars > only. > Or have you never written singletons or other classes in e.g Java, C++ with > lots of static and class members and methods using this members. I do use

Re: Location of an Error Message

2015-09-02 Thread Ian Kelly
On Wed, Sep 2, 2015 at 1:30 PM, wrote: > Where are the error messages stored? E. g., in which (source code) file is > the message "NameError: name 'sdfe' is not defined" stored (except for > variable arguments like "sdfe")? I do know that I can throw exceptions for >

Re: Why Python is not both an interpreter and a compiler?

2015-09-01 Thread Ian Kelly
On Mon, Aug 31, 2015 at 11:45 PM, Luca Menegotto wrote: > Il 31/08/2015 19:48, Mahan Marwat ha scritto: > >> If it hasn't been considered all that useful, then why > >> the tools like cx_freeze, pytoexe are doing very hard! > > Well, I consider those tools useless at

Re: Hi am new to python

2015-08-31 Thread Ian Kelly
On Mon, Aug 31, 2015 at 5:27 PM, Chubasco Diranga wrote: > Can anyone please help me with the following please? > > My question is in a while loop; how do l sum all the numbers in the given > list (list_a)? > > list_a = [8, 5, 2, 4] > sum_a = 0 # for storing the sum of

Re: Python used in malware

2015-08-27 Thread Ian Kelly
On Thu, Aug 27, 2015 at 8:34 AM, Steven D'Aprano st...@pearwood.info wrote: It's old news, but I found this interesting: some malware installs Python for ease of scripting bots: http://www.theregister.co.uk/2014/11/06/hackers_use_gmail_drafts_as_dead_drops_to_control_malware_bots/ See also

Re: Please don't make unfounded legalistic demands

2015-08-27 Thread Ian Kelly
On Thu, Aug 27, 2015 at 8:14 AM, Grant Edwards invalid@invalid.invalid wrote: And the NNTP clients and protocol were designed from the ground up to handle largish volumes of messages grouped into lists and threads. Trying to coax that functionality out of e-mail by using list-servers and

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Ian Kelly
On Wed, Aug 26, 2015 at 12:11 PM, Andy Kubiak andy.kub...@gmail.com wrote: What if you could send all your mail to another address on a server you control, or can at least run programs on? That seems like a lot more hassle than it would be worth. --

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Ian Kelly
On Tue, Aug 25, 2015 at 9:32 AM, Skip Montanaro skip.montan...@gmail.com wrote: On Tue, Aug 25, 2015 at 10:24 AM, Jussi Piitulainen harvested.address@is.invalid wrote: When I try it today, round brackets also work, both in 2.6.6 and 3.4.0 - no idea what version it was where they failed or

Re: why does id(multiprocessing.Process.start) == id(multiprocessing.Process.start)?

2015-08-17 Thread Ian Kelly
On Mon, Aug 17, 2015 at 4:57 PM, Chris Kaynor ckay...@zindagigames.com wrote: The rules for the id is that they are only guaranteed unique during the lifespan of both objects. Also, generally, you do not want to use id or is for much of anything unless you really know what you are doing -

Re: How to model government organization hierarchies so that the list can expand and compress

2015-08-13 Thread Ian Kelly
On Thu, Aug 13, 2015 at 1:10 PM, Alex Glaros alexgla...@gmail.com wrote: It's like the desktop folder/directory model where you can create unlimited folders and put folders within other folders. Instead of folders, I want to use government organizations. Example: Let user create agency

Re: Hooking Mechanism when Entering and Leaving a Try Block

2015-08-12 Thread Ian Kelly
On Tue, Aug 11, 2015 at 3:47 PM, Sven R. Kunze srku...@mail.de wrote: is there something like a hook that a Python module could register to in order to 'trace' the entering and leaving of arbitrary try blocks? Not that I'm aware of. However, it sounds like context managers might do what you

Re: pyjs - a compiler from Python to JavaScript

2015-08-10 Thread Ian Kelly
On Fri, Aug 7, 2015 at 5:00 AM, Uri Even-Chen u...@speedy.net wrote: Are you familiar with pyjs? I saw the website and I see that the latest stable release is from May 2012. Is it possible to use pyjs to compile Python to JavaScript? Which versions of Python are supported? Are versions 2.7

Re: Pipes

2015-08-09 Thread Ian Kelly
On Sun, Aug 9, 2015 at 11:39 AM, rogerh...@gmail.com wrote: Where can I find out about this? It's not mentioned in my Introduction to Python book. The Python documentation at docs.python.org are an important resource, and in particular the subprocess module is covered at

Re: Pipes

2015-08-09 Thread Ian Kelly
On Sun, Aug 9, 2015 at 8:10 AM, rogerh...@gmail.com wrote: Just learning Python and have a question. Is it possible for Python to pass information to another program (in Windows), wait for that program to finish and then resume operating? It's called a pipe in Unix systems. Yes, pipes can

Re: except block isn't catching exception

2015-08-08 Thread Ian Kelly
On Fri, Aug 7, 2015 at 8:44 PM, Chris Angelico ros...@gmail.com wrote: The exception isn't happening inside sock.accept(), as I explained. So you can't catch it there. Where does the exception happen then? Your explanation only covered why the blocking call cannot be interrupted by it, not why

Re: Python 3 May Become Relevant Now

2015-08-03 Thread Ian Kelly
On Mon, Aug 3, 2015 at 1:58 AM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: But if I get things right, with python 3.5 type hint checker, I'd be screwed, as it is spefificaly designed to track this kind of problem. What's the use of None then ? Any method returning None can only return

Re: Gmail eats Python

2015-07-29 Thread Ian Kelly
On Wed, Jul 29, 2015 at 6:42 AM, random...@fastmail.us wrote: On Sun, Jul 26, 2015, at 02:43, Ian Kelly wrote: What Internet standard is being violated by reflowing text content in the message body? Well, implicitly, text is only supposed to be reflowed when format=flowed is in use

Re: Send data to asyncio coroutine

2015-07-28 Thread Ian Kelly
On Tue, Jul 28, 2015 at 2:41 PM, Javier jcarm...@gmail.com wrote: I think that force the developer to 'yield from' all function calls to keep async capabilities is a big mistake, it should be more flexible, like this: import asyncio @asyncio.coroutine fun non_blocking_io(): Everybody

Re: Another tail recursion example

2015-07-28 Thread Ian Kelly
On Jul 28, 2015 1:36 PM, Paul Rubin no.email@nospam.invalid wrote: Paul Rubin no.email@nospam.invalid writes: Chris Angelico was asking for examples of tail recursion that didn't have obvious looping equivalents. Here's an Euler problem solution using memoization and (except that Python

Re: Send data to asyncio coroutine

2015-07-28 Thread Ian Kelly
On Tue, Jul 28, 2015 at 1:17 PM, Javier jcarm...@gmail.com wrote: Hello again. I have been investigating a bit your example. I don't understand why I can't write something like this: import asyncio def foo(): print(start foo) try: while True: val =

Re: Gmail eats Python

2015-07-26 Thread Ian Kelly
On Jul 25, 2015 4:51 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Laura Creighton l...@openend.se writes: So it was my fault by sending him a reply with to the far left. No, it was Google Mail's failt for messing with the content of the message. Never forget that these services are

Re: Gmail eats Python

2015-07-26 Thread Ian Kelly
On Sun, Jul 26, 2015 at 12:20 AM, Cameron Simpson c...@zip.com.au wrote: On 25Jul2015 22:43, Ian Kelly ian.g.ke...@gmail.com wrote: On Jul 25, 2015 4:51 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Laura Creighton l...@openend.se writes: So it was my fault by sending him a reply

Re: Gmail eats Python

2015-07-26 Thread Ian Kelly
On Jul 25, 2015 8:36 AM, Laura Creighton l...@openend.se wrote: Ow! Gmail is understanding the I stuck in as 'this is from the python console as a quoting marker and thinks it can reflow that. You didn't use in the email that I saw. That's actually three levels of quoting: one added in your

Re: OT Re: Math-embarrassment results in CS [was: Should non-security 2.7 bugs be fixed?]

2015-07-23 Thread Ian Kelly
On Jul 22, 2015 9:46 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thursday 23 July 2015 04:09, Rustom Mody wrote: tl;dr To me (as unprofessional a musician as mathematician) I find it arbitrary that Newton *discovered* gravity whereas Beethoven *composed* the 9th

Re: Send data to asyncio coroutine

2015-07-21 Thread Ian Kelly
On Tue, Jul 21, 2015 at 5:31 AM, jcarm...@gmail.com wrote: Hello, I'm trying to understand and link asyncio with ordinary coroutines. Now I just want to understand how to do this on asyncio: def foo(): data = yield 8 print(data) yield bye def bar(): f = foo() n =

Re: how to play

2015-07-20 Thread Ian Kelly
On Mon, Jul 20, 2015 at 10:29 AM, Aron Barsam aronbar...@gmail.com wrote: what is an 0S comand line? What OS are you using? In Windows it's a program called Command Prompt. In Mac OS X it's an application called Terminal. In Linux it's usually called something like Terminal or xterm. However,

Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread Ian Kelly
On Sun, Jul 19, 2015 at 3:27 AM, Laura Creighton l...@openend.se wrote: In this corner of the world, the favourite language for developing in is C (because we work close to hardware) and one of the things we like about it, a whole lot, is that the language never changes out from under you. So

Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread Ian Kelly
On Sun, Jul 19, 2015 at 10:10 AM, Cecil Westerhof ce...@decebal.nl wrote: On Sunday 19 Jul 2015 15:42 CEST, Mark Lawrence wrote: On 19/07/2015 03:13, Terry Reedy wrote: On 7/18/2015 7:50 PM, Devin Jeanpierre wrote: to 2.7, surely bug fixes are also allowed? Of course, allowed. But should

Re: how to play

2015-07-19 Thread Ian Kelly
On Sun, Jul 19, 2015 at 1:01 PM, Aron Barsam aronbar...@gmail.com wrote: i have trouble trying to play python please can you respond soon Play is an odd choice of verb. Are you under the impression that Python is a game? Anyway, here's how to use Python: 1. Download Python from python.org. 2.

Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread Ian Kelly
On Sun, Jul 19, 2015 at 9:12 PM, Steven D'Aprano st...@pearwood.info wrote: On Mon, 20 Jul 2015 11:35 am, Rick Johnson wrote: I figured that was you *MARK LAWRENCE*. I shall add sock-puppeting to your many egregious offenses! And poorly executed sock-puppeting as well! You're a zero. Rick,

Re: Integers with leading zeroes

2015-07-18 Thread Ian Kelly
On Sat, Jul 18, 2015 at 11:39 PM, Steven D'Aprano st...@pearwood.info wrote: In Python 2, integer literals with leading zeroes are treated as octal, so 09 is a syntax error and 010 is 8. This is confusing to those not raised on C-style octal literals, so in Python 3 leading zeroes are

Re: A new module for performing tail-call elimination

2015-07-16 Thread Ian Kelly
On Thu, Jul 16, 2015 at 3:28 AM, Robin Becker ro...@reportlab.com wrote: .. The point is, people keep insisting that there are a vast number of algorithms which are best expressed using recursion and which require TCO to be practical, and yet when asked for examples they either

Re: Why pay DICE When TheGongzuo.com is !! FREE !!

2015-07-15 Thread Ian Kelly
On Tue, Jul 14, 2015 at 8:47 PM, Steve Hayes hayes...@telkomsa.net wrote: On Tue, 14 Jul 2015 17:31:31 -0700 (PDT), trentonwesle...@gmail.com wrote: Greetings! You been Invited as a Beta User for TheGongzuo.com ( Absolutely Extended Trial). We bring to you TheGongzuo.com, Top notch highly

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-15 Thread Ian Kelly
On Tue, Jul 14, 2015 at 11:27 AM, Marko Rauhamaa ma...@pacujo.net wrote: Ian Kelly ian.g.ke...@gmail.com: On Tue, Jul 14, 2015 at 2:33 AM, Marko Rauhamaa ma...@pacujo.net wrote: The programmer shouldn't be controlling tail call optimizations. The programmer controls it regardless

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-14 Thread Ian Kelly
On Tue, Jul 14, 2015 at 1:26 AM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: On 07/14/2015 05:20 AM, Steven D'Aprano wrote: On Tue, 14 Jul 2015 12:05 am, Chris Angelico wrote: If you want to make an assertion that iterative code requires equivalent warping to tail-recursive code, I want

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-14 Thread Ian Kelly
On Mon, Jul 13, 2015 at 11:57 PM, Marko Rauhamaa ma...@pacujo.net wrote: Ian Kelly ian.g.ke...@gmail.com: On Mon, Jul 13, 2015 at 11:25 PM, Chris Angelico ros...@gmail.com wrote: (Also, side point: Python can't actually optimize the above function, because it actually means call quicksort

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-14 Thread Ian Kelly
On Tue, Jul 14, 2015 at 2:33 AM, Marko Rauhamaa ma...@pacujo.net wrote: Ian Kelly ian.g.ke...@gmail.com: On Mon, Jul 13, 2015 at 11:57 PM, Marko Rauhamaa ma...@pacujo.net wrote: How about return? I think you miss my point entirely. return doesn't mean tail-call optimize; Why

Re: str.index() and str.find() versus only list.index()

2015-07-13 Thread Ian Kelly
On Mon, Jul 13, 2015 at 9:23 PM, Steven D'Aprano st...@pearwood.info wrote: On Tue, 14 Jul 2015 01:12 pm, Ian Kelly wrote: On Mon, Jul 13, 2015 at 10:56 AM, Roel Schroeven r...@roelschroeven.net wrote: Hi, Quick question: why does str have both index() and find(), while list only has index

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-13 Thread Ian Kelly
On Mon, Jul 13, 2015 at 11:25 PM, Chris Angelico ros...@gmail.com wrote: (Also, side point: Python can't actually optimize the above function, because it actually means call quicksort, then discard its return value and return None. A true tail call has to return the result of the recursive

Re: str.index() and str.find() versus only list.index()

2015-07-13 Thread Ian Kelly
On Mon, Jul 13, 2015 at 10:56 AM, Roel Schroeven r...@roelschroeven.net wrote: Hi, Quick question: why does str have both index() and find(), while list only has index()? Is there a reason for that, or is it just an historical accident? Historical accident, I think. If it were to be redone,

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-13 Thread Ian Kelly
On Mon, Jul 13, 2015 at 6:34 AM, Chris Angelico ros...@gmail.com wrote: On Mon, Jul 13, 2015 at 10:00 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: On 07/13/2015 01:28 PM, Chris Angelico wrote: Why is it worth writing your code recursively, only to have it be implemented iteratively?

Re: beginners choice: wx or tk?

2015-07-11 Thread Ian Kelly
On Sat, Jul 11, 2015 at 3:35 AM, Chris Angelico ros...@gmail.com wrote: On Sat, Jul 11, 2015 at 7:28 PM, Ulli Horlacher frams...@rus.uni-stuttgart.de wrote: I want to start a project with python. The program must have a (simple) GUI and must run on Linux and Windows. The last one as

Re: 0 + not 0

2015-07-11 Thread Ian Kelly
On Sat, Jul 11, 2015 at 10:02 AM, Stefan Ram r...@zedat.fu-berlin.de wrote: I look at Python 3.4.3: a_expr ::= m_expr | a_expr + m_expr | a_expr - m_expr So, »not 0« must be an »m_expr« when used as the right operand of »+«. m_expr ::= u_expr | m_expr * u_expr | m_expr // u_expr |

Re: beginners choice: wx or tk?

2015-07-11 Thread Ian Kelly
On Sat, Jul 11, 2015 at 5:10 PM, Paul Rubin no.email@nospam.invalid wrote: Ulli Horlacher frams...@rus.uni-stuttgart.de writes: Long ago I was involved with a thing like this and used Inno Setup, which was great. It's a very slick installer It is not a matter of knowledge, but one of user

Re: Idle Not Working.

2015-07-08 Thread Ian Kelly
On Wed, Jul 8, 2015 at 2:57 PM, Terry Reedy tjre...@udel.edu wrote: On 7/8/2015 2:07 PM, Steve Burrus wrote: Now I am using both 32 and 64 bit versions of Idle There are no such things. Idle is python code that runs on whatever version of Python you have. As far as I know, you cannot easily

Re: An asyncio example

2015-07-04 Thread Ian Kelly
On Fri, Jul 3, 2015 at 9:14 AM, Marko Rauhamaa ma...@pacujo.net wrote: 1) is there a way to close just one direction of the connection? No. SOCK_STREAM sockets are always bidirectional. socket.shutdown(socket.SHUT_WR) does the trick. I think the asyncio.StreamWriter.write_eof() is the

Re: An asyncio example

2015-07-03 Thread Ian Kelly
On Fri, Jul 3, 2015 at 4:28 AM, Adam Bartoš dre...@gmail.com wrote: Hello, I'm experimenting with asyncio. I have composed the following code. There is a server handler and a client handler. I didn't want to split the code into two files so I just used a socketpair, inspired by example

Re: An asyncio example

2015-07-03 Thread Ian Kelly
On Fri, Jul 3, 2015 at 8:31 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, Jul 3, 2015 at 4:28 AM, Adam Bartoš dre...@gmail.com wrote: Hello, I'm experimenting with asyncio. I have composed the following code. There is a server handler and a client handler. I didn't want to split the code

Re: Bug in floating point multiplication

2015-07-02 Thread Ian Kelly
On Thu, Jul 2, 2015 at 9:26 AM, Paul Rubin no.email@nospam.invalid wrote: Steven D'Aprano st...@pearwood.info writes: x = 1 - 1/2**53 assert x == 0. In Python 2.x I don't see how that assert can possibly succeed, since x is the integer 1. But I tested it anyway on 2.7.5

Re: Bug in floating point multiplication

2015-07-02 Thread Ian Kelly
On my Chromebook, using Python 2.7.6 from the Ubuntu Trusty distribution, I get AssertionError, and x == 1. In Python 3.4.0 on the same system, the code runs to completion. Both Pythons appear to be 64-bit builds. On my Mint 17.1 desktop (which should be using the same packages), I get the same

Re: Bug in floating point multiplication

2015-07-02 Thread Ian Kelly
On Thu, Jul 2, 2015 at 9:28 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On my Chromebook, using Python 2.7.6 from the Ubuntu Trusty distribution, I get AssertionError, and x == 1. In Python 3.4.0 on the same system, the code runs to completion. Both Pythons appear to be 64-bit builds. On my

Re: Python 3 resuma a file download

2015-07-01 Thread Ian Kelly
On Wed, Jul 1, 2015 at 8:18 AM, zljubi...@gmail.com wrote: if I understood you correctly (I am not sure about which example you are refering), I should do the following: 1. check already downloaded file size in bytes = downloaded 2. url = 'http://video.hrt.hr/2906/otv296.mp4' 3. req =

Re: Datetime timezone trouble (was: Matplotlib X-axis timezone trouble)

2015-07-01 Thread Ian Kelly
On Wed, Jul 1, 2015 at 10:36 AM, Peter Pearson pkpearson@nowhere.invalid wrote: On Wed, 1 Jul 2015 17:15:38 +1000, Chris Angelico ros...@gmail.com wrote: Interestingly, when I tried this (pytz version 2015.4, Python 2.7.9, Debian Jessie), I saw utcoffset() showing (-1, 58020) for both. That

Re: Linear time baseconversion

2015-06-30 Thread Ian Kelly
On Tue, Jun 30, 2015 at 3:07 AM, Christian Gollwitzer aurio...@gmx.de wrote: Am 30.06.15 um 10:52 schrieb jonas.thornv...@gmail.com: It still bug out on very big numbers if base outside integer scope. I am very keen on suggestions regarding the logic to make it faster. Concerning the

Re: Linear time baseconversion

2015-06-30 Thread Ian Kelly
On Tue, Jun 30, 2015 at 9:40 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Tue, Jun 30, 2015 at 3:07 AM, Christian Gollwitzer aurio...@gmx.de wrote: Am 30.06.15 um 10:52 schrieb jonas.thornv...@gmail.com: It still bug out on very big numbers if base outside integer scope. I am very keen

Re: Linear time baseconversion

2015-06-30 Thread Ian Kelly
On Tue, Jun 30, 2015 at 8:13 AM, jonas.thornv...@gmail.com wrote: Regarding the time it seem to double the digits quadruple the time. And that is still linear or? 2x seem linear to me? That's not linear, nor is it 2x. If doubling the size of the input quadruples the time, then doubling the

Re: Linear time baseconversion

2015-06-30 Thread Ian Kelly
On Tue, Jun 30, 2015 at 10:10 AM, Chris Angelico ros...@gmail.com wrote: When there's a simple ratio between the bases, it's fairly straight-forward to convert a few digits at a time. Converting base 256 into base 64, for instance, can be done by taking three digits and yielding four. But

Re: Linear time baseconversion

2015-06-29 Thread Ian Kelly
On Mon, Jun 29, 2015 at 4:39 PM, jonas.thornv...@gmail.com wrote: http://jt.node365.se/baseconversion8.html Back of the envelope mental calculation, that appears to be quadratic, not linear. Doubling the length of the input results in an approximate quadrupling of the time taken to produce the

Re: Linear time baseconversion

2015-06-29 Thread Ian Kelly
On Mon, Jun 29, 2015 at 4:56 PM, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Jun 29, 2015 at 4:39 PM, jonas.thornv...@gmail.com wrote: http://jt.node365.se/baseconversion8.html Back of the envelope mental calculation, that appears to be quadratic, not linear. Doubling the length

Re: Pure Python Data Mangling or Encrypting

2015-06-27 Thread Ian Kelly
On Fri, Jun 26, 2015 at 7:21 PM, Chris Angelico ros...@gmail.com wrote: On Sat, Jun 27, 2015 at 6:09 AM, Randall Smith rand...@tnr.cc wrote: Give me one plausible scenario where an attacker can cause malware to hit the disk after bytearray.translate with a 256 byte translation table and I'll

Re: Pure Python Data Mangling or Encrypting

2015-06-27 Thread Ian Kelly
On Sat, Jun 27, 2015 at 5:33 AM, Chris Angelico ros...@gmail.com wrote: On Sat, Jun 27, 2015 at 8:18 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: I've looked at your code even though I don't know pike. That's the typesafe JavaScript derivative, isn't it? Not really; it's more like Python

Re: Pure Python Data Mangling or Encrypting

2015-06-27 Thread Ian Kelly
On Sat, Jun 27, 2015 at 2:38 AM, Steven D'Aprano st...@pearwood.info wrote: Can you [generic you] believe that attackers can *reliably* attack remote systems based on a 20µs timing differences? If you say No, then you fail Security 101 and should step away from the computer until a security

Re: Pure Python Data Mangling or Encrypting

2015-06-27 Thread Ian Kelly
On Sat, Jun 27, 2015 at 11:35 AM, Steven D'Aprano st...@pearwood.info wrote: On Sun, 28 Jun 2015 01:09 am, Ian Kelly wrote: On Sat, Jun 27, 2015 at 2:38 AM, Steven D'Aprano st...@pearwood.info wrote: Can you [generic you] believe that attackers can *reliably* attack remote systems based

Re: Pure Python Data Mangling or Encrypting

2015-06-26 Thread Ian Kelly
On Fri, Jun 26, 2015 at 9:38 PM, Steven D'Aprano st...@pearwood.info wrote: With respect Randall, you contradict yourself. Is there any wonder that some of us (well, me at least) is suspicious and confused, when your story changes as often as the weather? Sometimes you say that the client

Re: Pure Python Data Mangling or Encrypting

2015-06-26 Thread Ian Kelly
On Fri, Jun 26, 2015 at 3:07 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: That people in 2015 actually defend inventing a substitution-cipher cryptosystem sends literally shivers down my spine. I think that the people defending this have been reasonably consistent about using the word

Re: Reference Counting Irregularity

2015-06-25 Thread Ian Kelly
On Thu, Jun 25, 2015 at 12:49 PM, Eric Edmond t-er...@microsoft.com wrote: Hi, I have been writing a C++ extension for Python recently, and am currently fixing the reference counting throughout the extension. As I am very new to this topic, my question may have a simple answer, but I was

Re: Could you give me the detail process of 'make_incrementor(22)(33)'?

2015-06-25 Thread Ian Kelly
On Thu, Jun 25, 2015 at 2:53 PM, fl rxjw...@gmail.com wrote: Hi, I read a tutorial on lambda on line. I don't think that I am clear about the last line in its example code. It gives two parameters (22, 23). Is 22 for n, and 23 for x? Or, it creates two functions first. Then, each function

Re: converting boolean filter function to lambda

2015-06-25 Thread Ian Kelly
On Thu, Jun 25, 2015 at 9:59 AM, Ethan Furman et...@stoneleaf.us wrote: I have the following function: def phone_found(p): for c in contacts: if p in c: return True return False with the following test data: contacts = ['672.891.7280 x999', '291.792.9000 x111'] main =

Re: Could you explain [1, 2, 3].remove(2) to me?

2015-06-25 Thread Ian Kelly
On Thu, Jun 25, 2015 at 12:14 PM, fl rxjw...@gmail.com wrote: Hi, I see a code snippet online: [1, 2, 3].remove(42) I don't know where you pulled this from, but if this is from a tutorial then it doesn't seem to be a very good one. This constructs a list containing the elements 1, 2, and 3,

Re: Pure Python Data Mangling or Encrypting

2015-06-25 Thread Ian Kelly
On Thu, Jun 25, 2015 at 6:33 PM, Chris Angelico ros...@gmail.com wrote: On Fri, Jun 26, 2015 at 1:26 AM, Jon Ribbens jon+use...@unequivocal.co.uk wrote: There are only 256 possible values for n, one of which doesn't transform the data at all (ROT-0). If you're thinking of attacking this by

Re: Looking up a dictionary _key_ by key?

2015-06-24 Thread Ian Kelly
On Tue, Jun 23, 2015 at 7:06 PM, Paul Rubin no.email@nospam.invalid wrote: Chris Angelico ros...@gmail.com writes: Would I have to do an O(n) search to find my key? Iterate over it - it's an iterable view in Py3 - and compare. I think the question was whether the O(n) search could be avoided,

Re: method returns object reference

2015-06-23 Thread Ian Kelly
On Tue, Jun 23, 2015 at 12:32 PM, Tim jtim.arn...@gmail.com wrote: The code below prints the following two lines, showing how the 'newkey' is now inside the Client response, even though it was set in the worker. This must be bad practice! In my real code, the response is no longer an

Re: Re: Pyitect - Plugin architectural system for Python 3.0+ (feedback?)

2015-06-22 Thread Ian Kelly
On Mon, Jun 22, 2015 at 2:32 AM, Ben Powers ryexan...@gmail.com wrote: on Tue, Jun 16, 2015 at 17:49 Ian Kelly ian.g.kelly at gmail.com wrote On Mon, Jun 8, 2015 at 10:42 PM, Ben Powers ryexander at gmail.com wrote: #file.py from PyitectConsumes import foo class Bar(object): def

Re: Simplest/Idiomatic way to count files in a directory (using pathlib)

2015-06-22 Thread Ian Kelly
On Mon, Jun 22, 2015 at 4:33 PM, Travis Griggs travisgri...@gmail.com wrote: I should proof my posts before I send them, sorry Subject nearly says it all. If i’m using pathlib, what’s the simplest/idiomatic way to simply count how many files are in a given directory? I was surprised (at

Re: CLI Arguments That Call Functions?

2015-06-18 Thread Ian Kelly
On Thu, Jun 18, 2015 at 11:56 AM, Tony the Tiger tony@tiger.invalid wrote: I would have assumed there would be something built in to the ArgumentParser, but I can't detect anything that seems to do what I want, so I wrote the following: [SNIP] So, is there something already in the Python

Re: python program without stackless.run()

2015-06-18 Thread Ian Kelly
On Thu, Jun 18, 2015 at 1:47 PM, ravi temp@gmail.com wrote: I could not understand how the below program executes function fun without calling stackless.run() in the program? Here fun runs as a tasklet and as per my knowledge for that stackless.run() is must. You seem to have a lot of

Re: Get off the list

2015-06-18 Thread Ian Kelly
On Thu, Jun 18, 2015 at 1:05 AM, Cecil Westerhof ce...@decebal.nl wrote: On Wednesday 17 Jun 2015 09:09 CEST, Deogratius Musiige wrote: How can i get off this mailing list? Looking at the headers: List-Unsubscribe: https://mail.python.org/mailman/options/python-list,

Re: Documenting a function signature (was: Set a flag on the function or a global?)

2015-06-17 Thread Ian Kelly
On Wed, Jun 17, 2015 at 6:04 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Steven D'Aprano st...@pearwood.info writes: The full signature is: edir([object [, glob=''] [, dunders=True] [, meta=False]]) All four arguments are optional, and dunders and meta are keyword-only. The official

Re: Testing random

2015-06-17 Thread Ian Kelly
On Wed, Jun 17, 2015 at 8:04 AM, Grant Edwards invalid@invalid.invalid wrote: On 2015-06-17, Mark Lawrence breamore...@yahoo.co.uk wrote: An alternative explanation is that he's just a plain, old fashioned troll, as pointed out by Denis McMahon some weeks ago. Now what is the probability of

Re: Creating .exe file in Python

2015-06-16 Thread Ian Kelly
On Tue, Jun 16, 2015 at 9:17 AM, subhabrata.bane...@gmail.com wrote: On Tuesday, June 16, 2015 at 8:35:39 PM UTC+5:30, Laura Creighton wrote: In a message of Tue, 16 Jun 2015 06:56:12 -0700, writes: ii) In a class how may I include if __name__ == __main__: with multiple methods? But I think

Re: Pyitect - Plugin architectural system for Python 3.0+ (feedback?)

2015-06-16 Thread Ian Kelly
On Mon, Jun 8, 2015 at 10:42 PM, Ben Powers ryexan...@gmail.com wrote: As importlib has been added in python 3 and up I decided to use it's abilities to create a plugin system for truly modular development in python. Pyitect has the ability to drop in components and resolve dependencies. Even

Re: Testing random

2015-06-16 Thread Ian Kelly
On Jun 16, 2015 4:58 PM, Ian Kelly ian.g.ke...@gmail.com wrote: On Tue, Jun 16, 2015 at 4:30 PM, sohcahto...@gmail.com wrote: On Tuesday, June 16, 2015 at 3:01:06 PM UTC-7, Thomas 'PointedEars' Lahn wrote: This should give you pause: In real mathematics, events with zero probability can

Re: Testing random

2015-06-16 Thread Ian Kelly
On Tue, Jun 16, 2015 at 4:30 PM, sohcahto...@gmail.com wrote: On Tuesday, June 16, 2015 at 3:01:06 PM UTC-7, Thomas 'PointedEars' Lahn wrote: This should give you pause: In real mathematics, events with zero probability can occur. Nobody will disagree with that. The probability of me

Re: Struggling with os.path.join and fileinput (was 'Path, strings, and lines'

2015-06-15 Thread Ian Kelly
On Mon, Jun 15, 2015 at 8:00 PM, Malik Rumi malik.a.r...@gmail.com wrote: I have struggled with this for several hours and not made much progress. I was not sure if your 'names' variable was supposed to be the same as 'filenames'. Also, it should be 'os.path.join', not os.join. Anyway, I

Re: Testing random

2015-06-12 Thread Ian Kelly
On Fri, Jun 12, 2015 at 3:32 PM, Thomas 'PointedEars' Lahn pointede...@web.de wrote: Ian Kelly wrote: The probability of 123456789 and 1 are equal. The probability of a sequence containing all nine numbers and a sequence containing only 1s are *not* equal. There is a contradiction

Re: Path, strings, and lines

2015-06-12 Thread Ian Kelly
On Fri, Jun 12, 2015 at 1:39 PM, Malik Rumi malik.a.r...@gmail.com wrote: I am trying to find a list of strings in a directory of files. Here is my code: # -*- coding: utf-8 -*- import os import fileinput s2 = os.listdir('/home/malikarumi/Projects/P5/shortstories') Note that the

Re: Testing random

2015-06-12 Thread Ian Kelly
On Jun 12, 2015 4:16 PM, Thomas 'PointedEars' Lahn pointede...@web.de wrote: Ian Kelly wrote: […] Thomas 'PointedEars' Lahn […] wrote: Ian Kelly wrote: The probability of 123456789 and 1 are equal. The probability of a sequence containing all nine numbers and a sequence

Re: Java to Python autoconverters

2015-06-12 Thread Ian Kelly
On Jun 12, 2015 6:53 AM, Stefan Behnel stefan...@behnel.de wrote: Sebastian M Cheung via Python-list schrieb am 12.06.2015 um 13:36: Are these available? Any good ones to recommend? I recommend not doing that. You'd end up with ugly and unidiomatic Python code that's impossible to maintain,

Re: zip as iterator and bad/good practices

2015-06-12 Thread Ian Kelly
On Fri, Jun 12, 2015 at 9:00 AM, Fabien fabien.mauss...@gmail.com wrote: Folks, I am developing a program which I'd like to be python 2 and 3 compatible. I am still relatively new to python and I use primarily py3 for development. Every once in a while I use a py2 interpreter to see if my

Re: os.system error returns

2015-06-12 Thread Ian Kelly
On Jun 12, 2015 7:21 AM, Grawburg grawb...@myglnc.com wrote: I have a piece of code written for a Raspberry Pi with no explanation for two of the lines -- and I can't find an explanation I understand. Here are the lines: if os.system('modprobe --first-time -q w1_gpio') ==0 if

Re: os.system error returns

2015-06-12 Thread Ian Kelly
On Jun 12, 2015 7:54 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Jun 12, 2015 7:21 AM, Grawburg grawb...@myglnc.com wrote: I have a piece of code written for a Raspberry Pi with no explanation for two of the lines -- and I can't find an explanation I understand. Here are the lines

Re: Error in or

2015-06-11 Thread Ian Kelly
On Thu, Jun 11, 2015 at 9:40 AM, subhabrata.bane...@gmail.com wrote: if write this it is working fine, but if I write if (AND in inp1) or (OR in inp1) or (NOT in inp1) or ( in inp1) or ( in inp1) or (MAYBE in inp1) or (( in inp1) or (* in inp1) or (''' ''' in inp1): the portion

<    5   6   7   8   9   10   11   12   13   14   >