Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Thu, Sep 27, 2012 at 2:52 AM, Paul Rubin wrote: > Chris Angelico writes: >> When you compare against a wide build, semantics of 3.2 and 3.3 are >> identical, and then - and ONLY then - can you sanely compare >> performance. And 3.3 stacks up much better. > > I l

Re: Fwd: Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Thu, Sep 27, 2012 at 9:29 AM, Terry Reedy wrote: > On 9/26/2012 2:58 PM, Ian Kelly wrote: > >> You know, usually when I see software decried as America-centric, it's >> because it doesn't support Unicode. This must be the first time I've >> seen that label applied to software that dares to *ful

Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Thu, Sep 27, 2012 at 10:44 AM, Steven D'Aprano wrote: > PyPy is, well, PyPy is amazing, if you have the hardware to run it. It is > an optimizing Python JIT compiler, and it can consistently demonstrate > speeds of about 10 times the speed of CPython, which puts it in the same > ballpark as nat

Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Thu, Sep 27, 2012 at 4:01 PM, Steven D'Aprano wrote: > On Thu, 27 Sep 2012 15:37:35 +1000, Chris Angelico wrote: >> Assuming it manages to catch up with Py3, which a decade makes entirely >> possible, this I can well believe. And while we're sounding all hopeful, &

Re: Article on the future of Python

2012-09-27 Thread Chris Angelico
On Thu, Sep 27, 2012 at 11:59 PM, Grant Edwards wrote: > On 2012-09-27, Chris Angelico wrote: >> On Thu, Sep 27, 2012 at 4:01 PM, Steven D'Aprano >> wrote: >> >>> Given how Perl has slipped in the last decade or so, that would be a step >>> backwards

Re: Article on the future of Python

2012-09-27 Thread Chris Angelico
On Fri, Sep 28, 2012 at 2:45 AM, Mark Lawrence wrote: > The article Steven D'Aprano referred to is not a direct response to the > article I referred to, yet your words are written as if it were. May I ask > why? Or have I missed something? Steven cited it with the words "And a response". Chris

Re: Article on the future of Python

2012-09-27 Thread Chris Angelico
You're posting to both comp.lang.python and python-list, are you aware that that's redundant? On Fri, Sep 28, 2012 at 5:09 AM, wrote: > This flexible string representation is wrong by design. > Expecting to divide "Unicode" in chunks and to gain something > is an illusion. > It has been created

Re: Reducing cache/buffer for faster display

2012-09-27 Thread Chris Angelico
On Fri, Sep 28, 2012 at 7:57 AM, Rikishi42 wrote: > I have these 2 scripts that are very heavy on the file i/o, consume a very > reasonable amount of cpu and output their counters at a - very - relaxed > pace to the console. The output is very simply done using something like: > >print "files:

Re: Reducing cache/buffer for faster display

2012-09-27 Thread Chris Angelico
On Fri, Sep 28, 2012 at 8:25 AM, John Gordon wrote: > Isn't terminal output line-buffered? I don't understand why there would > be an output delay. (Unless the "\r" is messing things up...) This is a classic progress-indication case, which does indeed mess up line-buffering. The carriage return

Re: Article on the future of Python

2012-09-27 Thread Chris Angelico
On Fri, Sep 28, 2012 at 2:12 PM, Greg Donald wrote: > On Thu, Sep 27, 2012 at 10:37 PM, Wayne Werner wrote: >> the only advice I can give on that is >> just learn to use both. > > I find there's little to lose in having experience with both. > > Most every good web framework out there supports lo

Re: Stop feeding the trolls (Was: which a is used?)

2012-09-27 Thread Chris Angelico
On Fri, Sep 28, 2012 at 1:47 PM, Dwight Hutto wrote: > [ lots of screed that demonstrates that Dwight hasn't grokked the hacker > culture ] Dwight, have a read of these documents. They may help you to understand how the python-list community operates, and perhaps more so, why most of the regular

Re: REST code-golf: How concisely can you expose and consume services?

2012-09-28 Thread Chris Angelico
On Fri, Sep 28, 2012 at 3:41 PM, Alec Taylor wrote: > web2py (7 lines): https://gist.github.com/3798093 I love the idea, even though I shan't be entering. Code golf is awesome fun! My latest golf game involved importing code comments and text-file annotations into autodoc markup... with two one-

Re: Reducing cache/buffer for faster display

2012-09-28 Thread Chris Angelico
On Fri, Sep 28, 2012 at 10:05 AM, Rikishi42 wrote: > The scripts in question only increase numbers. But should that not be the > case, solutions are simple enough. The numbers can be formatted to have a > fixed size. In the case of random line contents (a list of filesnames, say) > it's enough to

Re: Article on the future of Python

2012-09-28 Thread Chris Angelico
On Sat, Sep 29, 2012 at 12:31 AM, Dennis Lee Bieber wrote: > On Fri, 28 Sep 2012 14:37:21 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: > > >> For further details, poke around on the web; I'm sure you'll find >> plenty of good bl

Re: what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change'

2012-09-28 Thread Chris Angelico
On Fri, Sep 28, 2012 at 11:12 PM, 陈伟 wrote: > > -- > http://mail.python.org/mailman/listinfo/python-list In future, can you put the body of your message into the body please? :) ctime is creation time, not change time. mtime is modification time, as you have. But I can understand where the confu

Re: Article on the future of Python

2012-09-28 Thread Chris Angelico
On Sat, Sep 29, 2012 at 1:14 AM, Ian Kelly wrote: > On Fri, Sep 28, 2012 at 8:58 AM, Chris Angelico wrote: >> Yes, MySQL has definitely improved. There was a time when its >> unreliability applied to all your data too, but now you can just click >> in InnoDB and have mo

Re: what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change'

2012-09-28 Thread Chris Angelico
On Sat, Sep 29, 2012 at 1:18 AM, Christian Heimes wrote: > Am 28.09.2012 17:07, schrieb Chris Angelico: > In the future please read the manual before replying! ;) You are wrong, > ctime is *not* the creation time. It's the change time of the inode. > It's updated whenever

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-29 Thread Chris Angelico
On Sat, Sep 29, 2012 at 7:38 PM, Mark Lawrence wrote: > > My understanding is that Python 3.3 has regressed the performance of ''. > Surely the Python devs can speed the performance back up and, just for us, > use less memory at the same time? Yes, but to do that we'd have to make Python more Aus

Re: [RELEASED] Python 3.3.0

2012-09-29 Thread Chris Angelico
On Sun, Sep 30, 2012 at 12:17 AM, Stefan Behnel wrote: > Christian Heimes, 29.09.2012 16:06: >> From now on you can't rely >> on the order of an unordered type like dict or set. > > Tautologies tend to be true even without a temporal qualification. Technically people shouldn't ever have relied on

Re: using "*" to make a list of lists with repeated (and independent) elements

2012-09-29 Thread Chris Angelico
On Sun, Sep 30, 2012 at 3:18 AM, Ian Kelly wrote: > On Sat, Sep 29, 2012 at 11:01 AM, 8 Dihedral > wrote: >> >> Don't you get it why I avoided the lambda one liner as a functon. >> >> I prefer the def way with a name chosen. > > Certainly, but the Bresenham line algorithm is O(n), which is wh

Re: Should one always add super().__init__() to the __init__?

2012-09-29 Thread Chris Angelico
On Sun, Sep 30, 2012 at 3:17 AM, Steven D'Aprano wrote: > No. Only add code that works and that you need. Arbitrarily adding calls > to the superclasses "just in case" may not work: > > py> class Spam(object): > ... def __init__(self, x): > ... self.x = x > ... super(Sp

Re: Editing in IDLE

2012-09-29 Thread Chris Angelico
On Sun, Sep 30, 2012 at 3:14 AM, wrote: > Hello to the group! > > I'm a new Python user and so far I'm enjoying it. One of the many newbie > problems I'm having is I can't edit my code in IDLE once it's run or there's > an error message. I can only copy the code so far, paste at the bottom and

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-29 Thread Chris Angelico
On Sun, Sep 30, 2012 at 6:51 AM, Tim Delaney wrote: > Personally I voted for the Fierce Snake[1][2] as the delimiter, but it was > voted down as "not Pythonic" enough. > I'm sure they were using that as a euphamism for "Python*ish*" though. > > [1] https://en.wikipedia.org/wiki/Inland_Taipan > [2]

Re: Should one always add super().__init__() to the __init__?

2012-09-29 Thread Chris Angelico
On Sun, Sep 30, 2012 at 2:37 PM, Steven D'Aprano wrote: > Which is exactly my point -- you can't call the superclass "just in case" > it changes, because you don't know what arguments the new superclass or > classes expect. You have to tailor the arguments to what the parent > expects, and even wh

Re: Can somebody give me an advice about what to learn?

2012-09-30 Thread Chris Angelico
On Sun, Sep 30, 2012 at 10:58 PM, tcgo wrote: > Hi! > I'm really new to Usenet/Newsgroups, but... I'd like to learn some new > programming language, because I learnt a bit of Perl though its OOP is ugly. > So, after searching a bit, I found Python and Ruby, and both of they are cute. > So, assum

Re: Can somebody give me an advice about what to learn?

2012-09-30 Thread Chris Angelico
On Mon, Oct 1, 2012 at 12:23 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> there's no efficient and reliable way to change/reload code in a >> running application (not often an issue). > > What we do (largely cribbed from django's runserv

Re: Can somebody give me an advice about what to learn?

2012-09-30 Thread Chris Angelico
On Mon, Oct 1, 2012 at 12:35 AM, Chris Angelico wrote: > What I'm talking about is > having a single process that never terminates, never stops accepting > connections, but at some point new connections begin to be served with > new code... And to clarify, only the code that ne

Re: Can somebody give me an advice about what to learn?

2012-09-30 Thread Chris Angelico
On Mon, Oct 1, 2012 at 1:01 AM, Roy Smith wrote: > Well, more strictly, what you need is to keep your state somewhere else. > Doesn't have to be on disk. Could be in memory, if that memory belongs > to another process (memcache, redis, or any of a number of in-memory > databases). Sure. I'll gen

Re: Can somebody give me an advice about what to learn?

2012-09-30 Thread Chris Angelico
On Mon, Oct 1, 2012 at 8:14 AM, Roy Smith wrote: > Yeah, that's a problem. There's nothing fundamental about a TCP > connection endpoint which precludes it being serialized and passed > around. The amount of state involved is pretty small. Unless I've > forgotten something, 2 IP addresses, 2 po

Re: parse an environment file

2012-09-30 Thread Chris Angelico
bout, please consider clarifying your question :) Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: parse an environment file

2012-10-01 Thread Chris Angelico
On Tue, Oct 2, 2012 at 12:12 AM, Jason Friedman wrote: > Let me restate my question. I have a file that looks like this: > export VAR1=foo > export VAR2=bar > # Comment > export VAR3=${VAR1}${VAR2} > > I want this: > my_dict = {'VAR1': 'foo', 'VAR2': 'bar', 'VAR3': 'foobar'} > > I can roll my own

Re: parse an environment file

2012-10-01 Thread Chris Angelico
On Tue, Oct 2, 2012 at 12:37 AM, Jason Friedman wrote: >> Is there a reason to use that format, rather than using Python >> notation? I've at times made config files that simply get imported. >> Instead of a dictionary, you'd have a module object: >> >> >> # config.py >> VAR1='foo' >> VAR2='bar' >

Re: Slicing iterables in sub-generators without loosing elements

2012-10-02 Thread Chris Angelico
On Wed, Oct 3, 2012 at 2:44 AM, Mark Lawrence wrote: > What happened to freedom of speech? If I want to talk to a bot, I'll talk > to a bot. Besides I'm not convinced it/he/she is a bot. Plus if you read > my post carefully, add in several years experience of Python the language > and Python th

Re: parse an environment file

2012-10-02 Thread Chris Angelico
On Wed, Oct 3, 2012 at 1:49 PM, Jason Friedman wrote: > Based on your responses and everyone's responses I'm guessing that > what I am doing is sufficiently novel that there is no canned > solution. I looked at shlex but did not see how that would be > helpful. The only canned solution for parsi

Re: How to print html in python the normal way

2012-10-04 Thread Chris Angelico
On Thu, Oct 4, 2012 at 9:24 PM, wrote: > am I missing something. The first thing you're missing is more detail in your question. My crystal ball tells me you're using some kind of web framework and viewing this in your browser. And my second crystal ball suggests that it's probably Django. But i

Re: final question: logging to stdout and updating files

2012-10-04 Thread Chris Angelico
On Fri, Oct 5, 2012 at 12:00 AM, Steven D'Aprano wrote: > That is *terrible* advice. But if you insist on following it, you can > optimize *any* Python program to this: > > # === start code === > pass # this line is optional > # === end code === > > > There you go. The most heavily optimized, fas

Re: sum function

2012-10-04 Thread Chris Angelico
On Fri, Oct 5, 2012 at 7:29 AM, Mike wrote: > I get below error > > NameError: name 'functools' is not defined > > Thanks functools is a module: import functools ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: notmm is dead!

2012-10-04 Thread Chris Angelico
On Fri, Oct 5, 2012 at 9:13 AM, Etienne Robillard wrote: > Thanks, but I tried all that and don't have much energy for continuing. If > you're > serious about open source then maybe you can forward the thread to > django-developers > and get some fundings to pay for a minimalistic fee to get the

Re: write binary with struct.pack_into

2012-10-05 Thread Chris Angelico
On Sat, Oct 6, 2012 at 1:27 PM, palmeira wrote: > import struct > bloco='>%df' %(252) #Binary format > > # READ > fa=open('testIN.bin') > my_array=struct.unpack_from(bloco,fa.read()[0*4:251*4])# my_aray = 252 > elements array > ## This read is OK! > > #WRITE > fb=open('testOUT.bin') > test=st

Re: Executing untrusted scripts in a sandboxed environment

2012-10-06 Thread Chris Angelico
On Sat, Oct 6, 2012 at 8:22 AM, Robin Krahl wrote: > Hi all, > > I need to execute untrusted scripts in my Python application. To avoid > security issues, I want to use a sandboxed environment. This means that the > script authors have no access to the file system. They may only access > object

Re: Executing untrusted scripts in a sandboxed environment

2012-10-06 Thread Chris Angelico
On Sat, Oct 6, 2012 at 7:10 PM, Ramchandra Apte wrote: > On Saturday, 6 October 2012 12:49:29 UTC+5:30, Chris Angelico wrote: >> On Sat, Oct 6, 2012 at 8:22 AM, Robin Krahl wrote: >> > What is the best way to "embed" a script engine in a sandboxed environment >&g

Re: write binary with struct.pack_into

2012-10-06 Thread Chris Angelico
On Sat, Oct 6, 2012 at 11:26 PM, Grant Edwards wrote: > On 2012-10-06, Dennis Lee Bieber wrote: >> On Fri, 5 Oct 2012 20:27:36 -0700 (PDT), palmeira >> declaimed the following in gmane.comp.python.general: >> >>> >>> #WRITE >>> fb=open('testOUT.bin') >> >> Unless you specify otherwise, ope

Re: parse an environment file

2012-10-06 Thread Chris Angelico
On Sun, Oct 7, 2012 at 4:14 AM, Jason Friedman wrote: >> The only canned solution for parsing a bash script is bash. Think >> about it the other way around: If you wanted to have a Python variable >> made available to a bash script, the obvious thing to do is to invoke >> Python. It's the same thi

Re: getting the state of an object

2012-10-07 Thread Chris Angelico
On Sun, Oct 7, 2012 at 7:50 PM, Franck Ditter wrote: > def foo(self) : > (a,b,c,d) = (self.a,self.b,self.c,self.d) > ... big code with a,b,c,d ... > This strikes me as ripe for bug introduction. There's no problem if you're just reading those values, and mutating them is equally fine, but

Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ?

2012-10-08 Thread Chris Angelico
On Tue, Oct 9, 2012 at 1:48 AM, Dave Angel wrote: > import decimal > a = decimal.Decimal(4.3) > print(a) > > 5.0996447286321199499070644378662109375 Ah, the delights of copy-paste :) > The Decimal class has the disadvantage that it's tons slower on any modern > machine I know of...

Re: To get the accurate value of 1 - 0.999999999999999 ,how to implement the python algorithm ?

2012-10-08 Thread Chris Angelico
On Tue, Oct 9, 2012 at 2:13 AM, Dave Angel wrote: > On 10/08/2012 11:00 AM, Chris Angelico wrote: >> On Tue, Oct 9, 2012 at 1:48 AM, Dave Angel wrote: >>> The Decimal class has the disadvantage that it's tons slower on any modern >>> machine I know of... >&

Re: [Python-ideas] Make "is" checks on non-singleton literals errors

2012-10-09 Thread Chris Angelico
On Tue, Oct 9, 2012 at 1:14 PM, Guido van Rossum wrote: > Maybe we should do something more drastic and always create a new, > unique constant whenever a literal occurs as an argument of 'is' or > 'is not'? Then such code would never work, leading people to examine > their code more closely. I bet

Re: for-loop on cmd-line

2012-10-11 Thread Chris Angelico
On Thu, Oct 11, 2012 at 11:16 PM, D'Arcy J.M. Cain wrote: > On Thu, 11 Oct 2012 13:24:22 +0200 > Gisle Vanem wrote: > >> Hello list. I'm a newbie when it comes to Python. >> >> I'm trying to turn this: >> >> def print_sys_path(): >> i = 0 >> for p in sys.path: >> print ('sys.path[%

Re: for-loop on cmd-line

2012-10-11 Thread Chris Angelico
On Fri, Oct 12, 2012 at 12:16 AM, Ramchandra Apte wrote: > What about the "Power" in PowerShell? What about it? Are you suggesting that the OP use it? Are you saying that Windows batch already includes it? You quoted my entire post (double-spaced), but that context adds nothing to your statement;

Re: __builtins__ thread-safe / __builtins__ as function?

2012-10-11 Thread Chris Angelico
On Fri, Oct 12, 2012 at 1:16 AM, Juergen Bartholomae wrote: > One possible solution is to somehow redirect every __builtins__ to a > function that returns a different __builtins__ dictionary for each thread > (such a function already exists). How exactly does the code reference it? If they're si

Re: for-loop on cmd-line

2012-10-11 Thread Chris Angelico
On Fri, Oct 12, 2012 at 3:24 AM, wrote: > Le jeudi 11 octobre 2012 15:16:33 UTC+2, Ramchandra Apte a écrit : > > PS C:\> $cmd="import sys;" > PS C:\> $cmd+="print('\n'.join(sys.path))" > PS C:\> $cmd > import sys;print('\n'.join(sys.path)) > PS C:\> c:\python32\python -c $cmd > > C:\Windows\syste

Re: for-loop on cmd-line

2012-10-11 Thread Chris Angelico
On Fri, Oct 12, 2012 at 3:49 AM, Gisle Vanem wrote: > wrote in comp.lang.python > > (my ISP no longer updates this group. Last message is from 8. April. > Does the postings to the python mailing-list automatically get reposted to > comp.lang.python?) Yes, c.l.p and python-list mirror each other.

Re: AI Example Help

2012-10-11 Thread Chris Angelico
On Fri, Oct 12, 2012 at 4:44 PM, Trevor Nelson wrote: > I really would truely appreciate and example coding of how to put together an > initial basic "AI" bot where it can monitor the system and tell me alerts as > with being able to query it for questions. As with I am looking for some sort >

Re: How to use "while" within the command in -c option of python?

2012-10-13 Thread Chris Angelico
On Sat, Oct 13, 2012 at 7:41 PM, Thomas Bach wrote: > On Sat, Oct 13, 2012 at 12:32:41AM +, Steven D'Aprano wrote: >> >> He gets SyntaxError because you can't follow a semicolon with a >> statement that begins a block. > > Can someone provide a link on where to find this type of information?

Re: readline trick needed

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 12:44 AM, Etienne Robillard wrote: > Why dont you grow yourself some usable neurons instead ? Don't you realize > now stackoverflow.com is starting > to hurt your capacity to cogitate on your own or have you not realized this > yet? Excuse me? I'm not overly familiar wi

Re: Feedback on my python framework I'm building.

2012-10-13 Thread Chris Angelico
On Sat, Oct 13, 2012 at 3:49 PM, wrote: > Basically its a framework that forces the developer(s) to strictly separate > the model from the view and controller. You can 'hook up' multiple > controllers to a project. The model layer can be completely mocked out so > front end designers don't hav

Re: Feedback on my python framework I'm building.

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 2:57 AM, wrote: > Do you have an example of a task that giotto can't handle that other > frameworks can? One of my goals is to have this framework "turing complete" > in the sense that everything that other frameworks can do, giotto should be > able to do. I think my co

Re: How to use "while" within the command in -c option of python?

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 3:38 AM, Joshua Landau wrote: > This here isn't a flaw in Python, though. It's a flaw in the command-line > interpreter. By putting it all on one line, you are effectively saying: > "group these". Which is the same as an "if True:" block, and some things > like Reinteract e

Re: Aggressive language on python-list

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 2:21 AM, Zero Piraeus wrote: > I'm a mostly passive subscriber to this list - my posts here over the > years could probably be counted without having to take my socks off - > so perhaps I have no right to comment, but I've noticed a marked > increase in aggressive language

Re: How to use "while" within the command in -c option of python?

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 4:43 AM, Jussi Piitulainen wrote: > Chris Angelico writes: > >> Here's a side challenge. In any shell you like, start with this >> failing statement, and then fix it without retyping anything: >> >> sikorsky@sikorsky:~$ python -c "a=

Re: Feedback on my python framework I'm building.

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 5:18 AM, wrote: > On Saturday, October 13, 2012 12:48:23 PM UTC-4, Chris Angelico wrote: >> No, I don't, because I haven't tried to use it. But allow me to give >> two examples, one on each side of the argument. >> >> The 'tee&#

Re: How to use "while" within the command in -c option of python?

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 5:21 AM, Joshua Landau wrote: > Because Python uses indentation, what would "if A: print(1); if B: print(2)" > even do? It has to fail, because we have to assume consistent indentation > for ";"s*. With "\n" as I proposed, you still have to indent: it is just a > method to

Re: Understanding http proxies

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 5:43 AM, Olive wrote: > it seems when I read the code above that the proxy acts mostly as an > orinary server with respect to the client except that it is supposed to > receive the full URL instead of just the path. Am I right? Is there any > documentation on what an http p

Re: How to use "while" within the command in -c option of python?

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 6:06 AM, Joshua Landau wrote: > The fact that your proposal can't allow "a=[]\nfor x in range(10): > a.append(x**a[-2])\nprint(a)" makes it somewhat an incomplete suggestion, > and code like: > >> while True: while True: break; break > > is just confusing. Agreed. However,

Re: readline trick needed

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 8:31 AM, Joshua Landau wrote: > With two irritants (including 8), is it not advisable that python-list > gets an admin to block these accounts? Even if it does nothing more than > slow them, that's something. That's what killfiles are for. You have two options: http:/

Re: How to use "while" within the command in -c option of python?

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 9:00 AM, Joshua Landau wrote: > That is also callable from the command-line like so: >> >> python -m debrace -c "if a: ${ print(1) $ print(2) $ while b: c() $ if g: >> ${ pass }$ }$ print(d)" Wait you're pretty much implementing from __future__ import braces? ChrisA -

Re: readline trick needed

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 9:25 AM, Joshua Landau wrote: > On 13 October 2012 22:44, Chris Angelico wrote: >> >> On Sun, Oct 14, 2012 at 8:31 AM, Joshua Landau >> wrote: >> > With two irritants (including 8), is it not advisable that >> > python-list >

Re: Feedback on my python framework I'm building.

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 9:24 AM, wrote: > On Saturday, October 13, 2012 2:33:43 PM UTC-4, Chris Angelico wrote: >> >> Nice theory, but this is the bit that I fundamentally disagree with. >> Forcing programmers to work in one particular style is usually not the >> jo

Re: Feedback on my python framework I'm building.

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 2:37 PM, Steven D'Aprano wrote: > On Sun, 14 Oct 2012 05:33:40 +1100, Chris Angelico wrote: > >> Forcing programmers to work in one particular style is usually not the >> job of the language/framework/library. > > Have you actually programme

Re: Understanding and dealing with an exception

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 3:23 PM, Vincent Davis wrote: > OverflowError: Python int too large to convert to C long > line 266, in _maketile > bytecount = read(channels * ysize * 2) Is the file over 2GB? Might be a limitation, more than a bug, and one that could possibly be raised by using a 64-bi

Re: Understanding and dealing with an exception

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 3:36 PM, Vincent Davis wrote: > Oops, I was going to make note of the file size. 1.2MB Then I'd definitely declare the file bad; I don't know what the valid ranges for channels and ysize are, but my reading of that is that your file's completely corrupt, maybe even malicio

Re: Understanding and dealing with an exception

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 4:01 PM, Vincent Davis wrote: > I can open it is and all looks good using Pixelmator (I don't have Photoshop > installed). I don't think there is anything wrong with the image. > > Part of my question is a result of being new to actually using exceptions in > my programs an

Re: __builtins__ thread-safe / __builtins__ as function?

2012-10-14 Thread Chris Angelico
On Sun, Oct 14, 2012 at 9:36 PM, Juergen Bartholomae wrote: > Unfortunately, replacing __builtins__ at import time won't do, because > external modules (that is, .py) get imported only once when they are > accessed by the first thread, which includes (of course) setting up of > __dict__ and __buil

Re: MySQL with Python

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 12:45 AM, রুদ্র ব্যাণার্জী wrote: > Dear friends, > I am starting a project of creating a database using mySQL(my first > project with database). > I went to my institute library and find that, all books are managing > "mySQL with perl and php" > > I am new to python itself

Re: how to insert random error in a programming

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 12:55 AM, Debashish Saha wrote: > how to insert random error in a programming? how to ask question good in forumming? http://www.catb.org/~esr/faqs/smart-questions.html But here's one way to do it: raise random.choice((OSError,IOError,ZeroDivisionError,UnicodeDecodeErro

Re: MySQL with Python

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 1:47 AM, রুদ্র ব্যাণার্জী wrote: > On Tue, 2012-10-16 at 01:01 +1100, Chris Angelico wrote: >> But you may wish to consider using PostgreSQL instead. > Thanks, as I am very much new in database thing, I am not very aware of > the options I have. > But in

Re: how to insert random error in a programming

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 4:18 AM, Serhiy Storchaka wrote: > On 15.10.12 17:04, Chris Angelico wrote: >> On Tue, Oct 16, 2012 at 12:55 AM, Debashish Saha wrote: >>> how to insert random error in a programming? >> >> how to ask question good in forumming? >>

Re: how to insert random error in a programming

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 6:28 AM, Mark Lawrence wrote: > I like clearly written code like this > > " > d = {} > for c in (65, 97): > for i in range(26): > d[chr(i+c)] = chr((i+13) % 26 + c) > > print "".join([d.get(c, c) for c in s]) Surely there's a shorter way to rot13 a piece of tex

Re: Aggressive language on python-list

2012-10-17 Thread Chris Angelico
On Wed, Oct 17, 2012 at 5:24 PM, Steven D'Aprano wrote: > In an ideal world, we'd all agree on what counts as acceptable behaviour, > and stick to it, and discuss nothing but Python coding problems. But we > don't live in an idea world, and there are disagreements and people > behaving badly, and

Re: OT Questions

2012-10-17 Thread Chris Angelico
On Wed, Oct 17, 2012 at 5:27 PM, Dwight Hutto wrote: > On Wed, Oct 17, 2012 at 2:06 AM, Demian Brecht wrote: >> I can't ascertain what your strengths are as I don't work with you on a >> daily basis (one of the many benefits of working with people smarter than >> you ;)). > > Doubt that, unless

Re: bad httplib latency due to IPv6 use

2012-10-17 Thread Chris Angelico
On Wed, Oct 17, 2012 at 8:37 PM, Hans Mulder wrote: > I have no experience with win7/64, but on earlier versions of Windows, > there's a file named "hosts", somewhere in a system directory. When > looking up an IP address, this file is consulted first. Removing the > ::1 from the entry for local

Re: Index in a list

2012-10-17 Thread Chris Angelico
On Wed, Oct 17, 2012 at 9:10 PM, Anatoli Hristov wrote: > Hello, > > I'm trying to index a text in a list as I'm importing a log file and > each line is a list. > > What I'm trying to do is find the right line which contains the text > User : and take the username right after the text "User :", bu

Re: easy_install says "not a recognized archive type" Windows Py3

2012-10-17 Thread Chris Angelico
On Tue, Oct 16, 2012 at 1:41 PM, Noah Coad wrote: > error: Not a recognized archive type: > c:\users\noahco~1\appdata\local\temp\easy_ > install-gpekqc\PyMySQL-0.5.tar.gz Nobody seems to have responded to this (or I haven't seen it), but it looks like your system can't extract gzip files. Sugges

Re: bad httplib latency due to IPv6 use

2012-10-17 Thread Chris Angelico
On Wed, Oct 17, 2012 at 11:40 PM, Ulrich Eckhardt wrote: > Concerning the question whether a firewall blocks and unnecessarily delays > connection attempts to ::1, I haven't determined that yet. I'll ask our > admins here to verify whether that is the case. It would only be a software firewall on

Re: Aggressive language on python-list

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 1:29 AM, Grant Edwards wrote: > I disagree! I think occasional off-topic meta-arguments can be > interesting and entertaining. > > Yow! Am I having a meta-meta-discussion yet? Now we get to the meat of the discussion... It's like I was explaining to one of my brothers t

Re: Aggressive language on python-list

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 3:48 AM, wrote: >On 10/16/2012 08:45 PM, Steven D'Aprano wrote: >> Except that you've made a 180- >> degree turn from your advice to "ignore" bad behaviour, but apparently >> didn't notice that *sending private emails* is not by any definition >> "ignoring". So apparently

Re: Script for finding words of any size that do NOT contain vowels with acute diacritic marks?

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 5:17 AM, wrote: > Not at all, I knew this. In this I decided to program like > this. > > Do you get it? Yes/No or True/False Yes but why? When you're returning a boolean concept, why not return a boolean value? You don't even use values with one that compares-as-true an

Re: bad httplib latency due to IPv6 use

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 11:28 AM, Roy Smith wrote: > One likely path is to check in /etc/nsswitch.conf to see what data > sources the resolver should consult. On the box I'm using at the > moment, it says: > > hosts: files dns This is true on Linux, and presumably on various other Unice

Re: Aggressive language on python-list

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 3:05 PM, Dwight Hutto wrote: > On Wed, Oct 17, 2012 at 11:50 PM, wu wei wrote: >> Did you really forward a private email to a public mailing list without >> permission? >> >> Are you really that fucking ignorant of the law? > > This is a public discussion. Maybe you just n

Re: Aggressive language on python-list

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 3:21 PM, Dwight Hutto wrote: > On Thu, Oct 18, 2012 at 12:06 AM, alex23 wrote: >> On Oct 18, 2:02 pm, Dwight Hutto wrote: >> [a public response to a private email] >> >> I really don't appreciate you pushing public a *private email >> exchange*, especially when it has not

Re: Aggressive language on python-list

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 3:33 PM, Dwight Hutto wrote: > On Thu, Oct 18, 2012 at 12:23 AM, Chris Angelico wrote: >> Common misconception. The First Amendment to the United States >> Constitution prohibits the *making of any law* that restricts certain >> freedoms. It does no

Re: A desperate lunge for on-topic-ness

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 5:06 PM, Zero Piraeus wrote: > What are people's preferred strategies for dealing with lines that go > over 79 characters? A few I can think of off the bat: > > 1. Say "screw it" and go past 79, PEP8 be damned. > > 6. Realise that if it's that long, it probably shouldn't ha

Re: A desperate lunge for on-topic-ness

2012-10-18 Thread Chris Angelico
On Thu, Oct 18, 2012 at 8:07 PM, Hans Mulder wrote: > > if looks_like_it_might_be_spam( > some_longer_variables, > here_and_here, and_here_also): > logger.notice("might be spam") > move_to_spam_folder(some_longer_variables) > update_spam_statistics(here_and_here) > This wants

Re: python scripts for web

2012-10-18 Thread Chris Angelico
On Thu, Oct 18, 2012 at 8:22 PM, wrote: > On Thursday, October 18, 2012 10:42:56 AM UTC+2, Zero Piraeus wrote: >> That is exactly what a webserver does. Is there some reason you don't >> want to use e.g. Apache to handle the requests? > > no reason at all. so i guess the solution is much easier t

Re: Change computername

2012-10-18 Thread Chris Angelico
On Thu, Oct 18, 2012 at 7:22 PM, Anatoli Hristov wrote: > It does not work the result is "0" > > And I don't find any documentation about it :( Microsoft's official documentation can usually be found at the other end of a web search. In this case: http://msdn.microsoft.com/en-us/library/windows/

Re: use of exec()

2012-10-18 Thread Chris Angelico
On Thu, Oct 18, 2012 at 10:41 PM, lars van gemerden wrote: > NameError: name 'function' is not defined > > which seems an odd error, but i think some global variable is necessary for > this to work (if i put in globals() instead of {}, it works). The def statement simply adds a name to the curre

Re: use of exec()

2012-10-18 Thread Chris Angelico
On Fri, Oct 19, 2012 at 1:07 AM, lars van gemerden wrote: > Thanks, Chris, > > That works like a charm (after replacig "return ns.function" with "return > ns['function']" ;-) ). Err, yes, I forget sometimes that Python doesn't do that. JavaScript and Pike both let you (though Pike uses -> instea

Re: use of exec()

2012-10-18 Thread Chris Angelico
On Fri, Oct 19, 2012 at 2:00 AM, lars van gemerden wrote: > I get your point, since in this case having the custom code option makes the > system a whole lot less complex and flexible, i will leave the option in. The > future customer will be informed that they should handle the security around

Re: A desperate lunge for on-topic-ness

2012-10-18 Thread Chris Angelico
On Fri, Oct 19, 2012 at 2:49 AM, Dan Stromberg wrote: > In fact, I tend to do lots of "otherwise pointless" variables, because I > want to be able to quickly and easily insert print statements/functions > without having to split up large commands, during debugging. When will we next have a langu

Re: A desperate lunge for on-topic-ness

2012-10-18 Thread Chris Angelico
On Fri, Oct 19, 2012 at 3:13 AM, Neil Cerutti wrote: > Though technology has moved along swiftly, keeping your code > accessible to the guy using a crummy old console xterm might > still be worthwhile, and it makes printouts easy to create. And keeping your interface accessible to someone who can

<    7   8   9   10   11   12   13   14   15   16   >