Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Chris Angelico
On Tue, Jul 23, 2013 at 8:06 PM, Duncan Booth duncan.booth@invalid.invalid wrote: Excellent idea, I'll tell the email forwarding service to rewrite their system immediately. Yes. If they are using your domain in the MAIL FROM command and not using your mail servers, then yes, you should tell

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

2013-07-23 Thread Chris Angelico
On Wed, Jul 24, 2013 at 1:12 AM, Michael Torrie torr...@gmail.com wrote: On 07/23/2013 03:30 AM, Chris Angelico wrote: On Tue, Jul 23, 2013 at 7:19 PM, Chris Angelico ros...@gmail.com wrote: Ah, there's a solution to this one. You simply use your own envelope-from address; SPF shouldn't

Re: Converting a list of lists to a single list

2013-07-23 Thread Chris Angelico
On Wed, Jul 24, 2013 at 8:34 AM, Rafael Durán Castañeda rafadurancastan...@gmail.com wrote: In [3]: [ y for y in itertools.chain.from_iterable(x)] Out[3]: ['A0', 'A1', 'A2', 'B0', 'B1', 'B2', 'C0', 'C1', 'C2'] Complete aside, given that this has already been pointed out as solving a different

Re: Strange behaviour with os.linesep

2013-07-24 Thread Chris Angelico
On Wed, Jul 24, 2013 at 5:02 PM, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: In fact, in my code, the original file is open in binary mode, the line separator is translate to \n and it is parsed by the module tokenise. I'm not a Windows user but my code must be run also on Win, this

Re: i want to run user specific cronjobs so where to specify user in ubuntu?

2013-07-24 Thread Chris Angelico
On Wed, Jul 24, 2013 at 5:47 PM, navnathgad...@gmail.com wrote: -- http://mail.python.org/mailman/listinfo/python-list Not a Python question. I'm sure Google can help you with this one - just take three words from your question, 'user specific cronjobs', and you'll get plenty of advice.

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Wed, Jul 24, 2013 at 11:40 PM, wxjmfa...@gmail.com wrote: Short example. Writing an editor with something like the FSR is simply impossible (properly). jmf, have you ever written an editor with *any* string representation? Are you speaking from any level of experience at all? ChrisA --

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 12:17 AM, David Hutto dwightdhu...@gmail.com wrote: I've screwed up plenty of times in python, but can write code like a pro when I'm feeling better(on SSI and medicaid). An editor can be built simply, but it's preference that makes the difference. Some might have used

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 12:47 AM, Michael Torrie torr...@gmail.com wrote: On 07/24/2013 07:40 AM, wxjmfa...@gmail.com wrote: Sorry, you are not understanding Unicode. What is a Unicode Transformation Format (UTF), what is the goal of a UTF and why it is important for an implementation to work

Re: how: embed + extend to control my running app?

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 2:10 AM, David M. Cotter m...@davecotter.com wrote: So: i really want it to go to my own log file (via my Log() function). now, can i specify please output to this FILE* ?, i looked at all the python c headers but found nothing about redirecting the output. Are you

Re: Python 3: dict dict.keys()

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 1:57 AM, Ethan Furman et...@stoneleaf.us wrote: On 07/24/2013 05:51 AM, Oscar Benjamin wrote: What do you mean? Why would you want to create a temporary list just to iterate over it explicitly or implicitly (set, sorted, max,...)? You wouldn't. But you don't need

Re: Python 3: dict dict.keys()

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 3:17 AM, Terry Reedy tjre...@udel.edu wrote: On 7/24/2013 12:34 PM, Chris Angelico wrote: Side point: Why is iterating over a dict equivalent to .keys() rather than .items()? It feels odd that, with both options viable, the implicit version iterates over half the dict

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 3:52 AM, Terry Reedy tjre...@udel.edu wrote: On 7/24/2013 11:00 AM, Michael Torrie wrote: On 07/24/2013 08:34 AM, Chris Angelico wrote: Frankly, Python's strings are a *terrible* internal representation for an editor widget - not because of PEP 393, but simply because

Re: Dihedral

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 4:08 AM, Stefan Behnel stefan...@behnel.de wrote: Fábio Santos, 16.07.2013 00:54: Does this mean he passes the Turing test? I'd say that it appears more correct. Or is there any indication of a specific bot gender? (I sure might have missed it...) Note that being of

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 8:09 AM, Terry Reedy tjre...@udel.edu wrote: On 7/24/2013 2:15 PM, Chris Angelico wrote: To my mind, exposing UTF-16 surrogates to the application is a bug to be fixed, not a feature to be maintained. It is definitely not a feature, but a proper UTF-16 implementation

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 8:59 AM, Michael Torrie torr...@gmail.com wrote: I don't fully understand why making strings simply unicode in javascript breaks compatibility with older scripts. What operations are performed on strings that making unicode an abstract type would break? Imagine this

Re: I have a little problem with Django when I am trying to create a new app

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 12:03 PM, peins0...@gmail.com wrote: Hello everyone I'm watching a tutorial on how to create a project on Django... django-admin.py startproject carabali when I run this code on terminal.. happens : http://nsae01.casimages.net/img/2013/07/25/130725021220676239.png

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 3:49 PM, Serhiy Storchaka storch...@gmail.com wrote: 24.07.13 21:15, Chris Angelico написав(ла): To my mind, exposing UTF-16 surrogates to the application is a bug to be fixed, not a feature to be maintained. Python 3 uses code points from U+DC80 to U+DCFF (which

Re: Python 3: dict dict.keys()

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 3:48 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Dicts aren't sets, and don't support set methods: py d1 - d2 Traceback (most recent call last): File stdin, line 1, in module TypeError: unsupported operand type(s) for -: 'dict' and 'dict' I

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 5:02 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 25 Jul 2013 00:34:24 +1000, Chris Angelico wrote: But mainly, I'm just wondering how many people here have any basis from which to argue the point he's trying to make. I doubt most of us have

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 5:15 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 25 Jul 2013 04:15:42 +1000, Chris Angelico wrote: If nobody had ever thought of doing a multi-format string representation, I could well imagine the Python core devs debating whether the cost

Re: Python 3: dict dict.keys()

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 5:04 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: - Views support efficient (O(1) in the case of keys) membership testing, which neither iterkeys() nor Python2 keys() does. To save me the trouble and potential error of digging through the source code:

Re: Python 3: dict dict.keys()

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 5:27 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 25 Jul 2013 16:02:42 +1000, Chris Angelico wrote: On Thu, Jul 25, 2013 at 3:48 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Dicts aren't sets, and don't support set methods

Re: must be dicts in tuple

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 4:58 PM, Tanaya D cool.tanay...@gmail.com wrote: Hi, I am using Python with Bots(EDI translator) But i am getting the following error: MappingFormatError: must be dicts in tuple: get((({'BOTSID': 'HEADER'},),)) The first thing to do is to construct a short piece of

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 7:22 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: What I'm trying to say is that it is possible to use UTF-16 internally, but *not* assume that every code point (character) is represented by a single 2-byte unit. For example, the len() of a UTF-16

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 7:27 PM, wxjmfa...@gmail.com wrote: A coding scheme works with a unique set of characters (the repertoire), and the implementation (the programming) works with a unique set of encoded code points. The critical step is the path {unique set of characters} -- {unique set

Re: Python 3: dict dict.keys()

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 7:44 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 25 Jul 2013 18:15:22 +1000, Chris Angelico wrote: That's true, but we already have that issue with sets. What's the union of {0} and {0.0}? Python's answer: It depends on the order

Re: Python 3: dict dict.keys()

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 12:57 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: [ snip lengthy explanation of sets ] The union operator ought to be symmetrical, a ∪ b should be identical to b ∪ a, but isn't. Another leaky abstraction. Right. I agree with all your theory, which

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 1:26 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 25 Jul 2013 14:36:25 +0100, Jeremy Sanders wrote: To conserve memory, Emacs does not hold fixed-length 22-bit numbers that are codepoints of text characters within buffers and strings. Rather,

Re: Is it that easy to install Python ?

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 2:36 AM, Irmen de Jong irmen.nos...@xs4all.nl wrote: On 25-7-2013 17:11, santiago.d...@caoba.fr wrote: Hi there, I never write any Python program but as a system administrator, I'm often asked to install python on Debian servers. I just finished downloading,

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 3:18 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 26 Jul 2013 01:36:07 +1000, Chris Angelico wrote: On Fri, Jul 26, 2013 at 1:26 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 25 Jul 2013 14:36:25 +0100, Jeremy

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 5:07 AM, wxjmfa...@gmail.com wrote: Let start with a simple string \textemdash or \texttendash sys.getsizeof('–') 40 sys.getsizeof('a') 26 Most of the cost is in those two apostrophes, look: sys.getsizeof('a') 26 sys.getsizeof(a) 8 Okay, that's slightly unfair

Re: Help

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 6:06 AM, ty...@familyrobbins.com wrote: I'm a bit new to python and I'm trying to create a simple program which adds words and definitions to a list, and then calls them forward when asked to. One of the most important tidbits of information is: What version of Python

Re: Python Script Hashplings

2013-07-26 Thread Chris Angelico
On Fri, Jul 26, 2013 at 11:37 AM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: On 07/25/2013 09:54 AM, MRAB wrote: On 25/07/2013 14:42, Devyn Collier Johnson wrote: If I execute a Python3 script with this haspling (#!/usr/bin/python3.3) and Python3.3 is not installed, but Python3.2

Re: Python Script Hashplings

2013-07-26 Thread Chris Angelico
On Fri, Jul 26, 2013 at 2:53 PM, MRAB pyt...@mrabarnett.plus.com wrote: If you want to test what would happen if that version wasn't installed, set the shebang line to a future version, such as Python 3.4. I doubt you have that installed! :-) Be careful, some people DO have a python3.4 binary

Re: dump a multi dimensional dictionary

2013-07-26 Thread Chris Angelico
On Fri, Jul 26, 2013 at 9:21 PM, cerr ron.egg...@gmail.com wrote: mylist = [] mydict = {} mylist = '1','2' Side point: mylist is no longer a list, it's a tuple. I don't think pickle has problems with tuples, but it's worth noting that difference. ChrisA --

Re: Cross-Platform Python3 Equivalent to notify-send

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 1:22 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: That really sucks. I was hoping Python had some way of doing that. All that it needs to do is display a little box at one of the corners of the screen. I thought someone would have implemented something by

Re: Understanding other people's code

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 2:13 PM, Albert van der Horst alb...@spenarnc.xs4all.nl wrote: If the code is really tidy, it is possible to understand a function using only the *documentation* (not the code itself) of any function or data it uses. I'd broaden that slightly to the function's

Re: Critic my module

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 2:19 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: About the aliases, I have tried setting pwd() as an alias for os.getcwd(), but I cannot type pwd() and get the desired output. Instead, I must type pwd. I tested this in Guake running Python3.3. os.getcwd()

Re: Critic my module

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 3:53 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: Would a Python3 game module be more useful? I plan to make a function that rolls a die and prints the output (You got a 5) and other similar random games. Taking someone else's module and learning to use it

Re: Cross-Platform Python3 Equivalent to notify-send

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 4:59 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 27 Jul 2013 08:22:00 -0400, Devyn Collier Johnson wrote: That really sucks. I was hoping Python had some way of doing that. All that it needs to do is display a little box at one of the corners

Re: python import module question

2013-07-27 Thread Chris Angelico
On Sun, Jul 28, 2013 at 12:15 AM, syed khalid sy...@pacificloud.com wrote: Syedk@syedk-ThinkPad-T410:~/shogun-2.0.0/src/interfaces/cmdline_static$ shogun | more This implies that you have something called 'shogun', without an extension, in your $PATH. Where is the actual script? You may need

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 4:52 PM, Michael Torrie torr...@gmail.com wrote: Is my understanding of these things wrong? No, your understanding of those matters is fine. There's just one area you seem to be misunderstanding; you appear to think that jmf actually cares about logical argument. I gave

Re: [Savoynet] GS Opera Co: Pirates of Penzance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 6:36 PM, David Patterson david.w.patter...@btopenworld.com wrote: By the way, Chris, I think the book that Ruth brought on was probably supposed to be Debretts Peerage. I couldn't see the cover clearly but it would have been a more logical choice in view of the

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 6:36 PM, Terry Reedy tjre...@udel.edu wrote: I posted about a week ago, in response to Chris A., a method by which lookup for UTF-16 can be made O(log2 k), or perhaps more accurately, O(1+log2(k+1)), where k is the number of non-BMP chars in the string. Which is an

Re: RE Module Performance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 7:19 PM, Joshua Landau jos...@landau.ws wrote: On 28 July 2013 09:45, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: utf-8 or any (utf) never need and never spend their time in reencoding. So? That python sometimes

Re: [Savoynet] GS Opera Co: Pirates of Penzance

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 12:49 AM, Ethan Furman et...@stoneleaf.us wrote: On 07/28/2013 10:57 AM, Chris Angelico wrote: . . . Okay, how did you get confused that this was a Python List question? ;) *sigh* Because I still haven't gotten around to switching mail clients to one

Re: programming course

2013-07-29 Thread Chris Angelico
On Sat, Jul 27, 2013 at 1:28 PM, aliencat...@gmail.com wrote: Hi, A good step by step easy book on Python is: Start Here: Python 3x Programming Made Fun and Easier, at http://www.quantum-sight.com This is a Usenet group and a mailing list, not a web forum. You do not need to dig up a dozen

Re: RE Module Performance

2013-07-29 Thread Chris Angelico
On Sun, Jul 28, 2013 at 11:14 PM, Joshua Landau jos...@landau.ws wrote: GC does have sometimes severe impact in memory-constrained environments, though. See http://sealedabstract.com/rants/why-mobile-web-apps-are-slow/, about half-way down, specifically

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 12:43 PM, wxjmfa...@gmail.com wrote: Le dimanche 28 juillet 2013 22:52:16 UTC+2, Steven D'Aprano a écrit : 3.2 timeit.timeit(r = dir(list)) 22.300465007102908 3.3 timeit.timeit(r = dir(list)) 27.13981129541519 3.2: len(dir(list)) 42 3.3: len(dir(list)) 45

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 3:20 PM, wxjmfa...@gmail.com wrote: c:\python32\pythonw -u timitmod.py 15.258061416225663 Exit code: 0 c:\Python33\pythonw -u timitmod.py 17.052203122286194 Exit code: 0 len(dir(C)) Did you even think to check that before you posted timings? ChrisA --

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 5:09 PM, MRAB pyt...@mrabarnett.plus.com wrote: I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats are approximate anyway, and the float value 1/3 is more likely to be Fraction(1, 3) than Fraction(6004799503160661, 18014398509481984). At what point

Re: What do you do when a library is outdated?

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 5:14 PM, Matt mattgrav...@gmail.com wrote: I'm fairly new to python but have experience in other languages. What do you generally do when a library is outdated? I asked a question on a few forums and everyone has been pointing me to Mechanize, but it will not work with

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 5:40 PM, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Jul 29, 2013 at 10:20 AM, Chris Angelico ros...@gmail.com wrote: On Mon, Jul 29, 2013 at 5:09 PM, MRAB pyt...@mrabarnett.plus.com wrote: I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats

Re: Bitwise Operations

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 12:34 AM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: I understand the symbols. I want to know how to perform the task in a script or terminal. I have searched Google, but I never saw a command. Typing 101 010 or x = (int(101, 2) int(010, 2)) only gives

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 8:16 PM, Tim jtim.arn...@gmail.com wrote: My intent is to pass it a directory name or path and if it exists, use shutil.rmtree to remove whatever is there (if it isn't a directory, try to unlink it); then use os.makedirs to create a new directory or path: def

Re: Bitwise Operations

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 12:48 AM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: Now here is something that confuses me, the binary numbers are numbers not strings, so why are they put in quotes as if they are strings? They aren't numbers at that point, they're strings of digits. A number

Re: Pyglet on Python3.x, problems

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 1:47 AM, John Ladasky john_lada...@sbcglobal.net wrote: I'm getting one problem. After a few tests run, I can't close a window. I am normally closing each interactive test with the ESC key. But when that fails I try clicking with the mouse. This also fails. This

Re: SQLite logic error or missing database

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 3:02 AM, CM cmpyt...@gmail.com wrote: If I try additional commits in that same instance of my app being open, it gives me the same error every time. If I close the app and re-open it, it does not give me this error, with the same or very similar data being written in

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 2:10 PM, Tim jtim.arn...@gmail.com wrote: hmm, now that you mention it, this is executing on a remote box with access to the same file system my local calling program is on. That is, there is a local call to an intermediate script that connects to a socket on the

Re: RE Module Performance

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 3:01 PM, wxjmfa...@gmail.com wrote: I am pretty sure that once you have typed your 127504 ascii characters, you are very happy the buffer of your editor does not waste time in reencoding the buffer as soon as you enter an €, the 125505th char. Sorry, I wanted to say z

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 3:07 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 30 Jul 2013 14:27:10 +0100, Chris Angelico wrote: for delay in 100,300,600,1000,3000,5000,1: if not os.path.exists(directory): break sleep(delay) That'll sleep a maximum of 20

Re: Python script help

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 3:49 PM, cool1...@gmail.com wrote: Hello, I am looking for a script that will be able to search an online document (by giving the script the URL) and find all the downloadable links in the document and then download them automatically. I appreciate your help, Thank

Re: Python script help

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 4:49 PM, cool1...@gmail.com wrote: I know but I think using Python in this situation is good...is that the full script? That script just drops out to the system and lets wget do it. So don't bother with it. ChrisA --

Re: Share Code: Laptop Lid State

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 3:06 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: Aloha everyone! I attached a script that I thought I could share with everyone for your help. This Python3 script only works on Unix systems. It prints the current state of the lid. This can be used to

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 4:37 PM, Tim jtim.arn...@gmail.com wrote: Argg, this isn't the first time I've had troubles with the file system. This is FreeBSD and NFS. I will code up a progressive delay as you mentioned (with Steve's correction). I've used several different networked file

Re: Python script help

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 5:10 PM, cool1...@gmail.com wrote: What if I want to use only Python? is that possible? using lib and lib2? -- http://mail.python.org/mailman/listinfo/python-list Sure, anything's possible. And a lot easier if you quote context in your posts. But why do it? wget is

Re: RE Module Performance

2013-07-30 Thread Chris Angelico
On Tue, Jul 30, 2013 at 8:09 PM, wxjmfa...@gmail.com wrote: Matable, immutable, copyint + xxx, bufferint, O(n) Yes, but conceptualy the reencoding happen sometime, somewhere. The internal ucs-2 will never automagically be transformed into ucs-4 (eg). But probably not on the entire

Re: Share Code: Laptop Lid State

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 4:05 AM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: On 07/30/2013 12:00 PM, Chris Angelico wrote: On Tue, Jul 30, 2013 at 3:06 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: Aloha everyone! I attached a script that I thought I could share

Re: RE Module Performance

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 6:45 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: if you care about minimizing every possible byte, you should use a low-level language like C. Then you can give every character 21 bits, and be happy that you don't waste even one bit. Could go better!

Re: Repository of non-standard modules.

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 11:53 AM, Gabor Urban urbang...@gmail.com wrote: Hi, I am to start a new free-time project in the next couple of weeks. I am ready to use open accessible Python modules not wanting to reinvent the weel :-) Is there any repository where I can find Python modules not

Re: import syntax

2013-07-31 Thread Chris Angelico
On Mon, Jul 29, 2013 at 11:37 PM, Joshua Landau jos...@landau.ws wrote: 2d) Realise that the slow part is not what you thought it was This step is mandatory. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 1:39 PM, Beth McNany beth.mcn...@gmail.com wrote: ok, ok, if you *really* want it, you could keep track of how many leading spaces there are (you are using spaces, right?), and insert an open bracket where that number increases and a closing bracket where it decreases.

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 3:07 PM, Rotwang sg...@hotmail.co.uk wrote: # Assumes spaces OR tabs but not both # Can't see an easy way to count leading spaces other than: # len(s)-len(s.lstrip()) How about len(s.expandtabs()) - len(s.lstrip()) instead? Still comes to the same thing. The only

Re: RE Module Performance

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 9:15 PM, wxjmfa...@gmail.com wrote: ... char never consumes or requires more than 4 bytes ... The integer 5 should be able to be stored in 3 bits. sys.getsizeof(5) 14 Clearly Python is doing something really horribly wrong here. In fact, sys.getsizeof needs to be

Re: Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 8:02 PM, Grant Edwards invalid@invalid.invalid wrote: On 2013-07-31, Skip Montanaro s...@pobox.com wrote: I don't understand. That just moves them to a different file -- doesn't it? You've still got to deal with editing a large table of data (for example when I want

Re: Using system python vs. updated/current version

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 7:35 PM, memilanuk memila...@gmail.com wrote: Also... in some places in the 'Net I see references to installing everything 'locally' via pip, etc. in virtualenvs and not touching the system installed version of python... yet most linux distros seem to have many/most

Oddity with 'yield' as expression - parentheses demanded

2013-08-01 Thread Chris Angelico
Was playing around with yield inside a lambda and ran into a distinct oddity. Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 foo=lambda x: yield(x) SyntaxError: invalid syntax def foo(x): return yield(x) SyntaxError: invalid syntax def

Re: Unexpected results comparing float to Fraction

2013-08-01 Thread Chris Angelico
On Thu, Aug 1, 2013 at 7:20 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I know this, and that's not what surprised me. What surprised me was that Fraction converts the float to a fraction, then compares. It surprises me because in other operations, Fractions down-cast to

Re: Unexpected results comparing float to Fraction

2013-08-01 Thread Chris Angelico
On Thu, Aug 1, 2013 at 10:44 AM, Oscar Benjamin oscar.j.benja...@gmail.com wrote: The real dividing line between {int, Fraction} and {float, Decimal, complex} is about (in)exactness. The numeric tower ensures the property that inexactness is contagious which I think is a good thing. *nods

Re: How to use Python to open Unread message(s) in specific Outlook folder, clicking a hyperlink within the email message to a secure login window, entering password to download .csv file, run Excel m

2013-08-01 Thread Chris Angelico
On Thu, Aug 1, 2013 at 6:31 PM, hamberg...@gmail.com wrote: Details Every morning I receive three emails (three different subject lines) in the same Sub-Folder (POINT) under Folder (Reports) in my Inbox in Outlook. Each email has two secure hyperlinks, one provides me with a site to

Re: Oddity with 'yield' as expression - parentheses demanded

2013-08-01 Thread Chris Angelico
On Thu, Aug 1, 2013 at 6:35 PM, Ian Kelly ian.g.ke...@gmail.com wrote: yield was a statement before it became an expression, and the syntax yield x, y, z was (and still is) perfectly legal, with all three expressions (technically a single tuple expression) being governed by the yield. That is

Re: Does Python 'enable' poke and hope programming?

2013-08-01 Thread Chris Angelico
On Thu, Aug 1, 2013 at 6:57 PM, CM cmpyt...@gmail.com wrote: It seems that if I can make a change to the code and then immediately test it by running the Python interpreter and finding out, in a few seconds, if it worked, I am going to be *much* more likely to use this trial-and-error

Re: How to use Python to open Unread message(s) in specific Outlook folder, clicking a hyperlink within the email message to a secure login window, entering password to download .csv file, run Excel m

2013-08-01 Thread Chris Angelico
On Thu, Aug 1, 2013 at 7:08 PM, hamberg...@gmail.com wrote: 1) You receive an email 2) That email has two URLs in it (secure hyperlinks means they begin https:// ?) 3) You choose one of them as being appropriate - is it always the second? 4) You download the document at that URL, which

Re: LibreOffice (was: Editing tabular data)

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 8:14 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Chris Angelico ros...@gmail.com writes: […] rather than OO/LibreOffice. (I'll not distinguish those two. Far as I'm concerned, they're one product with two names.) That's simply false. ... Claiming they're

Re: Python script help

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 10:46 AM, cool1...@gmail.com wrote: I do know some Python programming, I just dont know enough to put together the various scripts I need...I would really really appreciate if some one can help me with that... Be aware that you might be paying money for that. If you

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 1:08 PM, Dave Angel da...@davea.name wrote: matt.doolittl...@gmail.com wrote: Hey everybody, I am using 2.7 on Ubuntu 12.10. and what version of Python are you using? I don't know if it matters, but it's useful to always supply both Python version and OS version.

Re: Python performance

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 2:16 PM, Schneider j...@globe.de wrote: Queuing the mails for a while is not possible, because the tool should sit between the client and smtp-server. It should act as proxy, not as server. I've written an SMTP proxy (primary purpose: check SPF records; secondary

Re: PEP8 revised: max line lengths

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 10:15 PM, wxjmfa...@gmail.com wrote: Le vendredi 2 août 2013 17:19:11 UTC+2, Skip Montanaro a écrit : The solely valid solution, assuming there is some wish, is to define a maximal line width (preferably in SI units ;-) So, 79 * 8 points == 0.22295696 meters,

Re: How to use Python to open Unread message(s) in specific Outlook folder, clicking a hyperlink within the email message to a secure login window, entering password to download .csv file, run Excel m

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 7:18 PM, hamberg...@gmail.com wrote: How should I tweak my setup to make it easier to retrieve my email? I hope I'm doing this reply correctly. The best way is to use email, not the Google Groups interface. Start here:

Re: Python performance

2013-08-02 Thread Chris Angelico
On Fri, Aug 2, 2013 at 1:00 PM, Schneider j...@globe.de wrote: Hi list, I have to write a small SMTP-Relay script (+ some statistic infos) and I'm wondering, if this can be done in python (in terms of performance, of course not in terms of possibility ;) ). It has to handle around 2000

Re: Python: Code is ignoring the if and else

2013-08-02 Thread Chris Angelico
On Sat, Aug 3, 2013 at 2:44 AM, kevin4f...@gmail.com wrote: Yeah, I already know about that. But if I try to change it, I'm not even able to start the program. If I try to change the if statement that it corresponds with, I get a an error saying card is not a global. And if I try to shift

Re: PEP8 revised: max line lengths

2013-08-03 Thread Chris Angelico
On Sat, Aug 3, 2013 at 3:21 AM, Joshua Landau jos...@landau.ws wrote: On 2 August 2013 22:34, Chris Angelico ros...@gmail.com wrote: On Fri, Aug 2, 2013 at 10:15 PM, wxjmfa...@gmail.com wrote: Problem #3 cm or inch? The only serious unit is an SI unit. (In scientific publications, only

Re: Correct Way to Write in Python

2013-08-03 Thread Chris Angelico
On Sat, Aug 3, 2013 at 4:59 PM, Sagar Varule punk.sa...@gmail.com wrote: Your explanation for private and public access modifier was awesome as I was having harding time finding why we dont have access modifier for pythonThanks a lot It's a huge saving in time and effort. The C++

Re: Does Python 'enable' poke and hope programming?

2013-08-03 Thread Chris Angelico
On Sat, Aug 3, 2013 at 6:30 PM, CM cmpyt...@gmail.com wrote: In sum: experimentation is for when you don't know what you're doing and there is no manual; but, after the initial learning time, you *should* know what you're doing and you should have the manual handy, and therefore the time

Re: Print word from list

2013-08-03 Thread Chris Angelico
On Sat, Aug 3, 2013 at 11:17 PM, eschneide...@comcast.net wrote: pie='apple keylime pecan meat pot cherry' pie.split() How can I print a word from the list other than this way: print(pie[0:5]) ? The split() method returns a list, it doesn't change the original string. Try: pies =

Re: Removing matching items from a list?

2013-08-03 Thread Chris Angelico
On Sun, Aug 4, 2013 at 12:06 AM, Roy Smith r...@panix.com wrote: In article 51fd8635$0$3$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: 2) Then go through those initial letters, and pick out the ones equal to 4 (or should that be four or

Re: Python script help

2013-08-04 Thread Chris Angelico
On Sun, Aug 4, 2013 at 4:57 PM, cool1...@gmail.com wrote: I understand I did not ask the question correctly, but is there any chance you can help me put together this code? I know that you all do this for fun and enjoy it and that is why I asked you guys instead of asking some one who will

Re: PEP8 revised: max line lengths

2013-08-04 Thread Chris Angelico
On Sun, Aug 4, 2013 at 3:07 PM, Roy Smith r...@panix.com wrote: In article d2e561f1-f5ba-4242-941d-6989abd1a...@googlegroups.com, wxjmfa...@gmail.com wrote: I have always found, computer scientists are funny scientists. I have always found that sciences which contain the word science in

Re: PEP8 revised: max line lengths

2013-08-04 Thread Chris Angelico
On Sun, Aug 4, 2013 at 7:18 PM, Roy Smith r...@panix.com wrote: In article mailman.186.1375639877.1251.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: programmers, like engineers, have to deal with the possibility (or certainty) of idiots using their products

Re: stupid simple scope issue

2013-08-04 Thread Chris Angelico
On Sun, Aug 4, 2013 at 7:20 PM, JohnD j...@nowhere.com wrote: #~/usr/bin/python If this is meant to be a Unix-style shebang, the second character needs to be ! not ~. This has no effect on Python though. import random class boys: state={} class boy: state={ 'name':'',

  1   2   3   4   5   6   7   8   9   10   >