Re: One of my joomla webpages has been hacked. Please help.

2012-09-21 Thread Chris Angelico
On Sat, Sep 22, 2012 at 11:42 AM, Steven D'Aprano wrote: > But you asked anyway. Why don't you ask your car mechanic to fix your > plumbing, or go to the doctor to ask advice on how to cook pizza? Or your plumber to rescue the princess who's in another castle... ChrisA -- http://mail.python.org

Re: Does python have built command for package skeleton creation?

2012-09-21 Thread Chris Angelico
On Sat, Sep 22, 2012 at 11:43 AM, Steven D'Aprano wrote: > On Sat, 22 Sep 2012 03:44:55 +1000, Chris Angelico wrote: > >> On Sat, Sep 22, 2012 at 1:54 AM, Steven D'Aprano >> wrote: >>> For a programming language with a lot of corporate use, Python already >

Re: technologies synergistic with Python

2012-09-21 Thread Chris Angelico
On Sat, Sep 22, 2012 at 11:48 AM, Steven D'Aprano wrote: > Integration with Java frameworks and applications? > > Java :-P I asked you not to tell me that! JavaScript/ECMAScript/etc-script isn't that bad a language. It's workable. And thanks to it, my boss now understands pass-by-object semantic

Re: how to do draw pattern with python?

2012-09-21 Thread Chris Angelico
On Sat, Sep 22, 2012 at 5:55 AM, Mark Lawrence wrote: > I tried running your code but got this:- > > c:\Users\Mark>pattern.py > File "C:\Users\Mark\pattern.py", line 22 > > Doing your homework since 2001 > ^ > SyntaxError: invalid syntax > > What am I doing wrong? The problem i

Re: One of my joomla webpages has been hacked. Please help.

2012-09-22 Thread Chris Angelico
On Sat, Sep 22, 2012 at 5:13 PM, Νίκος Γκρεεκ wrote: > The web host company pulled a previous backup and now its all good. > > My apologies for the annoyance i have coused you all i wanted was some > insight so to make sure this wont happen again( it already happened 2 times > by now). Just rea

Re: Blue Screen Python

2012-09-22 Thread Chris Angelico
On Sat, Sep 22, 2012 at 11:07 PM, Steven D'Aprano wrote: > As per their partnership agreement, IBM took over development of OS/2 > version 2 while Microsoft worked on developing version 3. OS/2 2.0 was > significantly improved over the 1.x series. > > Then Microsoft reneged on the agreement to rel

Re: One of my joomla webpages has been hacked. Please help.

2012-09-22 Thread Chris Angelico
On Sun, Sep 23, 2012 at 12:44 AM, Νίκος Γκρεεκ wrote: > But how am i supposed to fix this vulnerability if i don't know which one is > it? > > My guess is they used joomlas template to insert arbitrary code but thats > just a guess. The answer to that is a thing called "research", and you'll us

Re: One of my joomla webpages has been hacked. Please help.

2012-09-22 Thread Chris Angelico
On Sun, Sep 23, 2012 at 4:13 AM, Νίκος Γκρεεκ wrote: > Is there a way to somehow embed(or utilize) python code, for example my > python counter code script you have seen last week inside my Joomla/WordPress > cms sites? You probably could. But I reiterate, you're going about things all backward

Re: One of my joomla webpages has been hacked. Please help.

2012-09-22 Thread Chris Angelico
On Sun, Sep 23, 2012 at 12:52 PM, Νίκος Γκρεεκ wrote: > Τη Σάββατο, 22 Σεπτεμβρίου 2012 9:18:02 μ.μ. UTC+3, ο χρήστης Chris Angelico > έγραψε: >> On Sun, Sep 23, 2012 at 4:13 AM, Νίκος Γκρεεκ wrote: >> >> > Is there a way to somehow embed(or utilize) python code,

Re: One of my joomla webpages has been hacked. Please help.

2012-09-22 Thread Chris Angelico
On Sun, Sep 23, 2012 at 2:48 PM, Dwight Hutto wrote: > On Sun, Sep 23, 2012 at 12:06 AM, Steven D'Aprano > wrote: >> On Sat, 22 Sep 2012 19:52:00 -0700, Νίκος Γκρεεκ wrote: >> >>> Out of curiocity how would i used my python counter source code along >>> with Joomla? >> >> >> This is not a Joomla

Re: One of my joomla webpages has been hacked. Please help.

2012-09-22 Thread Chris Angelico
On Sun, Sep 23, 2012 at 3:18 PM, Dwight Hutto wrote: > On Sun, Sep 23, 2012 at 12:56 AM, Chris Angelico wrote: >> Steven's point is not that we, human beings (or parahuman beings, as >> the case may be), do not know how to run code in Joomla; I've worked >> with

Re: cant install livewires

2012-09-23 Thread Chris Angelico
On Sun, Sep 23, 2012 at 10:05 PM, wrote: > i cant install livewires and their help about making a directory is useless > to me as i dont know how > btw im using windows 7 > REALLY DESPERATE :) May I recommend searching the web for 'make directory windows 7'? That might help. ChrisA -- http://

Re: Capitalization for variable that holds a class

2012-09-23 Thread Chris Angelico
On Mon, Sep 24, 2012 at 1:48 AM, Joshua Landau wrote: > Simple question: > > [myClass() for myClass in myClasses] > vs > [MyClass() for MyClass in myClasses] > > Fight. > > (When considering, substitute in a more real-world example like [Token() for > Token in allTokens] or [token() for token in a

Re: For Counter Variable

2012-09-23 Thread Chris Angelico
On Mon, Sep 24, 2012 at 2:36 AM, jimbo1qaz wrote: > Am I missing something obvious, or do I have to manually put in a counter in > the for loops? That's a very basic request, but I couldn't find anything in > the documentation. You mean, if you want the indices as well as the values? Try the en

Re: List Problem

2012-09-23 Thread Chris Angelico
On Mon, Sep 24, 2012 at 7:44 AM, jimbo1qaz wrote: > On Sunday, September 23, 2012 2:31:48 PM UTC-7, jimbo1qaz wrote: >> I have a nested list. Whenever I make a copy of the list, changes in one >> affect the other, even when I use list(orig) or even copy the sublists one >> by one. I have to manu

Re: List Problem

2012-09-23 Thread Chris Angelico
On Mon, Sep 24, 2012 at 10:56 AM, Littlefield, Tyler wrote: > I've not been following this thread fully, but why not just use x=list(y) to > copy the list? > The issue is that when you assign i=[1,2,3] and then j = i, j is just a > reference to i, which is why you change either and the other chang

Re: Seome kind of unblocking input

2012-09-23 Thread Chris Angelico
On Mon, Sep 24, 2012 at 3:50 AM, Dennis Lee Bieber wrote: > On Sun, 23 Sep 2012 18:13:57 +0100, Mark Lawrence > declaimed the following in > gmane.comp.python.general: > >> On 23/09/2012 16:49, Ramchandra Apte wrote: > >> > You can clear the buffer by calling file.flush() >> > >> >> Shock, horror

metaclass question

2012-09-24 Thread Chris Withers
Hi All, Is there a metaclass-y way I could cause the following: class TheParser(Parser): def handle_ARecord(self): pass def handle_ARecord(self): pass ...to raise an exception as a result of the 'handle_ARecord' name being reused? cheers, Chris --

Re: python file API

2012-09-24 Thread Chris Kaynor
On Mon, Sep 24, 2012 at 2:49 PM, Dave Angel wrote: > > And what approach would you use for positioning relative to > end-of-file? That's currently done with an optional second parameter to > seek() method. > I'm not advocating for or against the idea, but that could be handled the same way index

Re: python file API

2012-09-24 Thread Chris Angelico
On Tue, Sep 25, 2012 at 7:49 AM, Dave Angel wrote: > On 09/24/2012 05:35 PM, zipher wrote: >> Let file-type have an attribute .pos for position. Now you can get rid of >> the seek() and tell() methods and manipulate the file pointer more easily >> with standard arithmetic operations. >> >

Re: keeping information about players around

2012-09-24 Thread Chris Angelico
On Tue, Sep 25, 2012 at 7:14 AM, Dwight Hutto wrote: > Also, If this is a browser app I'd go with phpmyadmin, and MySQL > > If a tkinter/wxpython/etc app, then maybe sqlite. Out of curiosity, why? MySQL isn't magically better for everything where data ends up displayed in a web browser. Unless yo

Re: keeping information about players around

2012-09-24 Thread Chris Angelico
On Tue, Sep 25, 2012 at 8:31 AM, Dwight Hutto wrote: > And in the end it's usually html, php, css, javascript in the browser, > atleast for me it is. I'm just starting to utilize python in that > area, so excuse the naivety. In the browser it's HTML, CSS, JavaScript (ECMAScript, etc, etc); PHP is

Re: python file API

2012-09-24 Thread Chris Angelico
On Tue, Sep 25, 2012 at 8:37 AM, Ian Kelly wrote: > On Mon, Sep 24, 2012 at 4:14 PM, Chris Angelico wrote: >> file.pos = 42 # Okay, you're at position 42 >> file.pos -= 10 # That should put you at position 32 >> foo = file.pos # Presumably foo is the integer 32 >&g

Re: python file API

2012-09-24 Thread Chris Kaynor
On Mon, Sep 24, 2012 at 3:37 PM, Ian Kelly wrote: > On Mon, Sep 24, 2012 at 4:14 PM, Chris Angelico wrote: >> file.pos = 42 # Okay, you're at position 42 >> file.pos -= 10 # That should put you at position 32 >> foo = file.pos # Presumably foo is the integer 32 >&g

Re: For Counter Variable

2012-09-25 Thread Chris Angelico
On Tue, Sep 25, 2012 at 11:32 AM, Dwight Hutto wrote: >> By now I think we're in the DNFTT zone. >> -- > Taking a bite yourself there buddy. Hop under the bridge, and > comment...it make you a troll, and you're trying to feed yourself with > pile on comment from the rest of the under bridge dwelle

Re: For Counter Variable

2012-09-25 Thread Chris Rebert
t; I'm toying more and more with the go language. I really >> appreciate and rediscover the strictness I learned with >> Pascal. > > So go and use go as nobody here is stopping you. Well, the PSU might, except they emphatically do not exist... Cheers, Chris -- PEP-401 compliant -- http://mail.python.org/mailman/listinfo/python-list

Re: For Counter Variable

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 12:19 AM, Steven D'Aprano wrote: > On Tue, 25 Sep 2012 11:16:40 +0100, Mark Lawrence wrote: > >> On 25/09/2012 10:53, Chris Rebert wrote: >> >> [snip] >> >>> Well, the PSU might, except they emphatically do not exist... >>

Re: new-style class or old-style class?

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 12:44 AM, Jayden wrote: > In learning Python, I found there are two types of classes? Which one are > widely used in new Python code? Is the new-style much better than old-style? > Thanks!! Definitely go with new-style. In Python 3, old-style classes aren't supported, an

Re: data attributes override method attributes?

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 12:54 AM, Peter Otten <__pete...@web.de> wrote: > To me > > "Data attributes override method attributes with the same name" > > implies that data attributes take precedence over method attributes, not > that they replace them only when there is an assignment of data after th

Re: python file API

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 2:07 AM, Dennis Lee Bieber wrote: > f.pos += delta > > would be a "seek.set" and with a naive driver might trigger a rewind to > the start of the tape followed by a seek to the absolute position, > whereas the seek from current location would only move the tape by t

Re: Article on the future of Python

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 10:54 AM, Steven D'Aprano wrote: > SQL? ... it's time to sell your shares in Oracle. Ehh, I wouldn't be investing in Oracle, but that's more because I think free RDBMSes like PostgreSQL outshine it. And this is even more true of MS SQL Server - this last week I've been res

Re: Article on the future of Python

2012-09-25 Thread Chris Angelico
On Wed, Sep 26, 2012 at 3:16 PM, Steven D'Aprano wrote: > On Wed, 26 Sep 2012 14:10:28 +1000, Chris Angelico wrote: > >> The flip side to node.js is pyjs. > > After the ham-fisted, nasty way pyjamas project was hijacked this year, > I'm not entirely sure I'

Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Wed, Sep 26, 2012 at 5:39 PM, Dwight Hutto wrote: > On Wed, Sep 26, 2012 at 3:17 AM, Ethan Furman wrote: >> wxjmfa...@gmail.com wrote: >>> >>> Py 3.3 succeeded to somehow kill unicode and it has >>> been transformed into an "American" product for >>> "American" users. >> > Well, we can all use

Re: regular expression : the dollar sign ($) work with re.match() or re.search()

2012-09-26 Thread Chris Angelico
On Wed, Sep 26, 2012 at 5:48 PM, Jussi Piitulainen wrote: > What was the weird character that you used as a question mark? I > removed them because they confuse the newsreader I use. It appears to be Unicode Character 'FULLWIDTH QUESTION MARK' (U+FF1F). Normally I'd be inclined to simply use U+00

Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Wed, Sep 26, 2012 at 6:34 PM, Mark Lawrence wrote: > Further for somebody who is apparently up in the high tech world, why are > you using a gmail account and hence sending garbage in more ways than one to > mailing lists like this? I use gmail too, largely because I prefer to keep mailing lis

Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Wed, Sep 26, 2012 at 7:31 PM, wrote: > you are correct. But the price you pay for this is extremely > high. Now, practically all characters are affected, espacially > those *in* the Basic *** Multilingual*** Plane, these characters > used by non "American" user (No offense here, I just use thi

Re: Looking for pointers/suggestion - how to make a webbrowser with these restriction?

2012-09-26 Thread Chris Angelico
On Wed, Sep 26, 2012 at 6:23 PM, Anthony Kong wrote: > Hi, all, > > It is kind of a MacGyver question. I am just looking for some general > suggestions/pointer. > > First let me first describe the development environment I am in: it is a > locked down WinXP PC with limited development tools and

Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Wed, Sep 26, 2012 at 10:19 PM, wrote: > You are always selling the same argument. > Py3.3 is the only computer language I'm aware of which > is maltreating Unicode in such a way. You mean, the only computer language that represents Unicode characters as integers, and then stores them as an ar

Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Wed, Sep 26, 2012 at 11:43 PM, Mark Lawrence wrote: > On 26/09/2012 14:31, Littlefield, Tyler wrote: > >> >> PS: Anyone know if rantingrik had relatives? ;) >> > > I say steady on old chap that's just not cricket. I've been known to have a > go at rr in the past for good reasons, but when he g

Re: Looking for pointers/suggestion - how to make a webbrowser with these restriction?

2012-09-26 Thread Chris Angelico
On Wed, Sep 26, 2012 at 8:41 PM, Anthony Kong wrote: > Hi, Chris, > > Thanks for your reply. I really do not have any requirement. It is more a > curiosity question (not work related). I'd like to find out how python can be > used to 'glue' all these moving p

Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Thu, Sep 27, 2012 at 12:19 AM, wrote: > No, I'm comparing Py33 with Py32 narrow build [*]. Then look at the broken behaviour that Python, up until now, shared with Javascript and various other languages, in which a one-character string appears as two characters, and slicing and splicing strin

Re: Article on the future of Python

2012-09-26 Thread Chris Angelico
On Thu, Sep 27, 2012 at 12:50 AM, wrote: > I just see the results and the facts. For an end > user, this is the only thing that counts. Then what counts is that Python 3.2 (like Javascript) exhibits incorrect behaviour, and Python (like Pike) performs correctly. I think this tee applies to you.

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: How to pass FILE *

2012-09-28 Thread Chris Rebert
ch: http://stackoverflow.com/questions/3794309/python-ctypes-python-file-object-c-file/3794401#3794401 Related POSIX docs: http://pubs.opengroup.org/onlinepubs/009695399/functions/fdopen.html Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

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: [Python-Dev] experimental: Misc/NEWS included in docs

2012-09-30 Thread Chris Jerdonek
if there was guidance on that -- even if to say it completely doesn't matter. --Chris -- http://mail.python.org/mailman/listinfo/python-list

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: Why is pylaucher in Python 3.3 being installed in Windows folder?

2012-10-03 Thread Chris Rebert
): "However, the Windows directory is always on the path." Now, as for why the launcher must be on the $PATH…*shrugs* Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

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

2012-10-03 Thread Chris Rebert
27;s arguably still the issue of len() and friends (vs. `.length` etc.), and also of `self` being explicit. Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

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: Unpaking Tuple

2012-10-06 Thread Chris Rebert
l change dynamically. Then you arguably want a list, not a tuple. But at any rate: shortfall = 4 - len(your_tuple) your_tuple += (None,) * shortfall # assuming None is a suitable default a, b, c, d = your_tuple If you also need to handle the "too many items" case, use slici

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: question on log as an instance method

2012-10-07 Thread Chris Rebert
l) logarithm of" a built-in, overloadable operation (hence, in part, why you had to `import math` to even be able to access that calculation). And it further didn't happen to define math.log() in terms of a .log() or .__log__() instance method. Basically, it's somewhat arbitrary a

Re: getting the state of an object

2012-10-07 Thread Chris Rebert
quot;, you're doing it wrong. That said, you can obtain the names of the parameters using the `inspect` module in the std lib. > __dict__ gives it but not in order… You can actually "fix" that, not that I at all recommend doing so: http://docs.python.org/dev/reference/datamodel.html#preparing-the-class-namespace Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: question on log as an instance method

2012-10-07 Thread Chris Rebert
se an invalid address, then please make use of the ".invalid" TLD (that's what it's for!). Regards, Chris -- http://mail.python.org/mailman/listinfo/python-list

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: Insert item before each element of a list

2012-10-08 Thread Chris Kaynor
On Mon, Oct 8, 2012 at 12:28 PM, wrote: > What's the best way to accomplish this? Am I over-complicating it? My > gut feeling is there is a better way than the following: > > >>> import itertools > >>> x = [1, 2, 3] > >>> y = list(itertools.chain.from_iterable(('insertme', x[i]) for i in > rang

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;

<    11   12   13   14   15   16   17   18   19   20   >