Re: Pythonic infinite for loop?

2011-04-14 Thread John Connor
If I understand your question correctly, what you want is probably something like: i = 0 lst=[] while True: try: lst.append(parse_kwdlist(dct["Keyword%d"%i])) i += 1 except KeyError: break --jac On Thu, Apr 14, 2011 at 9:10 PM, Chris Angelico wrote: > Apologies for interrupting the

Re: Python IDE/text-editor

2011-04-15 Thread John Bokma
.org/software/emacs/> or Vim > http://www.vim.org/> are excellent general-purpose editors that > have strong features for programmers of any popular language or text > format. I second Emacs or vim. I currently use Emacs the most, bu

Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
st check it out. - Emmett What I love so much about Emacs is that each feature I've wanted so far is either part of it, or can be installed. Sometimes I have to change how I think about the feature a bit, but so far, so good. -- John Bokma

Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
im or Emacs is that using the mouse delays things. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl & Python Development: http://castleamber.com/ -- http://mail.pyt

Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
ght. [1] which is part of the Emacs version I am using, I just learned. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl & Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
> It takes forever to set it up. If you mean to make work optimally for your way of editing, probably true. You can keep fine tuning, adding/testing stuff, etc. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: htt

Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
times over years, and never worked. What did the trick for me was just switching to Emacs, and read the GNU Emacs Manual thoroughly and making notes. And the next day try what I read the day before. -- John Bokma j3b Blog:

Re: Python IDE/text-editor

2011-04-16 Thread John Bokma
rusi writes: > On Apr 17, 3:19 am, John Bokma wrote: >> rusi writes: >> > On Apr 16, 9:13 pm, Chris Angelico wrote: >> >> Based on the comments here, it seems that emacs would have to be the >> >> editor-in-chief for programmers. I currently us

Re: Python IDE/text-editor

2011-04-17 Thread John Bokma
r is going to switch to Emacs to begin with :-D. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl & Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE/text-editor

2011-04-17 Thread John Bokma
Bastian Ballmann writes: > Am Sat, 16 Apr 2011 22:22:19 -0500 > schrieb John Bokma : > >> Yeah, if you bring it down to open a file, save a file, and move the >> cursor around, sure you can do that in a day or two (two since you >> have to get used to the "wei

Re: Python IDE/text-editor

2011-04-17 Thread John Bokma
ng at all those shiny GUI elements when editing? I've turned off the icon bar in Emacs (pointless) and rarely use the menu if ever. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma

Re: Equivalent code to the bool() built-in function

2011-04-18 Thread John Nagle
s a bit array). C, which originally lacked a "bool" type, got it wrong. So did Python. Java is in the middle, with an isolated "boolean" type but a system that allows casts. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: optparse eats $

2011-04-19 Thread John Gordon
In tazz_ben writes: > So, any ideas? Why is including a $ eating both the dollar signa and the 1? Unix command lines tend to assume any $ inside double-quotes is a shell variable name. Try enclosing in single-quotes instead. -- John Gordon A is for Amy, who fell down

Re: Teaching Python

2011-04-19 Thread John Bokma
#x27;s an online book, free downloadable for both 2.x and 3.x -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl & Python Development: http://castleamber.com/

Groups in regular expressions don't repeat as expected

2011-04-20 Thread John Nagle
g/library/re.html "If a group is contained in a part of the pattern that matched multiple times, the last match is returned." That's kind of lame, though. I'd expect that there would be some way to retrieve all matches. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Groups in regular expressions don't repeat as expected

2011-04-20 Thread John Nagle
On 4/20/2011 12:23 PM, Neil Cerutti wrote: On 2011-04-20, John Nagle wrote: Here's something that surprised me about Python regular expressions. krex = re.compile(r"^([a-z])+$") s = "abcdef" ms = krex.match(s) ms.groups() ('f',) The parentheses indicate a

Re: Argument count mismatch

2011-04-21 Thread John Gordon
er of a class? The presence of the "self" parameter suggests that it is, but your code omits this detail. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gor

Re: Snowball to Python compiler

2011-04-21 Thread John Machin
On Friday, April 22, 2011 8:05:37 AM UTC+10, Matt Chaput wrote: > I'm looking for some code that will take a Snowball program and compile > it into a Python script. Or, less ideally, a Snowball interpreter > written in Python. > > (http://snowball.tartarus.org/) If anyone has done such things

Re: dictionary size changed during iteration

2011-04-21 Thread John Nagle
ys() does return a unique list. Each call to "keys()" returns a new list object unconnected to the dictionary from which the keys were extracted. But someone may have decided in a later version to return a generator, as an optimization. Did that happen?

Re: Groups in regular expressions don't repeat as expected

2011-04-24 Thread John Nagle
On 4/21/2011 6:16 AM, Neil Cerutti wrote: On 2011-04-20, John Nagle wrote: Findall does something a bit different. It returns a list of matches of the entire pattern, not repeats of groups within the pattern. Consider a regular expression for matching domain names: kre

Re: strange use of %s

2011-04-25 Thread John Nagle
E with wildcards at the beginning can't use indices. So this is very slow for large tables. Don't worry about having MySQL do the CONCAT. That happens once during query parsing here, because all the arguments to CONCAT are defined in the statement. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: De-tupleizing a list

2011-04-25 Thread John Connor
itertools can help you do this too: import itertools tl = [('0A',), ('1B',), ('2C',), ('3D',)] itertools.chain.from_iterable(tl) list(itertools.chain.from_iterable(tl)) ['0A', '1B', '2C', '3D'] Checkout http://docs.python.org/library/itertools.html#itertools.chain for more info. On Mon, Apr

Re: De-tupleizing a list

2011-04-27 Thread John Pinner
> ['0A', '1B', '2C', '3D',... > > -- Gnarlie If you want to handle a list of tuples where each tuple could have *more* than one element, one solution would be: >>> L = [(1, 2), (2, 3, 4), (5,), (6, 7, 8, 9, 0)] >>> tuple([ x for t in L for x in t ]) (1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 0) >>> John -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Composition instead of inheritance

2011-04-28 Thread John Nagle
uctors and ownership tend not to be too important in Python, because storage management is automatic. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: codec for UTF-8 with BOM

2011-05-02 Thread John Machin
On Monday, 2 May 2011 19:47:45 UTC+10, Chris Rebert wrote: > On Mon, May 2, 2011 at 1:34 AM, Ulrich Eckhardt > wrote: > The correct name, as you found below and as is corroborated by the > webpage, seems to be "utf_8_sig": > >>> u"FOøbar".encode('utf_8_sig') > '\xef\xbb\xbfFO\xc3\xb8bar' To com

Pushing for Pythoncard 1.0

2011-05-02 Thread John Henry
Attempt to push Pythoncard to a 1.0 status is now underway. A temporary website has been created at: http://code.google.com/p/pythoncard-1-0/ The official website continues to be http://pythoncard.sourceforge.net/ Pythoncard is such a wonderful package that it would be a shame to allow developm

Re: vertical ordering of functions

2011-05-03 Thread John Bokma
escribed by Guido van Rossum in > http://www.artima.com/weblogs/viewpost.jsp?thread=4829>. Thanks Ben, very useful link. -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl

Re: vertical ordering of functions

2011-05-04 Thread John Roth
order you write things doesn't matter, but there are cases where it really does matter. When it does, you have to have the definition before the use. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: What other languages use the same data model as Python?

2011-05-04 Thread John Nagle
er >>> 1 is (1+1-1) True >>> 10 is (10+1-1) False That's a quirk of CPython's boxed number implementation. All integers are boxed, but there's a set of canned objects for small integers. CPython's range for this is -5 to +256, incidentally. That's visible through the "is" operator. Arguably, it should not be. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: What other languages use the same data model as Python?

2011-05-04 Thread John Nagle
On 5/4/2011 5:46 PM, harrismh777 wrote: John Nagle wrote: Arguably, Python should not allow "is" or "id()" on immutable objects. The programmer shouldn't be able to tell when the system decides to optimize an immutable. "is" is more of a problem than "i

Re: What other languages use the same data model as Python?

2011-05-05 Thread John Nagle
On 5/5/2011 3:06 AM, Gregory Ewing wrote: John Nagle wrote: A reasonable compromise would be that "is" is treated as "==" on immutable objects. That wouldn't work for tuples, which can contain references to other objects that are not immutable. Such tuples are

Re: What other languages use the same data model as Python?

2011-05-05 Thread John Nagle
On 5/5/2011 6:59 AM, Steven D'Aprano wrote: On Thu, 05 May 2011 21:48:20 +1000, Chris Angelico wrote: On Thu, May 5, 2011 at 9:44 PM, Mel wrote: John Nagle wrote: On 5/4/2011 5:46 PM, harrismh777 wrote: Or, as stated earlier, Python should not allow 'is' on immutable ob

Re: Hello Friends

2011-05-06 Thread John Bokma
Since you just repeated the spamvertized URL... -- John Bokma j3b Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma Freelance Perl & Python Development: http://castleamber.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3: imports don't see files from same directory?

2011-05-07 Thread John O'Hagan
On Sat, 7 May 2011, Ian Kelly wrote: [...] > > Implicit relative imports were removed in Python 3 to prevent > ambiguity as the number of packages grows. See PEP 328. > > If you have two modules in the same package, pack1.mod1 and > pack1.mod2, then in pack1.mod1 you can no longer just do "impor

codecs.open() doesn't handle platform-specific line terminator

2011-05-09 Thread John Machin
According to the 3.2 docs (http://docs.python.org/py3k/library/codecs.html#codecs.open), """Files are always opened in binary mode, even if no binary mode was specified. This is done to avoid data loss due to encodings using 8-bit values. This means that no automatic conversion of b'\n' is done on

Re: unicode by default

2011-05-11 Thread John Machin
On Thu, May 12, 2011 8:51 am, harrismh777 wrote: > Is it true that if I am > working without using bytes sequences that I will not need to care about > the encoding anyway, unless of course I need to specify a unicode code > point? Quite the contrary. (1) You cannot work without using bytes seque

Re: urllib2 request with binary file as payload

2011-05-11 Thread John Machin
On Thu, May 12, 2011 10:20 am, Michiel Sikma wrote: > Hi there, > I made a small script implementing a part of Youtube's API that allows > you to upload videos. It's pretty straightforward and uses urllib2. > The script was written for Python 2.6, but the server I'm going to use > it on only has 2.

Re: unicode by default

2011-05-11 Thread John Machin
On Thu, May 12, 2011 11:22 am, harrismh777 wrote: > John Machin wrote: >> (1) You cannot work without using bytes sequences. Files are byte >> sequences. Web communication is in bytes. You need to (know / assume / >> be >> able to extract / guess) the input encodi

Re: unicode by default

2011-05-11 Thread John Machin
On Thu, May 12, 2011 1:44 pm, harrismh777 wrote: > By > default it looks like Python3 is writing output with UTF-8 as default... > and I thought that by default Python3 was using either UTF-16 or UTF-32. > So, I'm confused here... also, I used the character sequence \u00A3 > which I thought was UT

Re: unicode by default

2011-05-11 Thread John Machin
On Thu, May 12, 2011 2:14 pm, Benjamin Kaplan wrote: > > If the file you're writing to doesn't specify an encoding, Python will > default to locale.getdefaultencoding(), No such attribute. Perhaps you mean locale.getpreferredencoding() -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Developers with 5 years of experience

2011-05-12 Thread John Nagle
58, CGE Colony First Street Tuticorin - 628003 Tamilnadu Phone no: 91 461 4005333 / 3290473 Fax No: 91 461 4001473 Email : cont...@jjcpl.net John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: unicode by default

2011-05-12 Thread John Machin
On Thu, May 12, 2011 4:31 pm, harrismh777 wrote: > > So, the UTF-16 UTF-32 is INTERNAL only, for Python NO. See one of my previous messages. UTF-16 and UTF-32, like UTF-8 are encodings for the EXTERNAL representation of Unicode characters in byte streams. > I also was not aware that UTF-8 chars

Re: How best to convert a string "list" to a python list

2011-05-13 Thread John Posner
op, offend you? You can get rid of it by modifying the original string: x = "red;blue;green;yellow" x += ";" Now, the final component of the string is no longer a special case, but is terminated by ";" -- just like all the other components. HTH, John -- http://mail.python.org/mailman/listinfo/python-list

Ed hardy, (tshirt$13, swim strunk$25, jean$30, handbag$34, cap$13, sunglass$12, shoes$25), Nike shoes:$32, Handbag:$35, NFL:$20, jean:$30, air force one shoes, lv, gucci, D&G, bbc, coachUGG boot:$50

2011-05-17 Thread john kode
Get Nike Shoes at Super Cheap Prices Discount Ed hardy tshirt (www.dmuch.com) Discount Ed hardy swimming suit (www.dmuch.com) Discount Ed hardy jean (www.dmuch.com) Discount Ed hardy shoes (www.dmuch.com) Discount Ed hardy handbag (www.dmuch.com) Discount Ed hardy other porduct (www.dmuch.com)

Re: obviscating python code for distribution

2011-05-18 Thread John Bokma
o understand that no server is ever secure and hence one must always be prepared that a breach can happen. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnb

Re: English Idiom in Unix: Directory Recursively

2011-05-18 Thread John Nagle
folder", or "subdirectory". John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2011-05-18 Thread John Nagle
hould not be used in production code. Generalizing multiple inheritance from a tree to a directed acyclic graph is usually a mistake. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Abandoning Python

2011-05-21 Thread John Bokma
John J Lee writes: > > > I still like Python after using it for over a decade, but there are > things I don't like. > > What are your favourite up-and-coming languages of the moment? > > Here's my wishlist (not really in any order): > > * A widel

Re: hash values and equality

2011-05-21 Thread John Nagle
of a lack that Python doesn't have user-defined immutable objects. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Multiprocessing: don't push the pedal to the metal?

2011-05-21 Thread John Ladasky
Hello again, everyone. I'm developing some custom neural network code. I'm using Python 2.6, Numpy 1.5, and Ubuntu Linux 10.10. I have an AMD 1090T six-core CPU. About six weeks ago, I asked some questions about multiprocessing in Python, and I got some very helpful responses from you all. ht

Re: Abandoning Python

2011-05-22 Thread John Lee
u wish. Right? You imagine it's an > easy task, so get after it. [...] Is it possible that my calling it an easy task was a joke? Honestly, I'd thought it safe with that one to leave out the smiley -- but then I've been away from newsgroups for quite a while! John -- http://m

Re: Abandoning Python

2011-05-22 Thread John Lee
Dan Stromberg gmail.com> writes: > On Sat, May 21, 2011 at 8:49 AM, John J Lee pobox.com> wrote: > > I still like Python after using it for over a decade, but there are > things I don't like. > What are your favourite up-and-coming languages of the moment? > Here

Re: List of WindowsError error codes and meanings

2011-05-22 Thread John Lee
disadvantage that with those calls, you'd have to deal with a mixture of Windows and UNIXy error codes. The presence of .errno, aside from being required (to satisfy LSP), does mean you don't have to deal with the Windows codes if you're only interested in cases covered by module errno. John -- http://mail.python.org/mailman/listinfo/python-list

Re: Abandoning Python

2011-05-22 Thread John Lee
Stefan Behnel behnel.de> writes: > > John J Lee, 22.05.2011 17:58: > > Daniel Kluev writes: > >> Also, most of these complaints could be solved by using correct python > >> dialect for particular task - RPython, Cython and so on. > > > > Diffe

Re: Abandoning Python

2011-05-22 Thread John Lee
on refactoring tools until everybody starts shouting that they're reliable and useful (because it seems like a hard problem to solve, so I guess most implementations will be more trouble than they're worth). John -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing: don't push the pedal to the metal?

2011-05-22 Thread John Ladasky
Following up to my own post... Flickr informs me that quite a few of you have been looking at my graphs of performance vs. the number of sub-processes employed in a parallelizable task: On May 21, 8:58 pm, John Ladasky wrote: > http://www.flickr.com/photos/15579975@N00/5744093219 [...] >

Re: Abandoning Python

2011-05-22 Thread John Lee
hon itself)? What's interesting, widely applicable, and new(ish)? Falcon fails my personal book-by-its-cover test. There are too many languages to do without that test, unfortunately. John -- http://mail.python.org/mailman/listinfo/python-list

Re: Abandoning Python

2011-05-22 Thread John Lee
John Lee pobox.com> writes: [...] > That's interesting, thanks. I see this is a different pylint than the old > logilab pylint. Unfortunate choice of name, since it makes it hard to find > IDE integration work that's already done. Hmm, I see the last release was in 2003

Re: Why did Quora choose Python for its development?

2011-05-22 Thread John Bokma
er that dict(). my %hash = @list_of_key_value_pairs; -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.com/perl/help-in-exchange-for-books.h

Re: Why did Quora choose Python for its development?

2011-05-23 Thread John Bokma
e an editor that can with a single command comment out a selection (and revert this), like Emacs. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://castleamber.com/ Perl for books:http://johnbokma.co

Re: Multiprocessing: don't push the pedal to the metal?

2011-05-23 Thread John Ladasky
On May 23, 2:50 am, Adam Tauno Williams wrote: > I develop an app that uses multiprocessing heavily.  Remember that all > these processes are processes - so you can use all the OS facilities > regarding processes on them.  This includes setting nice values, > schedular options, CPU pinning, etc..

Re: Why did Quora choose Python for its development?

2011-05-23 Thread John Bokma
"Octavian Rasnita" writes: > From: "Daniel Kluev" > a = [1,2] > dict([a]) > > Yes, but > > d = dict([a]) > > is not so nice as > > $d = @a; That will give you the number of elements in @a. What y

Re: Why did Quora choose Python for its development?

2011-05-24 Thread John Bokma
't actually care that much about these > things. Wise words. And I agree. To me Python vs. Perl has nothing to do with being a fanboy (unlike many other posters here). I like both languages, I have invested a lot of time in learning Python and I am really not dense. Yet, even though I can

Re: Why did Quora choose Python for its development?

2011-05-24 Thread John Bokma
"D'Arcy J.M. Cain" writes: > On Tue, 24 May 2011 00:17:55 -0500 > John Bokma wrote: >> > $d = @a; >> >> That will give you the number of elements in @a. What you (probably) >> mean is %hash = @array; > > If I was even considering using Pe

Re: Why did Quora choose Python for its development?

2011-05-24 Thread John Bokma
Chris Angelico writes: > On Wed, May 25, 2011 at 2:50 AM, John Bokma wrote: >> Wise words. And I agree. To me Python vs. Perl has nothing to do with >> being a fanboy (unlike many other posters here). I like both languages, >> I have invested a lot of time in learning Pytho

Re: Why did Quora choose Python for its development?

2011-05-24 Thread John Bokma
"D'Arcy J.M. Cain" writes: > On Tue, 24 May 2011 11:52:39 -0500 > John Bokma wrote: >> >> > $d = @a; >> >> >> >> That will give you the number of elements in @a. What you (probably) >> >> mean is %hash = @array; >>

Re: Why did Quora choose Python for its development?

2011-05-24 Thread John Bokma
Chris Angelico writes: > On Wed, May 25, 2011 at 3:56 AM, John Bokma wrote: >> Chris Angelico writes: >>> To me, a language is a tool. >> >> To me, and to a lot of Perl programmers it's not different. >> >>> The more tools you have competence w

Re: Why did Quora choose Python for its development?

2011-05-24 Thread John Bokma
n use $OUTPUT_AUTOFLUSH (use English;), or use IO::Handle and use the autoflush method [2]. [2] In Perl 5.14 IO::File is now loaded on demand: http://search.cpan.org/dist/perl/pod/perldelta.pod#Filehandle_method_calls_load_IO::File_on_demand -- John Bokma

Re: Why did Quora choose Python for its development?

2011-05-24 Thread John Bokma
Chris Angelico writes: > On Wed, May 25, 2011 at 9:16 AM, John Bokma wrote: >> Chris Angelico writes: >> >>> Yes, I believe that was Perl. And an amusing quote. But most of the >>> point of it comes from the fact that Perl uses punctuation for most of &g

Re: Why did Quora choose Python for its development?

2011-05-25 Thread John Bokma
Dennis Lee Bieber writes: > Python books than after six months of trying to understand PERL... And Perl is the language, and perl is what runs Perl. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: h

Re: Why did Quora choose Python for its development?

2011-05-25 Thread John Bokma
with. To people used to the latin alphabet languages using a different script are unreadable. So readability has a lot to do with what one is used to. Like I already stated before: if Python is really so much better than Python readability wise, why do I have such a hard time dropping Perl and movin

Re: Why did Quora choose Python for its development?

2011-05-25 Thread John Bokma
Ethan Furman writes: > Terry Reedy wrote: >> On 5/25/2011 8:01 AM, John Bokma wrote: >> >>> to. Like I already stated before: if Python is really so much better >>> than Python readability wise, why do I have such a hard time dropping >>> Perl and moving

Re: Why did Quora choose Python for its development?

2011-05-25 Thread John Bokma
Steven D'Aprano writes: > On Wed, 25 May 2011 07:01:07 -0500, John Bokma wrote: > >> if Python is really so much better than Python [Perl] >> readability wise, why do I have such a hard time dropping >> Perl and moving on? > > My guess is that you have an adv

Re: Why did Quora choose Python for its development?

2011-05-26 Thread John Bokma
Please desist. You should have spoken up sooner, especially as the spokes person of "this" community. But every bully has is fan club. -- John Bokma j3b Blog: http://johnbokma.com/Perl Consultancy: http://cas

Re: Newbie question about SQLite + Python and twitter

2011-05-26 Thread John Nagle
writing a spam program for Twitter. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Puzzled by list-appending behavior

2011-05-26 Thread John Ladasky
On May 25, 9:46 pm, Uncle Ben wrote: > list = [1,2,3] Somewhat unrelated, but... is it a good idea to name your list "list"? Isn't that the name of Python's built-in list constructor method? Shadowing a built-in has contributed to more than one subtle bug in my code, and I've learned to avoid

Re: Python's super() considered super!

2011-05-27 Thread John Nagle
lue. That's the kind of thinking which leads to [1,2] * 2 returning [1,2,1,2] John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: GIL in alternative implementations

2011-05-28 Thread John Nagle
ng if there's a pointer to it anywhere. This was all worked out for LISP and SELF decades ago. Python allows patching code while the code is executing. This implies a sizable performance penalty, and causes incredible complexity in PyPy. John Nagle

Re: float("nan") in set or as key

2011-05-28 Thread John Nagle
not (a == b) a != b will always return the same results if exceptions are raised for unordered comparison results. Also, exactly one of a = b a < b a > b is always true - something sorts tend to assume. If you get an unordered comparison exception,

Re: Weird problem matching with REs

2011-05-29 Thread John S
to *not* put whitespace in the middle of a URL... As Steven said, when you want match a dot, it needs to be escaped, although it will work by accident much of the time. Also, be sure to use a raw string when composing REs, so you don't run into backslash issues. HTH, John Strickler -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird problem matching with REs

2011-05-29 Thread John S
by the Python interpreter. This was just a general warning to anyone working with REs. It didn't apply in this case. --john strickler -- http://mail.python.org/mailman/listinfo/python-list

Re: float("nan") in set or as key

2011-05-29 Thread John Nagle
idn't overflow somewhere during the computation. If, within the computation, there are branches based on ordered comparisons, and those don't raise an exception when the comparison result is unordered, you can reach the end of the computation with valid-looking but wrong values.

python in school notebooks/laptops

2011-05-30 Thread John Thornton
Hello Is it a waste of time to try to get school admins to put python in their school laptops? OK. Here's the crib for the rest[!] of the world. Here in Australia most secondary schools [that is kids from age approx 12-18] have some sort of netbook/laptop program. I have looked at a

Re: python in school notebooks/laptops

2011-05-30 Thread John Thornton
. *** Gimp? Python? Linux? Inkscape? Blender? That software may as well be on the moon. [sobs into beer...oh well, at least they get to buy anti-virus gear...:)] John On Mon, May 30, 2011 at 9:09 PM, hackingKK wrote: > > On 30/05/11 15:45, John Thornton wrote: > >> Hello >>

feedparser hanging after I/O error

2011-06-01 Thread John Nagle
thon 2.6.3.7 (ActiveState) on Linux, on an EeePC 2G Surf. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: float("nan") in set or as key

2011-06-02 Thread John Nagle
st mode"; the latter doesn't support FPU exceptions but does support NaNs. Many game machines and GPUs don't have full IEEE floating point. Some don't have exceptions. Others don't have full INF/NaN semantics. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: My Issues

2017-09-13 Thread John Ladasky
On Wednesday, September 13, 2017 at 2:37:48 PM UTC-7, iv...@linebox.ca wrote: > Hi Carson, > > If you are having big troubles installing Python on Windows (it really should > be a click install from the Python download page here > https://www.python.org/downloads/) you can use Anaconda to instal

Re: Old Man Yells At Cloud

2017-09-16 Thread John Pote
On 16/09/2017 19:00, Stefan Ram wrote: Steve D'Aprano writes: "Hi, I've been programming in Python for what seems like days now, and here's all the things that you guys are doing wrong. I never ever have written a line of Python 2. I started with Python 3.6.0. Yet a very frequent mista

Re: Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"

2017-09-18 Thread John Ladasky
On Saturday, September 16, 2017 at 11:01:03 PM UTC-7, Terry Reedy wrote: > On 9/16/2017 7:04 PM, b...@g...com wrote: > The particular crippler for CLBG problems is the non-use of numpy in > numerical calculations, such as the n-body problem. Numerical python > extensions are over two decades ol

Stdlib, what's in, what's out (was: "Energy Efficiency across Programming Languages")

2017-09-18 Thread John Ladasky
On Monday, September 18, 2017 at 5:13:58 PM UTC-7, MRAB wrote: > On 2017-09-18 23:08, b...@g...com wrote: > > My rationale is simple, the authors of the libraries are not tied into the > > (c)Python release cycle, the PEP process or anything else, they can just > > get on with it. > > > > Consi

Re: Stdlib, what's in, what's out

2017-09-19 Thread John Ladasky
On Tuesday, September 19, 2017 at 1:05:51 AM UTC-7, Stefan Behnel wrote: > John Ladasky schrieb am 19.09.2017 um 08:54: > > I have come to understand from your other posts that adding something to > > the stdlib imposes significant constraints on the release schedules of > >

errors with json.loads

2017-09-20 Thread john polo
\..\python\python36\lib\json\decoder.py in raw_decode(self, s, idx)     353 """     354 try: --> 355 obj, end = self.scan_once(s, idx)     356 except StopIteration as err:     357 raise JSONDecodeError("Expecting value", s, err.value) from None JSONDecodeError: Expecting ':' delimiter: line 5 column 50 (char 161) ?json.loads says that the method is for deserializing "s", with "s" being a string, bytes, or bytearray. In [24]: type(text) Out[24]: str So "text" seems to be a string. Why does json.loads return an error? John -- https://mail.python.org/mailman/listinfo/python-list

Re: errors with json.loads

2017-09-20 Thread John Gordon
In john polo writes: > JSONDecodeError: Expecting ':' delimiter: line 5 column 50 (char 161) > ?json.loads says that the method is for deserializing "s", with "s" > being a string, bytes, or bytearray. > In [24]: type(text) > Out[24]: st

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/20/2017 5:56 PM, John Gordon wrote: In john polo writes: JSONDecodeError: Expecting ':' delimiter: line 5 column 50 (char 161) ?json.loads says that the method is for deserializing "s", with "s" being a string, bytes, or bytearray. In [24]: type(text) Out[

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/20/2017 5:58 PM, Bill wrote: Interesting problem, John. I have probably even less experience with json than you do, so I'm taking this as an opportunity to learn with you. Suggestions: 1. Try your example with Python 2 rather than Python 3. Bill, Thanks for the reply. I wasn&#

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/20/2017 6:40 PM, Dennis Lee Bieber wrote: On Wed, 20 Sep 2017 17:13:41 -0500, john polo declaimed the following: and the example code for reading the file is: file = open('books.json','r') What encoding is the file? I did a cut&paste from your p

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/21/2017 4:24 AM, Thomas Jollans wrote: It looks to me like the root cause of the problem was that they copied the code from a web page, and the web page contained invalid JSON. Thank you, Thomas. John -- https://mail.python.org/mailman/listinfo/python-list

Re: Re: errors with json.loads

2017-09-21 Thread john polo
st for not catching that sooner. John -- https://mail.python.org/mailman/listinfo/python-list

TypeError with map with no len()

2017-09-25 Thread john polo
t it appears to be empty. Am I misunderstanding map()? Is there something else I should be doing instead to populate y1? John -- https://mail.python.org/mailman/listinfo/python-list

Re: TypeError with map with no len()

2017-09-25 Thread john polo
n that. Paul Paul, Thank you very much for the explanation. best regards, John -- https://mail.python.org/mailman/listinfo/python-list

<    3   4   5   6   7   8   9   10   11   12   >