Re: Asynchronous processing is more efficient -- surely not?

2018-04-04 Thread Paul Rudin
Steven D'Aprano writes: > So, I'm, still trying to wrap my brain around async processing, and I > started reading this tutorial: > > http://stackabuse.com/python-async-await-tutorial/ > > and the very first paragraph broke my brain. > > "Asynchronous programming has been gaining a lot of tractio

Re: Python

2017-01-25 Thread Paul Rudin
Joaquin Alzola writes: > This email is confidential and may be subject to privilege. If you are not the > intended recipient, please do not copy or disclose its content but contact the > sender immediately upon receipt. Probably best not to send it to a publicly accessible mailing list then :/ -

Re: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Paul Rudin
"Deborah Swanson" writes: > Peter Otten wrote, on January 08, 2017 3:01 AM >> >> columnA = [record.A for record in records] > > This is very neat. Something like a list comprehension for named tuples? Not something like - this *is* a list comprehension - it creates a list of named tuples. The

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do

2017-01-06 Thread Paul Rudin
Tim Johnson writes: > * Antonio Caminero Garcia [170102 20:56]: >> Guys really thank you for your answers. Basically now I am more >> emphasizing in learning in depth a tool and get stick to it so I >> can get a fast workflow. Eventually I will learn Vim and its >> python developing setup, I kno

Re: Clickable hyperlinks

2017-01-06 Thread Paul Rudin
"Deborah Swanson" writes: > > I didn't try printing them before, but I just did. Got: > print([Example](http://www.example.com) > > SyntaxError: invalid syntax (arrow pointing at the colon) > With respect, if you typed that at python then it's probably a good idea to take a step back and

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do

2017-01-06 Thread Paul Rudin
Tim Johnson writes: > * Antonio Caminero Garcia [170102 20:56]: >> Guys really thank you for your answers. Basically now I am more >> emphasizing in learning in depth a tool and get stick to it so I >> can get a fast workflow. Eventually I will learn Vim and its >> python developing setup, I kno

Re: Clickable hyperlinks

2017-01-04 Thread Paul Rudin
"Deborah Swanson" writes: > > I didn't try printing them before, but I just did. Got: > print([Example](http://www.example.com) > > SyntaxError: invalid syntax (arrow pointing at the colon) > With respect, if you typed that at python then it's probably a good idea to take a step b

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-04 Thread Paul Rudin
Tim Johnson writes: > * Antonio Caminero Garcia [170102 20:56]: >> Guys really thank you for your answers. Basically now I am more >> emphasizing in learning in depth a tool and get stick to it so I >> can get a fast workflow. Eventually I will learn Vim and its >> python developing setup, I kno

Re: Pyvenv puts both Python 2 and Python 3 in the same environment. Shocked!

2016-12-20 Thread Paul Rudin
Malik Rumi writes: > I just created a new venv using pyvenv from a 2.7 install. Now I am shocked to > see that I can get both 2.7 and 3.4 in this same venv: > > (memory) malikarumi@Tetuoan2:~/Projects/cannon/New2.7Projects/memory$ python > Python 2.7.12 (default, Nov 19 2016, 06:48:10) > [GCC 5.

Re: I am new to python. I have a few questions coming from an armature!

2016-08-16 Thread Paul Rudin
Lawrence D’Oliveiro writes: > On Tuesday, August 16, 2016 at 6:26:01 PM UTC+12, Paul Rudin wrote: >> sohcahtoa82 writes: >>> squared_plus_one_list = map(lambda x: x**2 + 1, some_list) >> >> I realise that this is about understanding lambda, but it's worth n

Re: I am new to python. I have a few questions coming from an armature!

2016-08-15 Thread Paul Rudin
sohcahto...@gmail.com writes: > On Monday, August 15, 2016 at 8:07:32 AM UTC-7, alister wrote: >> On Mon, 15 Aug 2016 07:00:47 -0700, Sickfit92 wrote: >> >> > 1. How long did it take you guys to master the language or, let me put >> > it this way to completely get the hang and start writing code?

Re: Asynchronous programming

2016-08-11 Thread Paul Rudin
Steven D'Aprano writes: > Thanks to everyone who has answered, I think I'm slowly starting to get it > now. Let's see if we can come up with a toy example that doesn't involve > low-level socket programming :-) > > Let me simulate a slow function call: > > > import random, time > > def work(id):

Re: Asynchronous programming

2016-08-11 Thread Paul Rudin
Steven D'Aprano writes: > > But what's the point in doing it asynchronously if I have to just wait for > it to complete? > > begin downloading in an async thread > twiddle thumbs, doing nothing > process download If you have nothing else to do, then there's no point. But suppose you're im

Re: Asynchronous programming

2016-08-11 Thread Paul Rudin
Chris Angelico writes: > On Thu, Aug 11, 2016 at 7:45 PM, Steven D'Aprano > wrote: >> I don't know whether you would call that a callback. I suppose it could be, >> in >> the sense that you might say: >> >> button.set_mouseup_function(mouseUp) >> >> but I'm used to thinking of it as a prope

Re: Asynchronous programming

2016-08-10 Thread Paul Rudin
Steven D'Aprano writes: > > Is there a good beginner's tutorial introducing the basics of asynchronous > programming? Starting with, why and where would you use it? You could do worse than watch Dave Beazley's pycon talk: https://www.youtube.com/watch?v=lYe8W04ERnY -- https://mail.python.org/ma

Re: log file.

2016-06-15 Thread Paul Rudin
Joaquin Alzola writes: > This email is confidential and may be subject to privilege. If you are > not the intended recipient, please do not copy or disclose its content > but contact the sender immediately upon receipt. Probably not a good idea to send it to a publicly accessible resource then :

Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Paul Rudin
Paul Rudin writes: > Marko Rauhamaa writes: >> So your "names" are *variables*. > > Informally yes, but "variable" has no meaning in the language reference. > ... err sorry, actually not correct - but irrelevant to the point under discussion. -- ht

Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Paul Rudin
Marko Rauhamaa writes: > Paul Rudin : > >> Marko Rauhamaa writes: >>> The object is only an intermediate result; what is returned is a >>> pointer (to an object), without an exception. That's not a matter of >>> implementation. It's an essent

Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Paul Rudin
Marko Rauhamaa writes: > Paul Rudin : > >> Marko Rauhamaa writes: >>> What is different is that in Python, every expression evaluates to a >>> pointer. Thus, you can only assign pointers to variables. >> >> I don't think that's really right -

Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Paul Rudin
Marko Rauhamaa writes: > Antoon Pardon : > >> You can do something like that in simula, but only because >> simula has two kinds of assignments. One kind that is >> simular to python and one that is similar to C. >> The one that is similar that python is the reference assignment. > > I see Python

Re: Don't put your software in the public domain

2016-06-06 Thread Paul Rudin
Nobody writes: > On Sat, 04 Jun 2016 12:28:33 +1000, Steven D'Aprano wrote: > >>> OTOH, a Free software licence is unilateral; the author grants the user >>> certain rights, with the user providing nothing in return. >> >> That's not the case with the GPL. >> >> The GPL requires the user (not t

Re: Don't put your software in the public domain

2016-06-04 Thread Paul Rudin
Lawrence D’Oliveiro writes: > On Friday, June 3, 2016 at 9:53:47 PM UTC+12, Steven D'Aprano wrote: > >> A licence is something like a contract... > > A licence is quite different from a contract. A contract requires some > indication of explicit agreement by both parties, a licence does not. That

Re: Don't put your software in the public domain

2016-06-04 Thread Paul Rudin
Lawrence D’Oliveiro writes: > I wonder about the point of that, though; I have heard of cases where > the judge ruled that the contract had been breached, and awarded > damages of one pound/dollar/euro. So other than winning a symbolic > victory, what was the point? Damages for breach of contra

Re: Don't put your software in the public domain

2016-06-04 Thread Paul Rudin
Nobody writes: > On Fri, 03 Jun 2016 09:15:55 -0700, Lawrence D’Oliveiro wrote: > >>> [quoted text muted] >> >> A licence is quite different from a contract. A contract requires some >> indication of explicit agreement by both parties, a licence does not. > > More precisely, it requires "mutual

Re: I'm wrong or Will we fix the ducks limp?

2016-06-03 Thread Paul Rudin
Sayth Renshaw writes: > Very briefly because I hope to shot down eloquently. > > Python is beautiful and is supposed to be a duck typed language, Yes? > > Then if I create and assign to a new variable with a list action why > does the duck not quack? > > It feels wrong to spend a line writing wha

Re: Python on Windows with linux environment

2016-06-02 Thread Paul Rudin
Deborah Martin writes: > Try Cygwin at http://www.cygwin.com > Or use the new windows subsystem for linux: https://blogs.windows.com/buildingapps/2016/03/30/run-bash-on-ubuntu-on-windows/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Quote of the day

2016-05-17 Thread Paul Rudin
Marko Rauhamaa writes: > Paul Rudin : > >> Marko Rauhamaa writes: >>> The feeling of powerlessness can be crushing when you depend on a >>> third-party component that is broken with no fix in sight. >> >> Presumably it depends on whether you have t

Re: Quote of the day

2016-05-17 Thread Paul Rudin
Marko Rauhamaa writes: > Radek Holý : > >> 2016-05-17 9:50 GMT+02:00 Steven D'Aprano < >> steve+comp.lang.pyt...@pearwood.info>: >> >>> Overhead in the office today: >>> >>> "I don't have time to learn an existing library - much faster to make >>> my own mistakes!" >> >> *THUMBS UP* At least they

Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Paul Rudin
Pete Forman writes: > Why is it that Python continues to use a fixed width font and therefore > specifies the maximum line width as a character count? Python doesn't require the use of any particular font for editing your code. However programmers tend to use fixed width fonts when editing code

Re: [OT] fortran lib which provide python like data type

2015-02-02 Thread Paul Rudin
Marko Rauhamaa writes: > Chris Angelico : > >> On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano >> wrote: >>> And there are underspecified rules too. What is the plural of octopus? No >>> fair looking it up in the dictionary. >> >> Standard and well-known piece of trivia, and there are several >

Re: Random ALL CAPS posts on this group

2015-01-20 Thread Paul Rudin
Rick Johnson writes: > No one here would justify a public business refusing to > serve or employ a person based on race, religion, sex, or > otherwise. Depends on what you mean by "or otherwise". > So why would you so easily discriminate against speech? People discriminate amongst prospective

Re: Python vs C++

2014-08-23 Thread Paul Rudin
Chris Angelico writes: > On Sat, Aug 23, 2014 at 3:56 PM, dieter wrote: >> Chris Angelico writes: >>> Frankly, I wouldn't write OO in anything, because I think the entire >>> concept of a WYSIWYG editor is flawed. >> >> That would limit (so called) office applications to experts only. >> But th

Re: Keep one GUI always on TOP while python code is running

2014-08-08 Thread Paul Rudin
Chris Angelico writes: > On Fri, Aug 8, 2014 at 3:57 PM, Jaydeep Patil wrote: >> I mean to say, One GUI should be always on top from start to end of code >> running. >> So that user cant do any other operation. >> I am using wxpython > > Ah, that would be called "System Modal", and should be re

Re: OT: usenet reader software

2014-07-20 Thread Paul Rudin
Sturla Molden writes: > wrote: > >> That doesn't address the problem at all! :-) You still need a news >> reader. > > The problem was that Thunderbird does not support killfiles when used as a > newsreader. Leafnode adds filtering capabilities which Thunderbird > (supposedly) does not have. >

Re: OT: usenet reader software

2014-07-18 Thread Paul Rudin
memilanuk writes: > Guess where I'm going with this is... is there anything out there worth trying > - on Linux - that I'm missing? emacs/gnus. -- https://mail.python.org/mailman/listinfo/python-list

Re: IDE for python

2014-05-29 Thread Paul Rudin
Terry Reedy writes: > On 5/29/2014 5:41 AM, Wolfgang Maier wrote: >> On 28.05.2014 12:43, Sameer Rathoud wrote: >>> Hello everyone, >>> >>> I am new to python. >>> >>> I am currently using python 3.3 >>> >>> With python I got IDLE, but I am not very comfortable with this. > > What bothers you the

Re: Teaching python to non-programmers

2014-04-11 Thread Paul Rudin
Steven D'Aprano writes: > On Thu, 10 Apr 2014 22:42:14 -0700, Rustom Mody wrote: > >> In middle-eastern society women are expected to dress heavier than in >> the West. A few years ago a girl went to school in France with a scarf >> and she was penalized. > > Citation please. I think this is bogu

Re: Teaching python to non-programmers

2014-04-10 Thread Paul Rudin
Chris Angelico writes: > On Fri, Apr 11, 2014 at 2:37 PM, Rustom Mody wrote: >> Right. Its true that when I was at a fairly large corporate, I was not told: >> "Please always top post!" >> >> What I was very gently and super politely told was: >> "Please dont delete mail context" > > Then you we

Re: Debugging on the Mac question.

2014-01-03 Thread Paul Rudin
Sean Murphy writes: > I am a Vision Impaired programmer on the Mac and Window platforms. I have > started to learn Python. The biggest road block I have is the ability of > debugging my simple scripts. The IDLE program does not work with the screen > readers I use on the Mac or Windows. A screen

Re: Got a Doubt ! Wanting for your Help ! Plz make it ASAP !

2013-11-27 Thread Paul Rudin
rusi writes: > Propositionally: All languages are equal -- Turing complete As an aside, not all languages are Turing complete. For example Charity is a language with the property that programs are guaranteed to terminate. -- https

Re: Automation

2013-11-14 Thread Paul Rudin
Steven D'Aprano writes: > A few minor errors is one thing, but when you see people whose posts are > full of error after error and an apparent inability to get English syntax > right, you have to wonder how on earth they expect to be a programmer? The irritating thing is apparent lack of care

Re: personal library

2013-10-30 Thread Paul Rudin
Chris Angelico writes: > On Wed, Oct 30, 2013 at 1:00 PM, Dave Angel wrote: >> First, I haven't seen any mention of a source control system. Get one, >> learn it, and use it. That should always hold your master copy. And >> the actual repository should be on a system you can access from any o

Re: better and user friendly IDE recommended?

2013-09-12 Thread Paul Rudin
Joshua Landau writes: > If the time learning a set of tools is enough to make the choice > between tools, I suggest avoiding, say, Vim. That's a big if. If you expect to spend a lot of time editing text, code, etc. over the next few years then it's definitely learning at least one of vim or em

Re: how to detect comment in source code file ?

2013-09-04 Thread Paul Rudin
Ben Finney writes: > vnkumbh...@gmail.com writes: > >> how works python interpreter for finding comment ? > > It works as specified in the language reference. In particular, see > http://docs.python.org/3/reference/lexical_analysis.html#comments>. > >> if possible find nested comment ? > > Python

Re: user interfaces python3.x

2013-09-02 Thread Paul Rudin
Steven D'Aprano writes: > On Mon, 02 Sep 2013 08:03:02 -0700, Paul Rice wrote: > >> Im new to python3.x (well, programming as a whole. Never done before) >> and was wondering how do i get a proper interface instead of just >> writing. > > A "proper" interface huh? Well, I'd love to tell you the

Re: semicolon at end of python's statements

2013-08-31 Thread Paul Rudin
Jussi Piitulainen writes: > # Option 1.5 > for spam in sequence: > if not predicate(spam): continue > process(spam) > > This saves an indent level. Just out of interest: is saving an indent level a useful thing? I wouldn't lay out my code like that just because if you're coming back to

Re: How can I make this piece of code even faster?

2013-07-21 Thread Paul Rudin
Steven D'Aprano writes: > On Sat, 20 Jul 2013 13:22:03 -0700, pablobarhamalzas asked: > > "How can I make this piece of code even faster?" > > - Use a faster computer. > - Put in more memory. > - If using Unix or Linux, decrease the "nice" priority of the process. > > I mention these because some

Re: Editor Ergonomics [was: Important features for editors]

2013-07-11 Thread Paul Rudin
Roy Smith writes: > This is why I never understood the attraction of something like > xemacs, where you use the mouse to make text selections and run > commands out of menus. Menus are good for learning the functionality, and you have them just as much in Gnu emacs as in xemacs. You can even us

Re: sympy.nsimplify

2013-05-21 Thread Paul Rudin
Skip Montanaro writes: > Very cool indeed. In the comments was a link to an XKCD cartoon. Its > tool tip mentioned "twin primes". Looked that up. Google pointed (of > course) at Wikipedia. Read that. Backed up to the Google Search, and > noticed there is a news item from 15 hours ago that a

Re: to a human - about 2to3

2013-05-01 Thread Paul Rudin
"Jennifer Butler" writes: > Hiya > > I have trawled around your various pages and haven’t found what I > want. > > I will start teaching Python to my pupils shortly. I have been looking > for materials and have gathered a collection of programs. The problem > is they are written in v2 and I have

Re: Iterating over files of a huge directory

2012-12-17 Thread Paul Rudin
Chris Angelico writes: > On Tue, Dec 18, 2012 at 2:28 AM, Gilles Lenfant > wrote: >> Hi, >> >> I have googled but did not find an efficient solution to my >> problem. My customer provides a directory with a hge list of >> files (flat, potentially 10+) and I cannot reasonably use >> os.li

Re: Python parser problem

2012-12-13 Thread Paul Rudin
Chris Angelico writes: > On Fri, Dec 14, 2012 at 6:12 AM, RCU wrote: >> Dave, >> Thanks for the reply. >> The script was originally edited on Windows with proper \r\n endings, > > It's worth noting that many Windows-based editors and interpreters are > quite happy with \n line endings.

Re: Help with unittest2

2012-12-13 Thread Paul Rudin
Thomas Bach writes: > BTW, I actually never used 'assertTypeEqual' I rather call assertEqual > and let unittest do the internals. I think assertEqual calls the right > method for you depending on the arguments type. The assertEqual methods have the advantage of checking the type of the argume

Re: python and Open cv

2012-11-01 Thread Paul Rudin
Zero Piraeus writes: > There aren't any rules about gmail (except the unwritten rule that to > be a "real" geek you need to use a mail client that takes a whole > weekend to configure, and another three years to properly understand). Ha! 3 years? I've been using gnus for nearly 20 years and I st

Re: while expression feature proposal

2012-10-25 Thread Paul Rudin
Paul Rubin writes: > kind of ugly, makes me wish for a few more itertools primitives JOOI, do you have specific primitives in mind? -- http://mail.python.org/mailman/listinfo/python-list

Re: Hiring Python Developer @ CA, USA

2012-09-18 Thread Paul Rudin
nithinm...@gmail.com writes: > ...Must be an export in this language... Are you hiring proof readers as well? :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Search and replace text in XML file?

2012-07-31 Thread Paul Rudin
Terry Reedy writes: > ... a proper text-editor* > * ... Notepad++ is one such on Windows. Surely emacs is the only such on any platform? :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding duplicate file names and modifying them based on elements of the path

2012-07-20 Thread Paul Rudin
"larry.mart...@gmail.com" writes: > It seems that if you do a list(group) you have consumed the list. This > screwed me up for a while, and seems very counter-intuitive. You've consumed the *group* which is an iterator, in order to construct a list from its elements. Sorry if this is excessively

Re: Encapsulation, inheritance and polymorphism

2012-07-19 Thread Paul Rudin
Steven D'Aprano writes: > For example, both ML and Haskell can, under some circumstances, report a > type-error for an infinite loop, *at compile time*. ... and in Charity all programs are guaranteed to terminate. Of course it's not Turing complete.

Re: code review

2012-07-04 Thread Paul Rudin
Mark Lawrence writes: > On 03/07/2012 03:25, John O'Hagan wrote: >> On Tue, 3 Jul 2012 11:22:55 +1000 >> >> I agree to some extent, but as a counter-example, when I was a child there >> a subject called "Weights and Measures" which is now redundant because of the >> Metric system. I don't miss ho

Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-20 Thread Paul Rudin
elvis-85...@notatla.org.uk writes: > On 2012-06-17, Jon Clements wrote: > >> Whatever you do - *do not* attempt to write your own algorithm. > > very true If everyone took that advice then we'd have a problem -- http://mail.python.org/mailman/listinfo/python-list

Re: Software Engineer -

2012-03-13 Thread Paul Rudin
Chris Withers writes: > On 11/03/2012 09:00, Blue Line Talent wrote: >> Blue Line Talent is looking for a mid-level software engineer with >> experience in a combination of > > Please don't spam this list with jobs, use the Python job board instead: > > http://www.python.org/community/jobs/ Just

Re: open office in another language?

2012-01-11 Thread Paul Rudin
Stefan Behnel writes: > OOo has been fully scriptable in Python for ages. It even comes with an > embedded Python runtime for that purpose (at least on > non-package-management systems like Windows). So, Python is actually a > standard component in all installations, whereas Java is not, and is

Re: Test None for an object that does not implement ==

2011-12-26 Thread Paul Rudin
GZ writes: > I run into a weird problem. I have a piece of code that looks like the > following: > > f(, a=None, c=None): > assert (a==None)==(c==None) > There is only one 'None' - so use 'a is None' rather than 'a == None'. (In common lisp there is a particular language construct tha

Re: % is not an operator

2011-12-14 Thread Paul Rudin
Steven D'Aprano writes: > The existence of two potential answers for the remainder is certainly > correct, but the conclusion that remainder is not a binary operation > doesn't follow. It is a binary relation. This depends on your definition of "operation". Normally an operation is a function

Re: xml, minidom, ElementTree

2011-12-14 Thread Paul Rudin
Ethan Furman writes: > In the near future I will need to parse and rewrite parts of a xml files > created by a third-party program (PrintShopMail, for the curious). > It contains both binary and textual data. > > There has been some strong debate about the merits of minidom vs > ElementTree. > >

Re: How to insert my own module in front of site eggs?

2011-11-17 Thread Paul Rudin
Roy Smith writes: > In article <874ny2fzn6@no-fixed-abode.cable.virginmedia.net>, > Paul Rudin wrote: > >> >> Maybe I'm missing something - but if I want to do this I just mess about >> with sys.path at the top of my python script/program. Always se

Re: How to insert my own module in front of site eggs?

2011-11-17 Thread Paul Rudin
Roy Smith writes: > But, you're talking about installers. I'm talking about if I've already > got something installed, how do I force one particular python process to > pull in a local copy of a module in preference to the installed one? > > In some cases, I own the machine and can make chang

Re: How to isolate a constant?

2011-10-23 Thread Paul Rudin
Gnarlodious writes: > Thanks for all those explanations, I've already fixed it with a tuple. > Which is more reliable anyway. neither of lists or tuples are "more reliable" than the other. They both have perfectly well defined behaviour (which can be gleaned from reading the documentation) and r

Re: revive a generator

2011-10-21 Thread Paul Rudin
Yingjie Lan writes: > > > What if the generator involves a variable from another scope, > and before re-generating, the variable changed its value. > Also, the generator could be passed in as an argument, > so that we don't know its exact expression. > vo = 34  g = (vo*x for x in range(3

Re: revive a generator

2011-10-21 Thread Paul Rudin
Yingjie Lan writes: > - Original Message - >> From: Paul Rudin >> Generators are like that - you consume them until they run out of >> values. You could have done [x*x for x in range(3)] and then iterated >> over that list as many times as you wanted. >>

Re: revive a generator

2011-10-20 Thread Paul Rudin
Yingjie Lan writes: > Hi, > > it seems a generator expression can be used only once: > g = (x*x for x in range(3)) for x in g: print x > 0 > 1 > 4 for x in g: print x #nothing printed > > Is there any way to revive g here? > Generators are like that - you consume them until t

Re: 1/2 evaluates to 0

2011-10-12 Thread Paul Rudin
Laurent Claessens writes: > Hi all > > > This is well known : > 1/2 > 0 > > This is because the division is an "integer division". > > My question is : how can I evaluate 1/2 to 0.5 ? Is there some non > integer division operator ? > Up to now I workarounded writing float(1)/2. Is there an o

Re: Suggested coding style

2011-09-30 Thread Paul Rudin
"Prasad, Ramit" writes: >>May I suggest a[n] email client that can group mailing list threads? > > Please do. Bonus points if it handles threading in a Gmail-like style. The answer to any news/mail client with feature X type question is normally "gnus" - although I don't know what "Gmail-like st

Re: Hierarchical commnd line parsing / help texts

2011-09-26 Thread Paul Rudin
"Prasad, Ramit" writes: > This email is confidential... Probably a bad idea to post it to a world readable mailing list then :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Operator commutativity

2011-09-19 Thread Paul Rudin
Henrik Faber writes: > How can I make this commutative? Incidentally - this isn't really about commutativity at all - the question is how can you define both left and right versions of add, irrespective of whether they yield the same result. I think __radd__ is what you're after. -- http://ma

Re: Processing a large string

2011-08-28 Thread Paul Rudin
goldtech writes: > Hi, > > Say I have a very big string with a pattern like: > > akakksssk3dhdhdhdbddb3dkdkdkddk3dmdmdmd3dkdkdkdk3asnsn. > > I want to split the sting into separate parts on the "3" and process > each part separately. I might run into memory limitations if I use > "split" and

Re: How can I make a program automatically run once per day?

2011-07-10 Thread Paul Rudin
John Salerno writes: > I have a script that does some stuff that I want to run every day for > maybe a week, or a month. So far I've been good about running it every > night, but is there some way (using Python, of course) that I can make > it automatically run at a set time each night? Well - y

Re: TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead)

2011-07-07 Thread Paul Rudin
Steven D'Aprano writes: > Please don't post code with line numbers. That makes it difficult to copy > and paste your function into an interactive session, so that we can run it > and see what it does. C-x r d -- http://mail.python.org/mailman/listinfo/python-list

Re: Does hashlib support a file mode?

2011-07-07 Thread Paul Rudin
Anssi Saari writes: > Mel writes: > >> def file_to_hash(path, m = hashlib.md5()): >> >> hashlib.md5 *is* called once; that is when the def statement is executed. > > Very interesting, I certainly wasn't clear on this. So after that def, > the created hashlib object is in the module's scope and c

Re: Fibonacci series recursion error

2011-04-30 Thread Paul Rudin
Hans Georg Schaathun writes: > On Sat, 30 Apr 2011 12:29:00 +0100, Paul Rudin >wrote: > : Clearly it makes a difference in any case where you'd hit the recursion > : limit. > > What kind of problems make you hit the limit? > > Other than when you forget the ba

Re: Fibonacci series recursion error

2011-04-30 Thread Paul Rudin
Hans Georg Schaathun writes: > On Sat, 30 Apr 2011 06:43:42 +0100, Paul Rudin >wrote: > : Writing recurive code is acceptable and is a nice clear way of > : expressing things when you have naturally recursive data structures, and > : can lead to perfectly good compiled co

Re: Fibonacci series recursion error

2011-04-29 Thread Paul Rudin
harrismh777 writes: > lalit wrote: >> The above function return the >> return (fib(n-1)+fib(n-2)) >> >> RuntimeError: maximum recursion depth exceeded in comparison >> [36355 refs] > > There is much debate about this generally, but general wisdom is that > recursion is to be avoided when possible

Re: Feature suggestion -- return if true

2011-04-12 Thread Paul Rudin
Teemu Likonen writes: > I'm a simple Lisp guy who wonders if it is be possible to add some kind > of macros to the language... As a (now somewhat lapsed) long-time lisp programmer I sympathise with the sentiment, but suspect that it's not going to gain serious traction in python circles. -- htt

Re: Directly Executable Files in Python

2011-03-29 Thread Paul Rudin
Benjamin Kaplan writes: > If you can figure out a good way to compile a language like Python, > you'll be very rich. Yes, it is running the interpreter and then > running the bytecode on the interpreter. It's the same way Java and > .NET work. Not exactly AIUI. .NET bytecodes do actually get co

Re: best python games?

2011-03-28 Thread Paul Rudin
alex23 writes: > Paul Rudin wrote: >> Apparently Eve Online is (stackless) python. > > I've dropped a ridiculous number of hours into EVE this year alone but > I'd be very hesitant to ever mention "best" in relation to its > coding :) > > It uses

Re: best python games?

2011-03-26 Thread Paul Rudin
sogeking99 writes: > hey guys, what are some of the best games made in python? free games > really. like pygames stuff. i want to see what python is capable of. Apparently Eve Online is (stackless) python. -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy function, please help.

2011-02-08 Thread Paul Rudin
Nanderson writes: > loop would be infinite. I get what is happening in the function, and I > understand why this would work, but for some reason it's confusing me > as to how it is exiting the loop after a certain number of times. Help > is appreciated, thanks. It works because 0 tests false an

Re: Is Eval *always* Evil?

2010-11-11 Thread Paul Rudin
Robert Kern writes: > On 2010-11-10 17:14 , Christian Heimes wrote: >> Am 10.11.2010 18:56, schrieb Simon Mullis: >> >> Yes, eval is evil, may lead to security issues and it's unnecessary >> slow, too. Still - it is used in the standard library... -- http://mail.python.org/mailman/listinfo/pyth

Re: multiple discontinued ranges

2010-11-10 Thread Paul Rudin
xoff writes: > I was wondering what the best method was in Python programming for 2 > discontinued ranges. e.g. I want to use the range 3 to 7 and 17 to 23. > Am I obliged to use 2 for loops defining the 2 ranges like this: > > for i in range (3,7): > do bla > for i in range (7,17): > do bla >

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-10 Thread Paul Rudin
Lawrence D'Oliveiro writes: > In message , Terry Reedy > wrote: > >> To echo John Nagle's point, if you want non-masochist volunteers to read >> your code, write something readable like: >> >> dict1 = {'ab': [[1,2,3,'d3','d4',5], 12], >> 'ac': [[1,3,'78a','79b'], 54], >> 'ad

Re: What is the best way to handle a missing newline in the following case

2010-11-05 Thread Paul Rudin
"danmcle...@yahoo.com" writes: >> The problem is when I get to the last line. When the program sees '\n' >> after the 9, everything works fine. However, when there isn't a '\n', >> the program doesn't process the last line. >> >> What would be the best approach to handle the case of the possible

Re: What people are using to access this mailing list

2010-11-03 Thread Paul Rudin
John Bond writes: > On 3/11/2010 11:17 AM, Steven D'Aprano wrote: >> On Wed, 03 Nov 2010 08:02:29 +, John Bond wrote: >> >>> Hope this isn't too O/T - I was just wondering how people read/send to >>> this mailing list, eg. normal email client, gmane, some other software >>> or online service?

Re: functions, list, default parameters

2010-11-02 Thread Paul Rudin
Terry Reedy writes: > Suppose I write an nasty C extension that mutates tuples. What then > would be illegal about... Depends on exactly what we mean by legal. If immutability is part of the language spec (rather than an artifact of a particular implementation) then a compiler could assume immut

Re: Python documentation too difficult for beginners

2010-11-02 Thread Paul Rudin
Steven D'Aprano writes: > A fair point -- the built-in open comes up as hit #30, whereas searching > for open in the PHP page brings up fopen as hit #1. But the PHP search > also brings up many, many hits -- ten pages worth. > OTOH googling for "python open" gives you the correct (for 2.7) pag

Re: embarrassing class question

2010-10-29 Thread Paul Rudin
Gregory Ewing writes: > Brendan wrote: >> I use >> Python sporadically, and frequently use the dir command to learn or >> remind myself of class methods. > > You can clean up dir() by defining __all__ as a list of > names that you want to officially export. Other names will > still be there, but

Re: is list comprehension necessary?

2010-10-26 Thread Paul Rudin
Andre Alexander Bell writes: > I occasionally use LCs, if they seem useful. However, what I don't like > about LCs is that they 'look-like' being a closed scope, while actually > they are in the scope of there call. Example: > i = 5 l = [i**2 for i in range(3)] i > 2 > Although:

Re: Has Next in Python Iterators

2010-10-25 Thread Paul Rudin
Kelson Zawack writes: > The example I have in mind is list like [2,2,2,2,2,2,1,3,3,3,3] where > you want to loop until you see not a 2 and then you want to loop until > you see not a 3. "loop until you see not a 2" - you mean yield 2s as long as there are 2s to be consumed? "loop until you see

Re: Has Next in Python Iterators

2010-10-21 Thread Paul Rudin
Kelson Zawack writes: > Since an iterator having an end is not actually an exceptional case... There's no requirement on iterators to be finite, so in a sense it is. In general it may be impractical to know whether an iterator has reached the end without calling next(). -- http://mail.python

Re: Help with sets

2010-10-05 Thread Paul Rudin
"B. M. Whealton" writes: > I did get a bit confused in reading about the concept of sets in > python and why you would use them instead of a dictionary for example. Use a set when something is naturally modelled as a set... it's a collection of unordered objects that you can test for membership,

  1   2   3   >