Bug reports [was Re: Python list code of conduct]

2013-07-02 Thread Steven D'Aprano
On Tue, 02 Jul 2013 19:46:13 -0400, Roy Smith wrote: > In article , > Ned Deily wrote: > >> If you find a bug in Python, don't send it to comp.lang.python; file a >> bug report in the issue tracker. > > I'm not sure I agree with that one, at least not fully. It's certainly > true that you sho

Re: python adds an extra half space when reading from a string or list

2013-07-02 Thread Steven D'Aprano
On Tue, 02 Jul 2013 17:30:32 -0700, rurpy wrote: >> Needless to say, I disagree with your position. There is no place for >> baseless insults in this community; but when the behaviour of someone >> in this community is harmful, then it is entirely appropriate to use >> clear terms (e.g. “incompete

Re: How to tell Script to use pythonw.exe ?

2013-07-02 Thread Steven D'Aprano
On Tue, 02 Jul 2013 18:20:12 -0700, goldtech wrote: > Hi, > > Using Windows > > I want to run a .py file script using pythonw.exe so the DOS box will > not open. Is there a way from inside the script to say "run me with > pythonw.exe and not python.exe"? I don't believe so, because by the t

OT Plague [was Re: python adds an extra half space when reading from a string or list]

2013-07-02 Thread Steven D'Aprano
On Tue, 02 Jul 2013 06:48:59 -0700, rusi wrote: > A plague is raging in the town > A rat scampers into the room. > People are harried --- A RAT! [...] Very imaginative, but your characterisation of people's responses to the plague rat appears to have very little in common with the actual respon

Re: Python list code of conduct

2013-07-02 Thread Steven D'Aprano
On Wed, 03 Jul 2013 08:39:59 +1000, Ben Finney wrote: > Steve Simmons writes: >> Does this list have a code of conduct or a netiqeutte (sp?) >> statement/requirement? > > This forum (both a Usenet newsgroup and a mailing list) is part of the > Python community. So the “Python Community Code of C

Why is CPython 2.5 a dependency for Jython 2.5?

2013-07-03 Thread Steven D'Aprano
I'm running a box with Debian squeeze, and I just ran: sudo aptitude install jython which ended up installing Python 2.5: [...] Linking and byte-compiling packages for runtime python2.5... Setting up python2.5 (2.5.5-11) ... Does anyone know why CPython 2.5 is a dependency for Jython 2.5.1+ on

Re: Why is CPython 2.5 a dependency for Jython 2.5?

2013-07-03 Thread Steven D'Aprano
On Wed, 03 Jul 2013 07:43:46 -0500, Skip Montanaro wrote: >> Does anyone know why CPython 2.5 is a dependency for Jython 2.5.1+ on >> Debian squeeze? > > Might Jython use some Python modules/packages unmodified? Does sys.path > in Jython refer to the CPython tree? Apparently not: >>> sys.path

Re: DOS or not? [was Re: How to tell Script to use pythonw.exe ?]

2013-07-03 Thread Steven D'Aprano
On Wed, 03 Jul 2013 14:00:49 +0100, Tim Golden wrote: > Goodness, I doubt if you'll find anyone who can seriously make a case > that the Windows command prompt is all it might be. I'm not a Powershell > user myself but people speak highly of it. I understand that Powershell is aimed more for batc

[SPOILERS] Python easter eggs

2013-07-03 Thread Steven D'Aprano
Most people are familiar with: import this and sometimes even with: from __future__ import braces But I'm aware of at least three more. Anyone care to give them? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: [SPOILERS] Python easter eggs

2013-07-03 Thread Steven D'Aprano
On Wed, 03 Jul 2013 10:15:22 -0600, Ian Kelly wrote: > And in Jython there's: > > from __future__ import GIL Nice one! I didn't know about that! -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Python list code of conduct

2013-07-03 Thread Steven D'Aprano
On Wed, 03 Jul 2013 10:10:17 -0400, Roy Smith wrote: > In article , > Terry Reedy wrote: > >> 6. If you make an informed post to the tracker backed up by at least >> opinion, at least one tracker responder be in a better mode when >> responding. > > What I generally do is summarize the problem

Re: python adds an extra half space when reading from a string or list

2013-07-03 Thread Steven D'Aprano
On Wed, 03 Jul 2013 11:08:11 -0700, rusi wrote: > And when Nikos moves up from petty criminal status to responsible > citizen, "Petty criminal status"? /headdesk -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: python adds an extra half space when reading from a string or list

2013-07-03 Thread Steven D'Aprano
On Wed, 03 Jul 2013 12:18:58 -0700, rurpy wrote: > On 07/03/2013 12:08 PM, rusi wrote: >> On Wednesday, July 3, 2013 10:31:23 PM UTC+5:30, ru...@yahoo.com wrote: >>> Are the existence of laws against beating people up negated because >>> you told them in advance? Or negated because they "deserve"

Default scope of variables

2013-07-03 Thread Steven D'Aprano
Recently, there was a thread where people discussed variable declarations, with a couple people stating that they wished that Python required you to declare local variables, instead of globals. I'm sure they have their (foolish, pathetic) *wink* reasons for this, but I thought I'd explain why I

Re: Default scope of variables

2013-07-03 Thread Steven D'Aprano
On Thu, 04 Jul 2013 14:07:55 +1000, Chris Angelico wrote: > On Thu, Jul 4, 2013 at 1:27 PM, Steven D'Aprano > wrote: >> With respect to the Huffman coding of declarations, Javascript gets it >> backwards. Locals ought to be more common, but they require more >> typ

Re: Default scope of variables

2013-07-03 Thread Steven D'Aprano
On Thu, 04 Jul 2013 05:30:03 +0100, Joshua Landau wrote: > That said, I'm not too convinced. Personally, the proper way to do what > you are talking about is creating a new closure. Like: > > for i in range(100): > with new_scope(): > for i in range(100): > func(i) > f

Re: Important features for editors

2013-07-04 Thread Steven D'Aprano
On Thu, 04 Jul 2013 12:01:26 +0100, Robert Kern wrote: > On 2013-07-04 10:14, Νίκος wrote: > >> If you guys want to use it i can send you a patch for it. I know its >> illegal thing to say but it will help you use it without buying it. > > Please do not use this forum to make such offers. Than

Re: Important features for editors

2013-07-04 Thread Steven D'Aprano
On Thu, 04 Jul 2013 07:02:26 -0700, rusi wrote: > On Thursday, July 4, 2013 7:03:19 PM UTC+5:30, Steve Simmons wrote: >> Boy oh boy! You really are a slow learner Nicos. You have just offered >> to commit a crime and to include dozens of others in that crime ON A >> PUBLIC FORUM. Please think befo

Re: Default scope of variables

2013-07-04 Thread Steven D'Aprano
On Thu, 04 Jul 2013 03:06:25 -0400, Dave Angel wrote: > On 07/04/2013 01:32 AM, Steven D'Aprano wrote: >> > >> >> Well, if I ever have more than 63,000,000 variables[1] in a function, >> I'll keep that in mind. >> > >> >&g

Re: Default scope of variables

2013-07-04 Thread Steven D'Aprano
On Thu, 04 Jul 2013 15:47:57 +1000, Chris Angelico wrote: > On Thu, Jul 4, 2013 at 3:32 PM, Steven D'Aprano > wrote: >> Accidental shadowing can be a problem, but I've never heard of anyone >> saying that they were *forced* to shadow a global they needed access >&

Re: Default scope of variables

2013-07-04 Thread Steven D'Aprano
On Thu, 04 Jul 2013 17:54:20 +0100, Rotwang wrote: [...] > Anyway, none of the calculations that has been given takes into account > the fact that names can be /less/ than one million characters long. Not in *my* code they don't!!! *wink* > The > actual number of non-empty strings of length a

Re: How is this evaluated

2013-07-04 Thread Steven D'Aprano
On Thu, 04 Jul 2013 10:20:43 -0700, Arturo B wrote: > I'm making this exercise: (Python 3.3) > > Write a function translate() that will translate a text into > "rövarspråket" (Swedish for "robber's language"). That is, double every > consonant and place an occurrence of "o" in between. For exampl

Re: How is this evaluated

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 17:05:49 +1000, Chris Angelico wrote: > On Fri, Jul 5, 2013 at 11:41 AM, Steven D'Aprano > wrote: >> If you know C, that's like: >> >> ?(condition-being-tested, value-if-true, value-if-false) > > Or to be precise: > > con

Re: question please

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 09:48:09 +0200, bill papanastasiou wrote: > hello , good morning > > how i can pùt one python file in website ? The same way you would put any other file in a website. Can you be more specific? What website do you want to put it on? Is it your website or somebody else's?

Re: How to make this faster

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 10:53:35 +, Helmut Jarausch wrote: > Since I don't do any numerical stuff with the arrays, Numpy doesn't seem > to be a good choice. I think this is an argument to add real arrays to > Python. Guido's time machine strikes again: import array By the way, I'm not exactly

Re: How to make this faster

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 14:54:26 +, Helmut Jarausch wrote: > On Fri, 05 Jul 2013 13:44:57 +0100, Fábio Santos wrote: May I suggest > you avoid range and use enumerate(the_array) instead? It might be > faster. > > How does this work? > > Given > > Grid= [[0 for j in range(9)] for i in range(9)]

Re: How to make this faster

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 16:07:03 +, Helmut Jarausch wrote: > The solution above take 0.79 seconds (mean of 100 calls) while the > following version take 1.05 seconds (mean of 100 calls): 1) How are you timing the calls? 2) Don't use the mean, that's the wrong statistic when you are measuring so

Re: How to make this faster

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 15:47:45 +, Helmut Jarausch wrote: > > for r, row_lst in enumerate(Grid): > > for c, val in enumerate(row_lst): > > I assume the creation of the temporary lists "row_list" is a bit > expensive. No temporary list is being created. The pre-existing list is just being gr

How to check for threads being finished?

2013-07-05 Thread Steven D'Aprano
I have a pool of worker threads, created like this: threads = [MyThread(*args) for i in range(numthreads)] for t in threads: t.start() I then block until the threads are all done: while any(t.isAlive() for t in threads): pass Is that the right way to wait for the threads to be done? S

Re: How to check for threads being finished?

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 19:12:44 +0200, Irmen de Jong wrote: > On 5-7-2013 18:59, Steven D'Aprano wrote: >> I then block until the threads are all done: >> >> while any(t.isAlive() for t in threads): >> pass >> >> >> Is that the right way to wa

Re: How to make this faster

2013-07-05 Thread Steven D'Aprano
On Fri, 05 Jul 2013 18:39:15 +, Helmut Jarausch wrote: > On Fri, 05 Jul 2013 16:50:41 +0000, Steven D'Aprano wrote: > >> On Fri, 05 Jul 2013 16:07:03 +, Helmut Jarausch wrote: >> >>> The solution above take 0.79 seconds (mean of 100 calls) while the

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

2013-07-06 Thread Steven D'Aprano
On Sat, 06 Jul 2013 09:10:39 -0500, Skip Montanaro wrote: >> The fact that rms has crippling RSI should indicate that emacs' >> ergonomics is not right. > > Kind of a small sample size, don't you think? Yes, but RMS is worth 1000 ordinary programmers!!! *wink* [...] > More likely, rms ignore

Numeric coercions

2013-07-06 Thread Steven D'Aprano
I sometimes find myself needing to promote[1] arbitrary numbers (Decimals, Fractions, ints) to floats. E.g. I might say: numbers = [float(num) for num in numbers] or if you prefer: numbers = map(float, numbers) The problem with this is that if a string somehow gets into the original numbers,

Re: Numeric coercions

2013-07-06 Thread Steven D'Aprano
On Sun, 07 Jul 2013 05:17:01 +0100, Joshua Landau wrote: > On 7 July 2013 04:56, Steven D'Aprano > wrote: ... >> def promote(x): >> if isinstance(x, str): raise TypeError return float(x) >>>> from operator import methodcaller >>>> safe_fl

Re: Default scope of variables

2013-07-07 Thread Steven D'Aprano
On Sun, 07 Jul 2013 23:43:24 +1000, Chris Angelico wrote: > On Sun, Jul 7, 2013 at 11:13 PM, Wayne Werner > wrote: >> Which you would then use like: >> >> >> conn = create_conn() >> with new_transaction(conn) as tran: >> rows_affected = do_query_stuff(tran) >> if rows_affected == 42: >>

Re: Default scope of variables

2013-07-07 Thread Steven D'Aprano
On Fri, 05 Jul 2013 13:24:43 +, Neil Cerutti wrote: > for x in range(4): >print(x) > print(x) # Vader NOoOO!!! That loops do *not* introduce a new scope is a feature, not a bug. It is *really* useful to be able to use the value of x after the loop has finished. That's a much mor

Re: Default scope of variables

2013-07-07 Thread Steven D'Aprano
On Mon, 08 Jul 2013 10:48:03 +1000, Chris Angelico wrote: [...] > That means that I, as programmer, have to keep track of the nesting > level of subtransactions. Extremely ugly. A line of code can't be moved > around without first checking which transaction object to work with. I feel your pain, b

Re: Default scope of variables

2013-07-07 Thread Steven D'Aprano
On Mon, 08 Jul 2013 13:11:37 +1000, Chris Angelico wrote: > On Mon, Jul 8, 2013 at 12:23 PM, Steven D'Aprano > wrote: >> On Mon, 08 Jul 2013 10:48:03 +1000, Chris Angelico wrote: [...] >>> That means that I, as programmer, have to keep track of the nesting >>>

Re: hex dump w/ or w/out utf-8 chars

2013-07-07 Thread Steven D'Aprano
On Sun, 07 Jul 2013 17:22:26 -0700, blatt wrote: > Hi all, > but a particular hello to Chris Angelino which with their critics and > suggestions pushed me to make a full revision of my application on hex > dump in presence of utf-8 chars. I don't understand what you are trying to say. All charact

Re: Important features for editors

2013-07-07 Thread Steven D'Aprano
On Sun, 07 Jul 2013 23:16:39 -0700, jussij wrote: > I couldn't live without the keyboard macro record and playback. I used to work with a programmer who couldn't live without his insulin injections. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

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

2013-07-08 Thread Steven D'Aprano
On Sun, 07 Jul 2013 22:34:46 -0700, jussij wrote: > On Sunday, July 7, 2013 12:41:02 PM UTC+10, Steven D'Aprano wrote: > >> I am not an ergonomic expert, but I understand that moving from mouse >> to keyboard actually helps prevent RSI, because it slows down the rate &g

Re: A small question about PEP 8

2013-07-08 Thread Steven D'Aprano
On Mon, 08 Jul 2013 07:32:01 +0800, Xue Fuqiao wrote: > Hi all, > > (English is not my native language; please excuse typing errors.) > > I'm a Python newbie and just started reading PEP 8. PEP says: > > --- > |The closing bra

Re: A small question about PEP 8

2013-07-08 Thread Steven D'Aprano
On Mon, 08 Jul 2013 11:39:21 +0100, Joshua Landau wrote: > On 8 July 2013 00:32, Xue Fuqiao wrote: >> Hi all, >> >> (English is not my native language; please excuse typing errors.) >> >> I'm a Python newbie and just started reading PEP 8. PEP says: >> >>

Re: ipython

2013-07-08 Thread Steven D'Aprano
On Mon, 08 Jul 2013 07:44:11 -0700, davide.dalmasso wrote: > Hi, I work with Python 3.3. > I downloaded an IPython executable version from > http://www.lfd.uci.edu/~gohlke/pythonlibs/ I installed it but no > shortcut appears in my start menu. How can I launch it or alternatively > is there some ot

Re: looking for a new router

2013-07-08 Thread Steven D'Aprano
On Mon, 08 Jul 2013 21:52:19 -0700, saadharana wrote: > Hey i'm looking for a new router. I recommend this one: http://www.bunnings.com.au/products_product_1350w-aeg-12-router-rt1350e_P6230066.aspx Helpfully-as-ever-ly yrs, -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: hex dump w/ or w/out utf-8 chars

2013-07-08 Thread Steven D'Aprano
On Tue, 09 Jul 2013 00:32:00 +0100, MRAB wrote: > On 08/07/2013 23:02, Joshua Landau wrote: >> On 8 July 2013 22:38, MRAB wrote: >>> On 08/07/2013 21:56, Dave Angel wrote: Characters do not have a width. >>> >>> [snip] >>> >>> It depends what you mean by "width"! :-) >>> >>> Try this (Python

Re: hex dump w/ or w/out utf-8 chars

2013-07-08 Thread Steven D'Aprano
On Tue, 09 Jul 2013 07:49:45 +1000, Chris Angelico wrote: > On Tue, Jul 9, 2013 at 6:56 AM, Dave Angel wrote: >> But Unicode has nothing to do with Guido, and it has existed for about >> 25 years (if I recall correctly). > > Depends how you measure. According to [1], the work kinda began back >

Re: hex dump w/ or w/out utf-8 chars

2013-07-09 Thread Steven D'Aprano
On Mon, 08 Jul 2013 10:53:18 -0700, ferdy.blatsco wrote: > Not using python 3, for me (a programmer which was present at the > beginning of computer science, badly interacting with many languages > from assembler to Fortran and from c to Pascal and so on) it was an hard > job to arrange the abrupt

Re: hex dump w/ or w/out utf-8 chars

2013-07-09 Thread Steven D'Aprano
On Tue, 09 Jul 2013 12:15:29 +0200, Chris “Kwpolska” Warrick wrote: > On Tue, Jul 9, 2013 at 11:34 AM, wrote: >> Note the difference between SS and ẞ 'FRANZ-JOSEF-STRAUSS-STRAẞE' > > This is a capital Eszett. Which just happens not to exist in German. > Germans do not use this character, it is

Re: Stack Overflow moderator “animuson”

2013-07-10 Thread Steven D'Aprano
On Wed, 10 Jul 2013 18:26:19 +1000, Chris Angelico wrote: > On Wed, Jul 10, 2013 at 5:55 PM, Mats Peterson wrote: >> A moderator who calls himself “animuson” on Stack Overflow doesn’t want >> to face the truth. He has deleted all my postings regarding Python >> regular expression matching being e

Re: Babel i18n package has new maintainers

2013-07-10 Thread Steven D'Aprano
On Wed, 10 Jul 2013 08:55:46 +0200, Stefan Behnel wrote: > Hi, > > I've been looking for a Python package for formatting international > dates, numbers and monetary values [...] > https://github.com/mitsuhiko/babel > > Since it took me quite a while to figure this out, I thought I'd post > this

Re: Stack Overflow moderator “animuson”

2013-07-10 Thread Steven D'Aprano
On Wed, 10 Jul 2013 07:55:05 +, Mats Peterson wrote: > A moderator who calls himself “animuson” on Stack Overflow doesn’t want > to face the truth. He has deleted all my postings regarding Python > regular expression matching being extremely slow compared to Perl. That's by design. We don't w

Re: Stack Overflow moder ator “animuson”

2013-07-10 Thread Steven D'Aprano
On Wed, 10 Jul 2013 08:46:44 +, Mats Peterson wrote: > Chris Angelico wrote: >> On Wed, Jul 10, 2013 at 6:33 PM, Mats Peterson >> wrote: >>> Steven D'Aprano wrote: >>>> On Wed, 10 Jul 2013 18:26:19 +1000, Chris Angelico wrote: [...] >>>>

Re: Prime number generator

2013-07-10 Thread Steven D'Aprano
On Thu, 11 Jul 2013 00:00:59 +1000, Chris Angelico wrote: > And now for something completely different. > > I knocked together a prime number generator, just for the fun of it, > that works like a Sieve of Eratosthenes but unbounded. [...] > So, a few questions. Firstly, is there a stdlib way to

Re: ANN: psutil 1.0.0 released

2013-07-10 Thread Steven D'Aprano
On Wed, 10 Jul 2013 17:46:13 +0200, Giampaolo Rodola' wrote: > Hi there folks, > I'm pleased to announce the 1.0.0 release of psutil: > http://code.google.com/p/psutil/ Congratulations on the 1.0.0 release! -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: StackOverflowmoderator “animuson”

2013-07-10 Thread Steven D'Aprano
On Wed, 10 Jul 2013 09:03:24 +, Mats Peterson wrote: > Not a troll. It's just hard to convince Python users that their beloved > language would have inferior regular expression performance to Perl. I can't speak for others, but I've known for many years that Python's regex implementation was

Re: Stack Overflow moderator “animuson”

2013-07-10 Thread Steven D'Aprano
On Wed, 10 Jul 2013 16:54:02 +0100, Joshua Landau wrote: > On 10 July 2013 10:00, Steven D'Aprano wrote: >> On Wed, 10 Jul 2013 07:55:05 +, Mats Peterson wrote: >> >>> A moderator who calls himself “animuson” on Stack Overflow doesn’t >>> want to

Re: Stack Overflow moderator “animuson”

2013-07-10 Thread Steven D'Aprano
On Wed, 10 Jul 2013 18:53:34 +0100, Joshua Landau wrote: > I might be misattributing posts then. Or... YOU'RE IN DENIAL! Ranting Rick? Is that you? :-) > Who wins? You decide! Ah, definitely not RR :-) -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Documenting builtin methods

2013-07-10 Thread Steven D'Aprano
On Thu, 11 Jul 2013 04:15:37 +0100, Joshua Landau wrote: > I have this innocent and simple code: > > from collections import deque > exhaust_iter = deque(maxlen=0).extend At this point, exhaust_iter is another name for the bound instance method "extend" of one specific deque instance. Other i

Re: Documenting builtin methods

2013-07-11 Thread Steven D'Aprano
On Thu, 11 Jul 2013 17:06:39 +1000, Chris Angelico wrote: > On Thu, Jul 11, 2013 at 4:06 PM, Steven D'Aprano > wrote: >> I think the right solution here is the trivial: >> >> def exhaust(it): >> """Doc string here.""" >>

Mypy

2013-07-11 Thread Steven D'Aprano
Things are certainly heating up in the alternate Python compiler field. Mypy is a new, experimental, implementation of Python 3 with optional static typing and aiming for efficient compilation to machine code. http://www.mypy-lang.org/index.html -- Steven -- http://mail.python.org/mailman/

Re: Callable or not callable, that is the question!

2013-07-11 Thread Steven D'Aprano
On Thu, 11 Jul 2013 15:05:59 +0200, Ulrich Eckhardt wrote: > Hello! > > I just stumbled over a case where Python (2.7 and 3.3 on MS Windows) > fail to detect that an object is a function, using the callable() > builtin function. Investigating, I found out that the object was indeed > not callable

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

2013-07-11 Thread Steven D'Aprano
On Thu, 11 Jul 2013 09:45:33 -0400, Roy Smith wrote: > In article <2fdf282e-fd28-4ba3-8c83-ce120...@googlegroups.com>, > jus...@zeusedit.com wrote: > >> On Wednesday, July 10, 2013 2:17:12 PM UTC+10, Xue Fuqiao wrote: >> >> > * It is especially handy for selecting and deleting text. >> >>

Re: hex dump w/ or w/out utf-8 chars

2013-07-11 Thread Steven D'Aprano
On Thu, 11 Jul 2013 11:42:26 -0700, wxjmfauth wrote: > And what to say about this "ucs4" char/string '\U0001d11e' which is > weighting 18 bytes more than an "a". > sys.getsizeof('\U0001d11e') > 44 > > A total absurdity. You should stick to Python 3.1 and 3.2 then: py> print(sys.version)

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

2013-07-11 Thread Steven D'Aprano
On Fri, 12 Jul 2013 01:50:17 +1000, Chris Angelico wrote: > On Fri, Jul 12, 2013 at 1:42 AM, Paul Rudin > wrote: >> Text selection with a mouse is a different thing. Sometimes it's more >> convenient, sometimes it's not. > > As screens get larger and the amount of text on them increases, it's >

Re: How do I get the OS System Font Directory(Cross-Platform) in python?

2013-07-11 Thread Steven D'Aprano
On Thu, 11 Jul 2013 21:24:00 -0700, Metallicow wrote: > Forgot to add >>> part. Is there any way to edit posts? Not unless thousands of people give you access to their computer so you can edit the emails in their inboxes. When you send a post to a public mailing list, its out their on fifty t

Re: Callable or not callable, that is the question!

2013-07-12 Thread Steven D'Aprano
On Fri, 12 Jul 2013 07:36:30 +, Duncan Booth wrote: > To be a convincing use-case you would have to show a situation where > something had to be both a static method and a utility method rather > than just one or the other and also where you couldn't just have both. I have a class where I hav

Re: hex dump w/ or w/out utf-8 chars

2013-07-12 Thread Steven D'Aprano
On Fri, 12 Jul 2013 23:01:47 +0100, Joshua Landau wrote: > Isn't a superscript "c" the symbol for radians? Only in the sense that a superscript "o" is the symbol for degrees. Semantically, both degree-sign and radian-sign are different "things" than merely an o or c in superscript. Neverthele

Re: RE Module Performance

2013-07-12 Thread Steven D'Aprano
On Fri, 12 Jul 2013 13:58:29 -0400, Devyn Collier Johnson wrote: > I plan to spend some time optimizing the re.py module for Unix systems. > I would love to amp up my programs that use that module. In my experience, often the best way to optimize a regex is to not use it at all. [steve@ando ~]$

Re: How do I get the OS System Font Directory(Cross-Platform) in python?

2013-07-13 Thread Steven D'Aprano
On Fri, 12 Jul 2013 23:38:18 -0700, Metallicow wrote: > On Saturday, July 13, 2013 12:36:45 AM UTC-5, Tim Roberts wrote: >> Really? Because Windows is the ONLY one of the major operating systems >> >> that actually has a dedicated system fonts directory. Linux doesn't >> even >> >> have a dedi

Re: help with explaining how to split a list of tuples into parts

2013-07-13 Thread Steven D'Aprano
On Fri, 12 Jul 2013 23:43:55 -0700, peter wrote: > Hi List, > > I am new to Python and wondering if there is a better python way to do > something. As a learning exercise I decided to create a python bash > script to wrap around the Python Crypt library (Version 2.7). A Python bash script? What

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Steven D'Aprano
On Sat, 13 Jul 2013 00:56:52 -0700, wxjmfauth wrote: > I am convinced you are not conceptually understanding utf-8 very well. I > wrote many times, "utf-8 does not produce bytes, but Unicode Encoding > Units". Just because you write it many times, doesn't make it correct. You are simply wrong. U

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Steven D'Aprano
On Sat, 13 Jul 2013 00:56:52 -0700, wxjmfauth wrote: > You are confusing the knowledge of a coding scheme and the intrisinc > information a "coding scheme" *may* have, in a mandatory way, to work > properly. These are conceptualy two different things. *May* have, in a *mandatory* way? JMF, I kno

Re: Ideal way to separate GUI and logic?

2013-07-13 Thread Steven D'Aprano
On Sat, 13 Jul 2013 04:07:21 -0700, fronagzen wrote: > Well, I'm a newcome to Python, but I'm developing a program with a GUI > in tkinter, and I'm wondering what is the best, 'most pythonic' way of > doing this? > > I could, obviously, write a monolithic block of code. > > I can define the logi

Re: [Python-ideas] float('∞')=float('inf')

2013-07-13 Thread Steven D'Aprano
On Sun, 14 Jul 2013 11:53:55 +1000, Chris Angelico wrote: > Doh, I forgot which channel this was on again :( It feels like a > python-list thread. Can't you just hit Reply-List or even Reply-All? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Beazley 4E P.E.R, Page29: Unicode

2013-07-14 Thread Steven D'Aprano
On Sat, 13 Jul 2013 20:09:31 -0700, vek.m1234 wrote: > http://stackoverflow.com/questions/17632246/beazley-4e-p-e-r-page29- unicode > > "directly writing a raw UTF-8 encoded string such as 'Jalape\xc3\xb1o' > simply produces a nine-character string U+004A, U+0061, U+006C, U+0061, > U+0070, U+0065

Re: hex dump w/ or w/out utf-8 chars

2013-07-14 Thread Steven D'Aprano
On Sun, 14 Jul 2013 01:20:33 -0700, wxjmfauth wrote: > For a very simple reason, the latin-1 block: considered and accepted > today as beeing a Unicode design mistake. Latin-1 (also known as ISO-8859-1) was based on DEC's "Multinational Character Set", which goes back to 1983. ISO-8859-1 was fir

Re: Ideal way to separate GUI and logic?

2013-07-14 Thread Steven D'Aprano
On Sun, 14 Jul 2013 17:25:32 -0700, fronagzen wrote: > My next question is, to what degree should I 'slice' my logic into > functions? How small or how large should one function be, as a rule of > thumb? I aim to keep my functions preferably below a dozen lines (excluding the doc string), and de

Re: what thread-synch mech to use for clean exit from a thread

2013-07-14 Thread Steven D'Aprano
On Mon, 15 Jul 2013 10:27:45 +0800, Gildor Oronar wrote: > A currency exchange thread updates exchange rate once a minute. If the > thread faield to update currency rate for 5 hours, it should inform > main() for a clean exit. This has to be done gracefully, because main() > could be doing somethi

Re: what thread-synch mech to use for clean exit from a thread

2013-07-14 Thread Steven D'Aprano
Oh, I forgot another comment... On Mon, 15 Jul 2013 03:04:14 +, Steven D'Aprano wrote: > On Mon, 15 Jul 2013 10:27:45 +0800, Gildor Oronar wrote: >>while time.time() - self.rate_timestamp < 5*3600: >> ... # update exchange rate

Re: RE Module Performance

2013-07-15 Thread Steven D'Aprano
On Mon, 15 Jul 2013 06:06:06 -0400, Devyn Collier Johnson wrote: > On 07/14/2013 02:17 PM, 8 Dihedral wrote: [...] >> Do we want volunteers to speed up >> search operations in the string module in Python? > > It would be nice if someone could speed it up. Devyn, 8 Dihedral is our residen

Re: Homework help requested (not what you think!)

2013-07-16 Thread Steven D'Aprano
On Tue, 16 Jul 2013 15:43:45 -0700, John Ladasky wrote: > The kids all claim to be interested. They all want to write the next > great 3D video game. Thus, I'm a little surprised that the kids don't > actually try to sit down and code without me prompting them. I think > that they're disappoint

Re: Share Code Tips

2013-07-19 Thread Steven D'Aprano
On Fri, 19 Jul 2013 10:21:10 -0400, Joel Goldstick wrote: > class="gmail_quote"> [snip 70-odd lines of HTML...] > I'm guessing you may be posting with html.  So all your code runs > together. > -- dir="ltr"> Joel Goldstickhttp://joelgoldstick.com > My irony meter didn't merely explode, it a

Re: Find and Replace Simplification

2013-07-19 Thread Steven D'Aprano
On Fri, 19 Jul 2013 09:22:48 -0400, Devyn Collier Johnson wrote: > I have some code that I want to simplify. I know that a for-loop would > work well, but can I make re.sub perform all of the below tasks at once, > or can I write this in a way that is more efficient than using a > for-loop? > > D

Re: Messages to Python-List aren't posting

2013-07-19 Thread Steven D'Aprano
On Fri, 19 Jul 2013 09:57:47 -0500, Skip Montanaro wrote: >> Is it possible that the name "Matthew Lefavor" has been added to a >> greylist or something? > > That's not how greylisting works. Greylisting is a scheme used to > eliminate spam. The server knows what email addresses it's received >

Re: Share Code Tips

2013-07-19 Thread Steven D'Aprano
On Fri, 19 Jul 2013 09:51:23 -0400, Devyn Collier Johnson wrote: > def KDE_VERSION(): > print(subprocess.getoutput('kded4 --version | awk -F: > \'NR == 2 {print $2}\'').strip()) ##Get KDE version## I run KDE 3, and the above does not work for me. *half a wink* By the way, a comment that

Re: Share Code Tips

2013-07-19 Thread Steven D'Aprano
On Fri, 19 Jul 2013 18:08:43 -0400, Devyn Collier Johnson wrote: > As for the case-insensitive if-statements, most code uses Latin letters. > Making a case-insensitive-international if-statement would be > interesting. I can tackle that later. For now, I only wanted to take > care of Latin letters

Re: Share Code Tips

2013-07-19 Thread Steven D'Aprano
On Fri, 19 Jul 2013 21:04:55 -0400, Devyn Collier Johnson wrote: > In the future, I want to > make the perfect international-case-insensitive if-statement. For now, > my code only supports a limited range of characters. Even with casefold, > I will have some issues as Chris Angelico mentioned. Th

Re: [ANN] pyparsing 2.0.1 released - compatible with Python 2.6 and later

2013-07-20 Thread Steven D'Aprano
On Sat, 20 Jul 2013 14:30:14 -0700, Paul McGuire wrote: > Thanks for your continued support and interest in pyparsing! And thank you for pyparsing! Paul, I thought I would mention that over the last week or so on the Python-Dev mailing list, there has been some discussion about adding a parser

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

2013-07-20 Thread Steven D'Aprano
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 sometimes people forget that if you have a ch

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

2013-07-21 Thread Steven D'Aprano
On Sun, 21 Jul 2013 03:19:24 -0700, pablobarhamalzas wrote: > Thank's for all the replies! I've tried some of the imporovements you > suggested (using math.exp() and sum() or math.fsum()). None of that made > the code faster, because they are functions you are calling lots of > times, and function

Re: How to tick checkboxes with the same name?

2013-07-22 Thread Steven D'Aprano
On Mon, 22 Jul 2013 21:10:18 -0700, malayrev wrote: > I faced a problem: to implement appropriate search program I need to > tick few checkboxes which turned out to have the same name (name="a", > id="a1","a2","a3","a4"). Set_input('a', True) does not work (I use Grab > library) Instructions for

Re: Strange behaviour with os.linesep

2013-07-23 Thread Steven D'Aprano
On Tue, 23 Jul 2013 13:42:13 +0200, Vincent Vande Vyvre wrote: > On Windows a script where de endline are the system line sep, the files > are open with a double line in Eric4, Notepad++ or Gedit but they are > correctly displayed in the MS Bloc-Notes. I suspect the problem lies with Eric4, Notep

Re: non sequitur: [OT] SPF - was Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Steven D'Aprano
On Tue, 23 Jul 2013 19:59:01 -0400, Dennis Lee Bieber wrote: > {Liaden culture seems heavy on personal honor, and comments tend (to me) > be worded to avoid any chance of being interpreted as disparaging of the > person with whom one is speaking... Hmmm, pity such modes can't be > enforced on the

Re: Python 3: dict & dict.keys()

2013-07-23 Thread Steven D'Aprano
On Tue, 23 Jul 2013 18:16:08 -0700, Ethan Furman wrote: > Back in Python 2.x days I had a good grip on dict and dict.keys(), and > when to use one or the other. > > Then Python 3 came on the scene with these things called 'views', and > while range couldn't be bothered, dict jumped up and down sh

Re: Python 3: dict & dict.keys()

2013-07-24 Thread Steven D'Aprano
On Wed, 24 Jul 2013 08:57:11 -0700, Ethan Furman wrote: > My point is that in 2.x .keys() did something different from the dict, > while in 3.x it appears to me that they are the same. Then you aren't looking very closely. d.keys() returns a set-like view into the dict, which is great for compar

Re: Python 3: dict & dict.keys()

2013-07-24 Thread Steven D'Aprano
On Wed, 24 Jul 2013 13:17:12 -0400, Terry Reedy wrote: > On 7/24/2013 12:34 PM, Chris Angelico wrote: > >> Side point: Why is iterating over a dict equivalent to .keys() rather >> than .items()? It feels odd that, with both options viable, the >> implicit version iterates over half the dict inste

Re: RE Module Performance

2013-07-24 Thread Steven D'Aprano
On Wed, 24 Jul 2013 09:00:39 -0600, Michael Torrie wrote about JMF: > His most recent argument that Python should use UTF as a representation > is very strange to be honest. He's not arguing for anything, he is just hating on anything that gives even the tiniest benefit to ASCII users. This isn'

Re: Python 3: dict & dict.keys()

2013-07-24 Thread Steven D'Aprano
On Wed, 24 Jul 2013 17:59:43 -0700, Ethan Furman wrote: >> Repeat after me: "In Python 2, d.keys() returns a list of keys, so if I >> want a list of keys in Python 3, call list explicitly list(d.keys())." > > Actually, I would recommend `list(d)`, which also works the same in both > 2 and 3. Fai

Re: RE Module Performance

2013-07-25 Thread Steven D'Aprano
On Thu, 25 Jul 2013 00:34:24 +1000, Chris Angelico wrote: > But mainly, I'm just wondering how many people here have any basis from > which to argue the point he's trying to make. I doubt most of us have > (a) implemented an editor widget, or (b) tested multiple different > internal representation

<    1   2   3   4   5   6   7   8   9   10   >