Re: Unicode humor

2013-05-10 Thread Chris Angelico
On Sat, May 11, 2013 at 1:06 AM, jmfauth wrote: > On 8 mai, 15:19, Roy Smith wrote: >> Apropos to any of the myriad unicode threads that have been going on >> recently: >> >> http://xkcd.com/1209/ > > -- > > > This reflects a lack of understanding of Unicode. By the skywriter, or by the two

Re: Unicode humor

2013-05-10 Thread Chris Angelico
On Sat, May 11, 2013 at 1:24 AM, Ned Batchelder wrote: > On 5/10/2013 11:06 AM, jmfauth wrote: >> >> On 8 mai, 15:19, Roy Smith wrote: >>> >>> Apropos to any of the myriad unicode threads that have been going on >>> recently: >>> >>> http://xkcd.com/1209/ >> >> -- >> >> >> This reflects a lac

Re: object.enable() anti-pattern

2013-05-10 Thread Chris Angelico
On Sat, May 11, 2013 at 1:21 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: >> >> Agreed, in generality. But what is actually gained by hiding data from >> yourself? > > You're not hiding it from yourself. You're hiding it from the other

Re: object.enable() anti-pattern

2013-05-10 Thread Chris Angelico
On Sat, May 11, 2013 at 1:44 AM, Serhiy Storchaka wrote: > 10.05.13 15:19, Robert Kern написав(ла): > >> I'd be curious to see in-the-wild instances of the anti-pattern that you >> are talking about, then. > > > Many (if not most) GUI frameworks use this pattern. > > button = Button("text") >

Re: Unicode humor

2013-05-11 Thread Chris Angelico
On Sat, May 11, 2013 at 2:07 AM, rusi wrote: > On May 10, 8:32 pm, Chris Angelico wrote: >> On Sat, May 11, 2013 at 1:24 AM, Ned Batchelder >> wrote: >> > On 5/10/2013 11:06 AM, jmfauth wrote: >> >> >> On 8 mai, 15:19, Roy Smith wrote: >> >

Re: Making safe file names

2013-05-11 Thread Chris Angelico
On Thu, May 9, 2013 at 1:08 PM, Steven D'Aprano wrote: > I suspect that the only way to be completely ungoogleable would be to > name yourself something common, not something obscure. Say, if you called > yourself "Hard Rock Band", and did hard rock. But then, googling for > "Heavy Metal" alone br

Re: Append to python List

2013-05-11 Thread Chris Angelico
On Thu, May 9, 2013 at 9:30 PM, Jussi Piitulainen wrote: > 8 Dihedral writes: > >> This is just the handy style for a non-critical loop. >> In a critical loop, the number of the total operation counts >> does matter in the execution speed. > > Do you use speed often? Dihedral is a bot. Quite

Re: Message passing syntax for objects | OOPv2

2013-05-11 Thread Chris Angelico
On Fri, May 10, 2013 at 3:33 AM, Ian Kelly wrote: > All this irrelevant nonsense > about Turing machines and lambda calculus that you've injected into > the conversation though just reminds me of the "Einstein was wrong" > cranks. http://xkcd.com/1206/ ChrisA -- http://mail.python.org/mailman/l

Re: Unicode humor

2013-05-11 Thread Chris Angelico
On Sat, May 11, 2013 at 10:40 PM, Mark Lawrence wrote: > This simply shows bias to the English speaking world, as does Python > unicode, at least in 3.3+. I wouldn't mind betting that other languages > can't cope, e.g. can 3.3+ manage the top secret joke that's so deadly even > the Germans die la

Re: Append to python List

2013-05-11 Thread Chris Angelico
On Sun, May 12, 2013 at 1:47 AM, Anssi Saari wrote: > Chris Angelico writes: > >> On Thu, May 9, 2013 at 9:30 PM, Jussi Piitulainen >> wrote: >>> 8 Dihedral writes: >>> >>>> This is just the handy style for a non-critical loop. >>>

Re: object.enable() anti-pattern

2013-05-11 Thread Chris Angelico
On Sun, May 12, 2013 at 1:33 AM, André Malo wrote: > * Serhiy Storchaka wrote: > >> Another example is running a subprocess in Unix-like systems. >> >> fork() >> open/close file descriptors, set limits, etc >> exec*() > > For running a subprocess, only fork() is needed. For starting

Re: object.enable() anti-pattern

2013-05-11 Thread Chris Angelico
On Sun, May 12, 2013 at 5:55 AM, Robert Kern wrote: >> Another example of temporal coupling is json_decode in PHP: you must >> follow it by a call to json_last_error, otherwise you have no way of >> telling whether the json_decode function succeeded or not. >> >> http://php.net/manual/en/function.

Re: Message passing syntax for objects | OOPv2

2013-05-11 Thread Chris Angelico
On Sun, May 12, 2013 at 5:32 AM, Dennis Lee Bieber wrote: > On Fri, 10 May 2013 14:33:52 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: > >> >> I don't answer to them. I also believe in a path of endless >> exponential growth. Ch

Re: Message passing syntax for objects | OOPv2

2013-05-11 Thread Chris Angelico
On Sun, May 12, 2013 at 10:50 AM, Gregory Ewing wrote: > Dennis Lee Bieber wrote: >>> >>> I also believe in a path of endless >>> exponential growth. Challenge: Create more information than can be >>> stored in one teaspoon of matter. Go ahead. Try! > > > If that's your argument, then you don't re

Re: Message passing syntax for objects | OOPv2

2013-05-11 Thread Chris Angelico
On Sun, May 12, 2013 at 11:02 AM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> On Sun, May 12, 2013 at 5:32 AM, Dennis Lee Bieber >> wrote: > > >>>The coordinates of each particle storing the information in that >>> teaspoon of matter.

Re: Append to python List

2013-05-11 Thread Chris Angelico
On Sun, May 12, 2013 at 12:29 PM, 8 Dihedral wrote: > Chris Angelico於 2013年5月12日星期日UTC+8上午12時00分44秒寫道: >> Most humans would get defensive, or at >> least protest, if treated as bots; Dihedral never has, despite being >> referred to in this way a number of times. >>

Re: Python for philosophers

2013-05-11 Thread Chris Angelico
On Sun, May 12, 2013 at 2:22 PM, rusi wrote: > On May 12, 3:16 am, alex23 wrote: >> On 12 May, 06:10, Mark Janssen wrote: >> >> > Wow. You must be from another planet. Find Socrates if you wish to >> > know these things. He's from there also. >> >> Now now, there's no need for a turf war, the

Old version docs don't link to current version

2013-05-12 Thread Chris Angelico
Not sure if this is an oversight or something deliberate... could be either. >From http://docs.python.org/3.0/library/http.server.html there's no link to the current docs, even though from http://docs.python.org/3/library/http.server.html it's possible to switch to 3.2 and then back to 3.3 (or to

Re: Python for philosophers

2013-05-12 Thread Chris Angelico
On Mon, May 13, 2013 at 12:17 AM, Citizen Kant wrote: > Maybe It'd be good if I explain myself a bit more. What I'm trying here is > to grasp Python from the game's abstraction point of view, as if it were, > for example, chess. Maybe you're going for something a little too complicated. Let's boi

Re: in need of some help...

2013-05-12 Thread Chris Angelico
On Mon, May 13, 2013 at 1:59 AM, Chris “Kwpolska” Warrick wrote: > On Sun, May 12, 2013 at 12:20 AM, Jens Thoms Toerring > wrote: >> PS: If I may ask you a favor: consider refraining from using Google's >> completely broken interface to newsgroups - your post consis

Re: Python for philosophers

2013-05-12 Thread Chris Angelico
On Mon, May 13, 2013 at 4:13 AM, llanitedave wrote: > On Sunday, May 12, 2013 7:51:28 AM UTC-7, Chris Angelico wrote: >> On Mon, May 13, 2013 at 12:17 AM, Citizen Kant wrote: >> >> > Maybe It'd be good if I explain myself a bit more. What I'm trying here i

Re: Old version docs don't link to current version

2013-05-12 Thread Chris Angelico
On Mon, May 13, 2013 at 5:32 AM, Terry Jan Reedy wrote: > On 5/12/2013 10:12 AM, Chris Angelico wrote: >> >> Was this intentional, along the lines of not touching the old and >> unsupported docs? > > Cross referencing was added while 3.2 docs were still subject

Re: in need of some help...

2013-05-12 Thread Chris Angelico
On Mon, May 13, 2013 at 7:56 AM, Jens Thoms Toerring wrote: > Chris “Kwpolska” Warrick wrote: >> Gmail automatically hides long quotes. This is helpful in situations >> like this one. More mail software should implement that >> functionality. Seriously: once you go Gma

Re: in need of some help...

2013-05-12 Thread Chris Angelico
On Mon, May 13, 2013 at 8:58 AM, Jens Thoms Toerring wrote: > Chris Angelico wrote: >> On Mon, May 13, 2013 at 7:56 AM, Jens Thoms Toerring >> wrote: >> > Chris “Kwpolska” Warrick wrote: >> >> Gmail automatically hides long quotes. This is helpful in s

Re: in need of some help...

2013-05-12 Thread Chris Angelico
On Mon, May 13, 2013 at 9:47 AM, Dennis Lee Bieber wrote: > On Mon, 13 May 2013 08:18:05 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: > >> >> No, Chris (not me, the other Chris... *an*other Chris okay, one of >> the chorus of Chri

Re: object.enable() anti-pattern

2013-05-13 Thread Chris Angelico
On Mon, May 13, 2013 at 4:32 PM, Fábio Santos wrote: > > On 13 May 2013 00:22, "Greg Ewing" wrote: >> The same argument can be applied to: >> >>foo = Foo() >>foo.do_something() >>foo.enable() # should have done this first >> >> You're passing an invalid input to Foo.do_something, >> n

Re: Python for philosophers

2013-05-13 Thread Chris Angelico
On Tue, May 14, 2013 at 12:53 AM, rusi wrote: > int fact(int n, int acc) > { > return !n? acc : fact(n-1,acc*n); > } > - > When I run these, the C happily keeps giving answers until a million > > However examined closely we find that though the C is giving answers

Re: Python's sad, unimaginative Enum

2013-05-13 Thread Chris Angelico
On Mon, May 13, 2013 at 8:17 PM, Steven D'Aprano wrote: > Let's look at his major criticisms: > > 1) values aren't automatically generated. > > True. So what? That is the *least* important part of enums. I stopped following the -ideas threads about enums, but IIRC autogeneration of values was in

Re: [Off topic] Software epigrams

2013-05-13 Thread Chris Angelico
On Mon, May 13, 2013 at 7:20 PM, Steven D'Aprano wrote: > My, it's been a long time since I've seen these: > > http://pu.inf.uni-tuebingen.de/users/klaeren/epigrams.html > > They pre-date the Zen of Python by at least a decade, and quite frankly I > think many of them miss the mark. But whether yo

Re: [Off topic] Software epigrams

2013-05-13 Thread Chris Angelico
On Tue, May 14, 2013 at 4:02 AM, Skip Montanaro wrote: >> 8. A programming language is low level when its programs require >> attention to the irrelevant. >> >> So much a matter of debate. Indentation is irrelevant, why should >> Python programs pay attention to it? Block delimiters are irrelevant

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Chris Angelico
On Tue, May 14, 2013 at 4:08 AM, Ned Batchelder wrote: > > On 5/13/2013 1:26 PM, Fábio Santos wrote: > > > On 13 May 2013 11:04, "Alister" wrote: >> this looks to me like an issue with operator precidence >> >> you code is evaluating as (Not x) == y >> rather than not (x == y) > > I can say for s

Re: [Off topic] Software epigrams

2013-05-13 Thread Chris Angelico
On Tue, May 14, 2013 at 1:08 PM, Dan Sommers wrote: > And if I've designed my program the right way, what's relevant in one > place (package, module, function, line of code) is different from what's > relevant in another. Absolutely. Layered systems FTW! Nothing matters but your current layer and

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-14 Thread Chris Angelico
On Tue, May 14, 2013 at 9:22 AM, Dave Angel wrote: > On 05/13/2013 06:53 PM, Mark Lawrence wrote: >> I much prefer the alternative <> for != but some silly people insisted >> that this be removed from Python3. Just how stupid can you get? >> > > So which special methods should the <> operator cal

Re: Writing a blog post on the new Enum.

2013-05-14 Thread Chris Angelico
On Tue, May 14, 2013 at 9:40 AM, Fábio Santos wrote: > Well I am thus defying the law and order of this world by publishing > it on the internets! > > --- > > And here it is: > http://fabiosantoscode.blogspot.pt/2013/05/pythons-new-enum-class.html class Text(unicode, Enum): one = u'on

Re: Writing a blog post on the new Enum.

2013-05-14 Thread Chris Angelico
On Wed, May 15, 2013 at 1:07 AM, Terry Jan Reedy wrote: > On 5/14/2013 3:52 AM, Chris Angelico wrote: >> >> On Tue, May 14, 2013 at 9:40 AM, Fábio Santos >> wrote: > >>> http://fabiosantoscode.blogspot.pt/2013/05/pythons-new-enum-class.html >&

Re: Python for philosophers

2013-05-15 Thread Chris Angelico
On Tue, May 14, 2013 at 4:14 AM, rusi wrote: > It costs $10K for a car which goes at around 80 kmph > > Now if I want to move at 800 kmph I need to switch from car to plane > and that will cost me in millions > > And if I want to move at 8000 kmph I need to be in a rocket in outer > space. Cost pe

Re: Translation API in Python

2013-05-15 Thread Chris Angelico
On Thu, May 16, 2013 at 8:00 AM, Hala Gamal wrote: > I want to use A translator from Arabic to English and reverse in my > application which is written in pyhton, > Is there any open source Translator that can be used with python, > Or Any Suggestion? > Please Help, > Thanks In Advance :) I wou

Re: Fractal

2013-05-16 Thread Chris Angelico
On Thu, May 16, 2013 at 5:11 PM, Ulrich Eckhardt wrote: > Am 16.05.2013 02:00, schrieb alex23: > >> My favourite is this one: >> >> http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python > > > Not only is this blog entry an interesting piece of art, there's other > interestin

Re: Fwd: Fwd: Fwd: Python for philosophers

2013-05-16 Thread Chris Angelico
On Thu, May 16, 2013 at 11:46 PM, rusi wrote: > IOW a programmer is one who quickly and easily comes to the nub/core/ > kernel/essence of a problem and as easily and adroitly shaves off the > irrelevant. +1. This is a fairly good description of a programmer's job. Of course, that's the theoretic

Re: [Off topic] Software epigrams

2013-05-16 Thread Chris Angelico
On Fri, May 17, 2013 at 12:23 AM, Neil Cerutti wrote: > On 2013-05-16, F?bio Santos wrote: >> And in Java we have factories, builders and builderfactories. >> What's so relevant about them? Java is high level, no? > > When I tried to pin down what an irrelevant detail in a computer > program coul

Re: Software epigrams

2013-05-16 Thread Chris Angelico
On Fri, May 17, 2013 at 1:06 AM, rusi wrote: > On May 16, 7:37 pm, Chris Angelico wrote: >> On Fri, May 17, 2013 at 12:23 AM, Neil Cerutti wrote: >> > When I tried to pin down what an irrelevant detail in a computer >> > program could be, I couldn't do

Re: spilt question

2013-05-16 Thread Chris Angelico
On Fri, May 17, 2013 at 1:00 AM, loial wrote: > I want to split a string so that I always return everything BEFORE the LAST > underscore > > HELLO_.lst # should return HELLO > HELLO_GOODBYE_.ls # should return HELLO_GOODBYE > > I have tried with rsplit but cannot get it t

Re: any cherypy powred sites I can check out?

2013-05-16 Thread Chris Angelico
On Fri, May 17, 2013 at 4:17 AM, wrote: > anyone? > -- > http://mail.python.org/mailman/listinfo/python-list You're firing off a bunch of minimal-content threads that ask other people to do work for you. I recommend you put a bit more thought into your posts, and show that you're willing to do a

Re: Two Dictionaries and a Sum!

2013-05-17 Thread Chris Angelico
On Sat, May 18, 2013 at 2:19 PM, Bradley Wright wrote: > Confusing subject for a confusing problem (to a novice like me of course!) > Thx for the help in advance folks > > I have (2) dictionaries: > > prices = { > "banana": 4, > "apple": 2, > "orange": 1.5, > "pear": 3 > } > > stoc

Re: How to write fast into a file in python?

2013-05-17 Thread Chris Angelico
On Sat, May 18, 2013 at 2:01 PM, Steven D'Aprano wrote: > Consider if x is an arbitrary object, and you call "%s" % x: > > py> "%s" % 23 # works > '23' > py> "%s" % [23, 42] # works > '[23, 42]' > > and so on for *almost* any object. But if x is a tuple, strange things > happen Which can be gua

Re: python script is not running

2013-05-18 Thread Chris Angelico
On Sat, May 18, 2013 at 8:12 PM, Avnesh Shakya wrote: > avin@hp:~$ crontab -e > then type - > */2 * * * * python /home/avin/data/try.py > You may need to put an explicit path to your Python interpreter. Type: $ which python and put that into your crontab. ChrisA -- http://mail.python.org/mail

Re: How to write fast into a file in python?

2013-05-18 Thread Chris Angelico
On Sat, May 18, 2013 at 5:49 PM, Fábio Santos wrote: > Putting len(os.linesep)'s value into a local variable will make accessing it > quite a bit faster. But why would you want to do that? > > You mentioned "\n" translating to two lines, but this won't happen. Windows > will not mess with what you

Re: python script is not running

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 3:35 AM, woooee wrote: > The obvious question, do you have the shebang on the first line so the > OS knows it's to be run as a Python program? That won't make any difference; the cron job specifically stipulates the interpreter. It just needs to be done with a full path.

Re: python script is not running

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 4:43 AM, Vincent Vande Vyvre wrote: > Le 18/05/2013 19:59, Chris Angelico a écrit : > >> On Sun, May 19, 2013 at 3:35 AM, woooee wrote: >>> >>> The obvious question, do you have the shebang on the first line so the >>> OS k

Re: Python for philosophers

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 9:56 AM, 8 Dihedral wrote: > Hey, ChisA, are you delibrately to write a recursive version > to demonstrate the stack depth problem in Python? > > def fact(n): >ret=1 >if n>1: # integer checking is not used but can be added > for x in xrange(n): ret*=x >

Re: Please help with Threading

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 10:02 AM, Carlos Nepomuceno wrote: > I didn't know Python threads aren't preemptive. Seems to be something really > old considering the state of the art on parallel execution on multi-cores. > > What's the catch on making Python threads preemptive? Are there any ongoing >

Re: mutable ints: I think I have painted myself into a corner

2013-05-18 Thread Chris Angelico
On Sun, May 19, 2013 at 10:26 AM, Cameron Simpson wrote: > Before I toss this approach and retreat to my former "object" > technique, does anyone see a way forward to modify an int subclass > instance in place? (That doesn't break math, preferably; I don't > do arithmetic with these things but the

Re: any cherypy powred sites I can check out?

2013-05-18 Thread Chris Angelico
On Fri, May 17, 2013 at 10:09 AM, alex23 wrote: > On May 17, 10:00 am, visphatesj...@gmail.com wrote: >> is a cherrypy list accessible here on web thru google groups? > > Is an apology for your offensive response to Chris Angelico > forthcoming? In complete absence of all sembl

Re: any cherypy powred sites I can check out?

2013-05-18 Thread Chris Angelico
On Sat, May 18, 2013 at 3:15 AM, Mark Lawrence wrote: > On 17/05/2013 01:00, visphatesj...@gmail.com wrote: >> >> fuck straight off >> > > I assume you're the author of "How to win friends and influence people"? Not quite. He's the author of the social networking version, "How to win influence an

Re: How to write fast into a file in python?

2013-05-19 Thread Chris Angelico
On Sun, May 19, 2013 at 3:31 PM, Carlos Nepomuceno wrote: > Thanks Dan! I've never used CPython or PyPy. Will try them later. CPython is the "classic" interpreter, written in C. It's the one you'll get from the obvious download links on python.org. ChrisA -- http://mail.python.org/mailman/listi

Re: Harmonic distortion of a input signal

2013-05-19 Thread Chris Angelico
On Sun, May 19, 2013 at 8:52 PM, Anti Log wrote: > total distortion of a harmonics I selected this part of your post, right-clicked, and Chrome offered to do a Google search for those words. And, surprise surprise, the first hit is a page that appears to have the mathematics behind it. Now, I don

Re: Please help with Threading

2013-05-19 Thread Chris Angelico
On Mon, May 20, 2013 at 7:46 AM, Dennis Lee Bieber wrote: > On Sun, 19 May 2013 10:38:14 +1000, Chris Angelico > declaimed the following in gmane.comp.python.general: >> With interpreted code eg in CPython, it's easy to implement preemption >> in the interpreter. I don&#

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 5:05 PM, Frank Millman wrote: > Hi all > > I am trying to emulate a SQL check constraint in Python. Quoting from the > PostgreSQL docs, "A check constraint is the most generic constraint type. It > allows you to specify that the value in a certain column must satisfy a > Bo

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 5:50 PM, Frank Millman wrote: > On 20/05/2013 09:34, Carlos Nepomuceno wrote: >> Why don't you use eval()? >> > > Because users can create their own columns, with their own constraints. > Therefore the string is user-modifiable, so it cannot be trusted. Plenty of reason ri

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 5:55 PM, Carlos Nepomuceno wrote: > I understand your motivation but I don't know what protection > ast.literal_eval() is offering that eval() doesn't. eval will *execute code*, while literal_eval will not. That's the protection. With ast.literal_eval, all that can happen

Re: Please help with Threading

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson wrote: > _lock = Lock() > > def lprint(*a, **kw): > global _lock > with _lock: > print(*a, **kw) > > and use lprint() everywhere? Fun little hack: def print(*args,print=print,lock=Lock(),**kwargs): with lock: print(*args,**

Re: Please help with Threading

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 7:54 PM, Cameron Simpson wrote: > On 20May2013 19:09, Chris Angelico wrote: > | On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson wrote: > | > _lock = Lock() > | > > | > def lprint(*a, **kw): > | > global _lock > | > wi

Re: Please help with Threading

2013-05-20 Thread Chris Angelico
=On Mon, May 20, 2013 at 8:46 PM, Ned Batchelder wrote: > On 5/20/2013 6:09 AM, Chris Angelico wrote: >> >> Referencing a function's own name in a default has to have one of >> these interpretations: >> >> 1) It's a self-reference, which can be used to

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Mon, May 20, 2013 at 11:26 PM, Frank Millman wrote: > 0 - for the first entry in the list, the word 'check' (a placeholder - it is > discarded at evaluation time), for any subsequent entries the word 'and' or > 'or'. > > 1 - left bracket - either '(' or ''. > > 5 - right bracket - either ')' or

Re: Question about ast.literal_eval

2013-05-20 Thread Chris Angelico
On Tue, May 21, 2013 at 2:12 AM, Steven D'Aprano wrote: > Personally, I would strongly suggest writing your own mini- > evaluator that walks the list and evaluates it by hand. It isn't as > convenient as just calling eval, but *definitely* safer. Probably faster, too, for what it's worth - eval i

Re: Please help with Threading

2013-05-20 Thread Chris Angelico
On Tue, May 21, 2013 at 11:44 AM, 8 Dihedral wrote: > OK, if the python interpreter has a global hiden print out > buffer of ,say, 2to 16 K bytes, and all string print functions > just construct the output string from the format to this string > in an efficient low level way, then the next qu

Re: Question about ast.literal_eval

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 4:46 PM, Frank Millman wrote: > You may be right, Chris, but I don't think my approach is all that bad. Frankly, I'm not altogether convinced that our approach is right either :) But like the Oracle in the Matrix, I'm not here to push you to one deci

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 11:12 AM, Cameron Simpson wrote: > Ok, good. Some minor remarks: > > Personally, I always use: > > #!/bin/sh > > instead of requiring bash. All UNIX systems have sh, bash is only > common. And even when present, it may not be in /bin. /bin/sh is > always there, and unless

Re: please help

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 6:38 PM, wrote: > WAP in python to accept a list of words on STDIN and searches for a line > containing all five vowels(a,e,i,o,u) Homework. Have a shot at it yourself, post your code, show that you can put in some effort. Otherwise we won't see much reason to put in ef

Re: sympy.nsimplify

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 6:26 PM, Steven D'Aprano wrote: > For maths nerds like me, this is too cool for words: > > http://www.johndcook.com/blog/2013/04/30/recognizing-numbers/ It is indeed, very cool. I think I need to conjure an excuse to use this someplace. ChrisA -- http://mail.python.org/m

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Chris Angelico
On Tue, May 21, 2013 at 6:21 PM, Jussi Piitulainen wrote: > Chris Angelico writes: > >> > On 20May2013 15:05, Avnesh Shakya wrote: >> > So your call picks a number from 0..58, not 0..59. >> > Say randrange(0,60). Think "start, length". >> >

Re: A computer programmer, web developer and network admin resume

2013-05-21 Thread Chris Angelico
On Wed, May 22, 2013 at 12:32 PM, Tim Chase wrote: > On 2013-05-22 01:15, i...@databaseprograms.biz wrote: >> A computer programmer, web developer and network administrator > > ...walk into a bar... > > So what's the punchline? ;steps up to the mike So yeah, as I was saying, a programmer, a web

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Chris Angelico
On Wed, May 22, 2013 at 4:52 PM, Kevin Xi wrote: > On Wednesday, May 22, 2013 2:23:15 PM UTC+8, C. N. Desrosiers wrote: >> age=raw_input('Enter your age: ') >> if age > 18: > > You can either use `raw_input` to read data and convert it to right type, or > use `input` to get an integer directly. R

Re: Future standard GUI library

2013-05-22 Thread Chris Angelico
On Wed, May 22, 2013 at 11:42 PM, Wolfgang Keller wrote: > What other open-source cross-platform programming language choices do yo > have. > > Java? For GUIs? Excuse me while I vomit. > > C++? As a language for human beings? Oops, I have to throw up again. I personally like using Pike and GTK, s

Re: Translation API in Python

2013-05-22 Thread Chris Angelico
On Wed, May 22, 2013 at 8:16 AM, Hala Gamal wrote: > ok MR, > I have searched before asking here,but i didn't find thing Your post doesn't demonstrate that. When you ask a question like this, it's helpful to give at least some indication of what you've tried and what you haven't. Also, I strongly

Re: What was the project that made you feel skilled in Python?

2013-05-22 Thread Chris Angelico
On Wed, May 22, 2013 at 11:05 PM, Ben Finney wrote: > I wanted to simulate a particular board game, and had others in mind > with some common mechanics. > > This resulted in a library for rolling dice in different combinations, > and looking up result tables https://pypi.python.org/pypi/alea>. Fu

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Chris Angelico
prefixed to everything :) So Kevin, please don't get me wrong: I'm not hating on you, I'm not wishing you hadn't posted. But I *will* speak strongly against the Py2 input() function. :) Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

Re: Future standard GUI library

2013-05-22 Thread Chris Angelico
On Thu, May 23, 2013 at 4:43 PM, Fábio Santos wrote: > On 23 May 2013 03:39, "llanitedave" wrote: >> On Wednesday, May 22, 2013 7:24:15 AM UTC-7, Chris Angelico wrote: >> > there's another option that is available to every platform and >> > (practially)

Re: Future standard GUI library

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 4:58 PM, Carlos Nepomuceno wrote: > You don't! If your app needs local content just use a regular open() (or your > browser) to read the files and render them as you see fit. > > For remote content you just need the 'urllib2' module or something like > 'requests' module t

Re: Newbie question about evaluating raw_input() responses

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 5:11 PM, Terry Jan Reedy wrote: > On 5/23/2013 12:47 AM, Steven D'Aprano wrote: >> >> On Wed, 22 May 2013 22:31:04 +, Alister wrote: >> >>> Please write out 1000 time (without using any form of loop) >>> >>> "NEVER use input in python <3.0 it is EVIL"* > > >> But all jo

Re: 2's Complement in python help.

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 7:54 PM, wrote: > Can anyone give me an idea of how to find the 2's Complement in python with > an example Do you know what two's complement is? (Not to be confused with two's compliment, which is when numbers start telling you how clever you are.) If not, you should pro

Re: Scope of a class..help???

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 7:51 PM, wrote: > i had written the following code i am unable to create the instance of the > class "Node" in the method "number_to_LinkedList" can any one help me how to > do ?? > and what is the error?? It would really help if you post the actual exception and traceb

Re: Scope of a class..help???

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 8:23 PM, wrote: > Thanks Chris Angelico, > i am new to python can you suggest me how to remove the error and solve it. > so,how can i create an instance for "Node" in that function??,is, it not > possible to create an instance in such a way?

Re: file I/O and arithmetic calculation

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 10:37 AM, Carlos Nepomuceno wrote: > >> From: oscar.j.benja...@gmail.com >> Date: Thu, 23 May 2013 01:34:37 +0100 >> Subject: Re: file I/O and arithmetic calculation >> To: carlosnepomuc...@outlook.com >> CC: python-list@python.org >

Re: help in obtaining binary equivalent of a decimal number in python

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 9:30 PM, wrote: > i need to get 32 bit binary equivalent of a decimal and need to change the > 0's to 1's and 1's to 0's > For Example > if the input is 2 > Output should be: > the 32bit equivalent of 2 : 0010 > and the 1's compliment is:

Re: Scope of a class..help???

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 8:25 PM, wrote: > ok Peter Otten, > but how to make a Class global?? He gave some examples. It'd be helpful to quote some of his post, for context... and preferably, show some proof that you've understood it. You're starting a number of threads that look like you're tryi

Re: A computer programmer, web developer and network admin resume

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 10:28 PM, Neil Cerutti wrote: > On 2013-05-22, Tim Chase wrote: >> On 2013-05-22 01:15, i...@databaseprograms.biz wrote: >>> A computer programmer, web developer and network administrator >> >> ...walk into a bar... >> >> So what's the punchline? > > "Ow." Get it? "Ow." B

Re: how to get the socket module compiled with SSL support

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 11:58 PM, Kihup Boo wrote: > I am trying to make an HTTPS connection and read that HTTPS support is only > available if the socket module was compiled with SSL support. > > http://www.jython.org/docs/library/httplib.html > > Can someone elaborate on this? Where can I get th

Re: Error with python 3.3.2 and https

2013-05-23 Thread Chris Angelico
On Fri, May 24, 2013 at 1:48 AM, wrote: > I am trying to write a program that requires me hitting a https web link. > However, I can't seem to get it to work. The program works fine when dealing > with http sites, however, when I try it with a https site I get > > socket.gaierror: [Errno 11001]

Re: Future standard GUI library

2013-05-23 Thread Chris Angelico
On Fri, May 24, 2013 at 1:41 AM, Wolfgang Keller wrote: >> But there's another option that is available to every platform and >> (practially) every high level language: the web browser. Make your app >> serve HTTP and do up your UI in HTML5/CSS3 - your facilities are >> pretty extensive. Plus you

Re: Error with python 3.3.2 and https

2013-05-23 Thread Chris Angelico
On Fri, May 24, 2013 at 2:12 AM, wrote: > I only have the http of the proxy. I guess I could find out the ip of it. > However, even if I use the http proxy address, why would it work for a http > site and not a https site if its the proxy that can't resolve. Can you post working code for HTTP

Re: Error with python 3.3.2 and https

2013-05-23 Thread Chris Angelico
On Fri, May 24, 2013 at 3:49 AM, wrote: > > Yeah that is the case. Once I change the f = opener.open('website') line to a > link that has a https I get that socket error. Nothing else changes. I was > reading online and came across this site which shows you how if the version > of python insta

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-24 Thread Chris Angelico
On Fri, May 24, 2013 at 6:04 PM, wrote: > i need to write a code which can sort the list in order of 'n' without use > builtin functions > can anyone help me how to do? > -- > http://mail.python.org/mailman/listinfo/python-list http://lmgtfy.com/?q=sorting+algorithm http://www.catb.org/esr/faqs

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-24 Thread Chris Angelico
On Fri, May 24, 2013 at 6:14 PM, Peter Brooks wrote: > What is the easiest way to reorder a sequence pseudo-randomly? > > That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg > 2,1,4,3) that is different each time. > > I'm writing a simulation and would like to visit all the nodes

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-24 Thread Chris Angelico
On Fri, May 24, 2013 at 6:47 PM, Fábio Santos wrote: > > On 24 May 2013 09:41, "Chris Angelico" wrote: >> >> On Fri, May 24, 2013 at 6:14 PM, Peter Brooks >> wrote: >> > What is the easiest way to reorder a sequence pseudo-randomly? >> >

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread Chris Angelico
On Fri, May 24, 2013 at 12:44 PM, JackM wrote: > outPut = os.popen( '/sbin/iptables -A INPUT -s' + ' ' + IP + ' ' + > '-j REJECT' ) There's so much about this script that's less than Pythonic, but the one thing I'd really like to see is a log of the exact command being executed. Replace t

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 2:32 AM, JackM wrote: > So Chris, does this version look better? Changed to inFile to with. > Heh, I didn't know you knew about with :) Since you know how to use it, you probably also know why it's useful. Anyway, the main thing is to see the exact comm

Re: Total Beginner - Extracting Data from a Database Online (Screenshot)

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 3:32 AM, wrote: > http://i.imgur.com/KgvSKWk.jpg > > What this is is a publicly-accessible webpage... If that's a screenshot of something that we'd be able to access directly, then why not just post a link to the actual thing? More likely I'm thinking it's NOT publicly ac

Re: Python Magazine

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 1:35 PM, Roy Smith wrote: > "Python 3 vs. IPv6: who will win the race for early adoption?" I think Py3 is winning that one so far. But really, both need to get moving. Neither of my ISPs does IPv6 :( Seconding the recommendation for QOTW, that's good fun. ChrisA -- http

Re: Source code as text/plain

2013-05-24 Thread Chris Rebert
On May 24, 2013 9:02 PM, "Carlos Nepomuceno" wrote: > > I'd like to have the option to download the source code as text/plain from the docs.python.org pages. > > For example: when I'm a docs page, such as: > > http://docs.python.org/2/library/string.html > > and I click the source code link I'm ta

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