Re: Help with my program

2009-10-23 Thread Lie Ryan
tanner barnes wrote: Ok so im in need of some help! I have a program with 2 classes and in one 4 variables are created (their name, height, weight, and grade). What im trying to make happen is to get the variables from the first class and use them in the second class.

Re: OT Virtual Server Host

2009-10-26 Thread Ryan Lynch
nVZ platforms, if you can help it. No matter what the vendor promises you, they are full of little "gotchas" and limitations, and they will drive you nuts. - With managed or unmanaged VPS hosting, you get what you pay for, or worse. If they charge you $10/month for a 512MB RAM VPS instance, you can count on dangerously incompetent tech support and lots of downtime. - Avoid VAServ, which also operates the FSCKVPS and CheapVPS brands for unmanaged VPS instances. But those are just what I learned from my personal horror stories, take it with a grain of salt. -Ryan -- http://mail.python.org/mailman/listinfo/python-list

Re: a simple unicode question

2009-10-27 Thread Lie Ryan
Chris Jones wrote: On Wed, Oct 21, 2009 at 12:35:11PM EDT, Nobody wrote: [..] Characters outside the 16-bit range aren't supported on all builds. They won't be supported on most Windows builds, as Windows uses 16-bit Unicode extensively: I knew nothing about UTF-16 & friends before this thre

Re: What IDE has good git and python support?

2009-10-27 Thread Ryan Lynch
tegration is pretty good--I especially like the debugger. But the git support is lacking--it's nowhere near the level of SVN or CVS integration, though it is basically usable. I'm using Egit 0.5.0 on F11, with Eclipse 3.5. -Ryan -- http://mail.python.org/mailman/listinfo/python-list

Re: cool-compiling python 3

2009-10-29 Thread Lie Ryan
Rustom Mody wrote: I guess this is a bit OT but anyhow. I just finished compiling compiling python 3 on ubuntu and discovered that my laptop has a builtin toaster :-; Yeah I know this is not a python issue and probably modern laptops are meant to run wondrous beautiful elephantaneous th

Re: disutils, project structure & developing - n00b question

2009-10-29 Thread Lie Ryan
Simon Forman wrote: In order for "from pymlb import fetcher" no work you must make the './pymlb' directory into a "package" by adding a file called __init__.py (it can be empty.) Then make sure the "top" directory (i.e. '.' in your example) is in the python PATH. There are a couple of ways to

Re: spring effect in Python

2009-10-30 Thread Lie Ryan
pochis40 wrote: I'm trying to write in Python something similar to this: (Java) http://java.sun.com/applets/jdk/1.4/demo/applets/GraphLayout/example1.html or these: (Proce55ing) http://www.cricketschirping.com/processing/ExportAtlas/ or http://www.cricketschirping.com/weblog/2005/12/11/force-dire

Re: Aaaargh! "global name 'eggz' is not defined"

2009-10-30 Thread Lie Ryan
Aahz wrote: In article , Robert Kern wrote: I like using pyflakes. It catches most of these kinds of typo errors, but is much faster than pylint or pychecker. Coincidentally, I tried PyFlakes yesterday and was unimpressed with the way it doesn't work with "import *". If only IDLE's Intell

Re: comparing alternatives to py2exe

2009-11-03 Thread Ryan Kelly
ing or misunderstanding? A quick note - although I haven't tried it out, the latest version of bbfreeze claims to support OSX. Ryan -- Ryan Kelly http://www.rfk.id.au | This message is digitally signed. Please visit r...@rfk.id.au| http://www.rfk.id.au/ramblings/gpg/ for details

Re: What is the best way to delete strings in a string list that that match certain pattern?

2009-11-05 Thread Lie Ryan
Peng Yu wrote: Suppose I have a list of strings, A. I want to compute the list (call it B) of strings that are elements of A but doesn't match a regex. I could use a for loop to do so. In a functional language, there is way to do so without using the for loop. In functional language, there is n

ANN: esky 0.2.1

2009-11-07 Thread Ryan Kelly
anner: using a carefully-ordered sequence of atomic renames on POSIX, using MoveFileTransacted on Windows Vista or later, and using the "rename-and-pray" method on older versions of Windows. Failed or partial updates are detected and cleaned up automatically. Enjoy! Ryan

Socket programming with NetCom serial-to-ethernet module

2009-11-09 Thread Ryan Swindle
e problem, if requested. (Again, I hope this was not a misuse of the list in some way; I apologize, if so). Many thanks. -Ryan -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: esky 0.2.1

2009-11-12 Thread Ryan Kelly
tes. > > Recently I was looking into distribution mechanisms, and I passed over > bbfreeze because I saw no indication that Python 2.6 was supported. Not sure if it's officially supported, but I do most of my development on Python 2.6 and bbfreeze hasn't given me any problems as y

Re: ANN: esky 0.2.1

2009-11-13 Thread Ryan Kelly
hmir/bbfreeze Out of curiosity, what freezer package did you settle on in the end? I'm curious it see if esky could easily switch between different freezers (although it currently depends on some rather deep details of the bbfreeze format). Cheers, Ryan -- Ryan Kelly http:/

Re: IOError: [Errno 28] No space left on device

2009-11-17 Thread Lie Ryan
hong zhang wrote: List, My python script has a strange error. cont_tx = 1 for i in glob.glob('/sys/kernel/debug/ieee80211/phy*/iwlagn/data/continuous_tx'): with open(i, 'w') as f: print >>f, cont_tx work perfectly. But following get error like: print >>f, cont_tx IOEr

Re: IOError: [Errno 28] No space left on device

2009-11-17 Thread Lie Ryan
hong zhang wrote: --- On Tue, 11/17/09, Tim Chase wrote: From: Tim Chase Subject: Re: IOError: [Errno 28] No space left on device To: "Lie Ryan" Cc: python-list@python.org Date: Tuesday, November 17, 2009, 7:47 PM for i in glob.glob('/sys/kernel/debug/ieee80211/p

Re: question about tree in python

2009-11-18 Thread Lie Ryan
nospam wrote: How should I write a tree using diconary. I have used a dictonary to make a tree. dictionary tree? root = { 'node_a': { 'node_a_a': 'blah', 'node_a_b': 'foo', 'node_a_c': 'bar', }, 'node_b': { 'node_b_a': 'soo', 'node_b_b': 'fle

Re: plotting arrow in python

2009-11-21 Thread Lie Ryan
rudra wrote: Dear friends, I am very new in python. Actually, I think I will not do much python then using it to plotting data. I have not done any "real" thing in python, so plz be easy. Now , the problem I have a data set: 0.0 0.0 0.1 0.0 0.1 0.1 0.1 0.0 0.5 like that! the first two column are

Re: Sorting: too different times. Why?

2009-11-22 Thread Lie Ryan
n00m wrote: The second part of the compound if is backwards. So if this is headed for production code, it better get fixed. DaveA Not sure I'm understanding your remark. Maybe he meant, that this: if v1.x < v2.x and v1.y > v2.y should be: if v1.x < v2.x and v1.y < v2.y ? -- http://mail.pyth

Re: Split class across multiple files

2009-11-22 Thread Lie Ryan
eric.frederich wrote: I have a class which holds a connection to a server and a bunch of services. In this class I have methods that need to work with that connection and services. Right now there are about 50 methods some of which can be quite long. From an organizational standpoint, I'd like t

Re: What is the naming convention for accessor of a 'private' variable?

2009-11-22 Thread Lie Ryan
Peng Yu wrote: On Wed, Nov 18, 2009 at 8:47 PM, Chris Rebert wrote: On Wed, Nov 18, 2009 at 6:27 PM, Peng Yu wrote: http://www.python.org/dev/peps/pep-0008/ The above webpage states the following naming convention. Such a variable can be an internal variable in a class. I'm wondering what is

Re: creating pipelines in python

2009-11-22 Thread Lie Ryan
per wrote: hi all, i am looking for a python package to make it easier to create a "pipeline" of scripts (all in python). what i do right now is have a set of scripts that produce certain files as output, and i simply have a "master" script that checks at each stage whether the output of the pre

Re: Trying to understand += better

2009-11-22 Thread Lie Ryan
Roy Smith wrote: If I've got an object foo, and I execute: foo.bar += baz exactly what happens if foo does not have a 'bar' attribute? It's pretty clear that foo.__getattr__('bar') gets called first, but it's a little murky after that. Assume for the moment that foo.__getattr__ ('bar') return

Re: Implementation of Book Organization tool (Python2.[x])

2009-11-22 Thread Lie Ryan
~km wrote: Hi together, I'm a python-proficient newbie and want to tackle a program with Python 2.x, which basically organizes all my digital books (*.pdf, *.chm, etc..) and to give them specific "labels", such as: "Author" -> string "Read" -> boolean "Last Opened:" -> string and so on.. Now m

Re: problem manipulating a list belonging to a class

2009-11-22 Thread Lie Ryan
Marc Leconte wrote: class Toto(object): def __init__(self, number, mylist=[]): self.number=number self.mylist=mylist pass pass Why are you using pass to end your blocks? -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to understand += better

2009-11-22 Thread Lie Ryan
Roy Smith wrote: In article <4b0a01a...@dnews.tpgi.com.au>, Lie Ryan wrote: The semantic of the in-place operator is something like: x += y becomes x = x.__iadd__(y) thus foo.bar += baz becomes foo.bar = foo.bar.__iadd__(baz) So the call sequence is, foo.__getattr__('bar')

Re: Capturing output of os.system to a string

2009-11-23 Thread Lie Ryan
gerry.butler wrote: How do I capture output to a string? For example, the output of os.system('whoami'). I guess I need to redirect stdout, but I'm a total beginner, and I haven't been able to find out from the tutorials how to do this. You can't with os.system; use subprocess module instead.

Re: profiling differences using an extra function call

2009-11-23 Thread Lie Ryan
marc magrans de abril wrote: Hi, I was a trying to profile a small script and after shrinking the code to the minimum I got a interesting profile difference. Given two test functions test1 and test2, that only differs from an extra level of indirection (i.e. find_substr), That's because there

Re: Where to put the error handing test?

2009-11-23 Thread Lie Ryan
Peng Yu wrote: Suppose that I have function f() that calls g(), I can put a test on the argument 'x' in either g() or f(). I'm wondering what is the common practice. My thought is that if I put the test in g(x), the code of g(x) is safer, but the test is not necessary when g() is called by h().

Re: More precise document on os.path.normpath()

2009-11-23 Thread Lie Ryan
Peng Yu wrote: After I tried os.path.normpath(), it is clear that the function doesn't return the trailing '/', if the path is a directory. But this fact is not documented. Should this be documented in future release of python. Also, I found the documentation of some functions in os.path are not

Re: Line Breaks

2009-11-23 Thread Lie Ryan
D'Arcy J.M. Cain wrote: On Mon, 23 Nov 2009 14:46:23 -0500 Susan Day wrote: First, it does in fact ignore all line breaks, not just double line breaks. Here's what I'm doing: session.sendmail(clientEmail, ourEmail2, header+msg) The email sent out has the message sans breaks. You should really

Re: UnicodeDecodeError? Argh! Nothing works! I'm tired and hurting and...

2009-11-23 Thread Lie Ryan
Alf P. Steinbach wrote: And I'm hesitant to just delete index file, hoping that it'll rebuild. it'll be rebuild the next time you start Thunderbird: (MozillaZine: http://kb.mozillazine.org/Disappearing_mail) * It's possible that the ".msf" files (index files) are corrupted. To rebuild the in

Re: attributes, properties, and accessors -- philosophy

2009-11-24 Thread Lie Ryan
Ethan Furman wrote: Good tools to know about, and a consistent naming pattern also makes life easier (which I have since done ;). Let's head towards murkier waters (at least murkier to me -- hopefully they can be easily clarified): some of the attributes are read-only, such as record count

Re: Where to put the error handing test?

2009-11-24 Thread Lie Ryan
Peng Yu wrote: On Tue, Nov 24, 2009 at 4:58 AM, Dave Angel wrote: I'll put an extra emphasis on this: Your question is so open-ended as to be unanswerable. I'll still confused by the guideline that an error should be caught as early

Re: Beginning Question about Python functions, parameters...

2009-11-25 Thread Lie Ryan
astral orange wrote: As for the "class Name():" example above? Even though I haven't seen exactly what purpose 'self' serves In many other programming language, self (or this, or Me) refers the the current class instance. In some languages, you can refer to an instance attribute without an e

Re: Feature request: String-inferred names

2009-11-25 Thread Lie Ryan
Brad wrote: On Nov 25, 10:49 pm, Chris Rebert wrote: On Wed, Nov 25, 2009 at 6:35 PM, The Music Guy wrote: Hello all, I just posted to my blog about a feature that I'd like to see added to Python. Before I go through the trouble of learning how to write a PEP or how to extend the Python inte

Re: Can "self" crush itself?

2009-11-26 Thread Lie Ryan
n00m wrote: Ok ok Of course, it's a local name; -- just my silly slip. And seems it belongs to no dict[]... Just an internal volatile elf Local names are not implemented as dict, but rather as sort of an array in the compiler. The name resolution of locals is compile time and doesn't use dict

Re: Anything equivalent to cassert in C++?

2009-11-26 Thread Lie Ryan
Jean-Michel Pichavant wrote: Peng Yu wrote: There are some assertion code (testing if a condition is false, if it is false, raise an Error object) in my python, which is useful when I test my package. But such case would never occur when in the produce code. If I keep them in if statement, it w

Re: string payload expected: error

2009-11-26 Thread Lie Ryan
Ramdas wrote: Dear all, I believe this is an error which was fixed in Python 2.3 itself. But I am running Python 2,5.2 and error keeps on cropping up. Here is my code to construct emails . It works perfectly when I dont have any attachments. Please find my code at http://dpaste.com/hold/125574

Re: Why this error message

2010-01-31 Thread Ryan Kelly
' is not defined Based on the indentation, it looks like you've defined "test" as a method on the SpecialFile class. Try dedenting it to begin in the first column. Ryan -- Ryan Kelly http://www.rfk.id.au | This message is digitally signed. Please visit r...@rfk.id.au| http://www.rfk.id.au/ramblings/gpg/ for details signature.asc Description: This is a digitally signed message part -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's Reference And Internal Model Of Computing Languages

2010-02-02 Thread Ryan Kelly
b = aa; aa.hello = "world"; alert(bb.hello) --> "world" delete bb.hello alert(aa.hello) --> "undefined" OMFG, references!! Come to think of it, the JavaScript and Python object models are really very similar. I'm genuinely curious now - what lit

Re: Upgrading Py2exe App

2010-02-18 Thread Ryan Kelly
.org/pypi/esky Docs are a little scarce at the moment, the next release will hopefully come with a short tutorial (as well as support for cx_freeze and maybe py2app, depending on how adventurous I'm feeling). Cheers, Ryan -- Ryan Kelly http://www.rfk.id.au | This message is digital

Re: Upgrading Py2exe App

2010-02-19 Thread Ryan Kelly
On Thu, 2010-02-18 at 20:32 -0800, CM wrote: > On Feb 18, 7:19 pm, Ryan Kelly wrote: > > On Thu, 2010-02-18 at 07:46 -0800, T wrote: > > > I have a Python app which I converted to an EXE (all files separate; > > > single EXE didn't work properly) via py2exe - I pla

Re: Upgrading Py2exe App

2010-02-19 Thread Ryan Kelly
On Fri, 2010-02-19 at 11:08 -0800, T wrote: > On Feb 18, 7:19 pm, Ryan Kelly wrote: > > On Thu, 2010-02-18 at 07:46 -0800, T wrote: > > > I have a Python app which I converted to an EXE (all files separate; > > > single EXE didn't work properly) via py2exe - I pla

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/19/10 14:57, Steve Howell wrote: > In a more real world example, the intermediate results would be > something like this: > >departments >departments_in_new_york >departments_in_new_york_not_on_bonus_cycle >employees_in_departments_in_new_york_not_on_bonus_cycle >names_of

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Lie Ryan
On 02/20/10 13:32, MattB wrote: > > I'm using the network in my own apartment. Not the campus's. > Moreover, my mac's MAC address is different from the MAC address shown > by my router, but as I said I'm also blocked when using my friend's > wireless router at his apartment. > > So it must be my

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/20/10 17:30, Lawrence D'Oliveiro wrote: > In message , Rhodri James wrote: > >> In classic Pascal, a procedure was distinct from a function in that it had >> no return value. The concept doesn't really apply in Python; there are no >> procedures in that sense, since if a function terminates

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/20/10 18:17, sjdevn...@yahoo.com wrote: > On Feb 20, 1:30 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> In message , Rhodri James wrote: >> >>> In classic Pascal, a procedure was distinct from a function in that it had >>> no return value. The concept doesn't really apply in Py

Re: Can I embedding a (python) console on python program?

2010-02-19 Thread Lie Ryan
On 02/20/10 16:38, Kee K Y CHEN wrote: > HI All, > > Apologize for being a newbie to python area and sorry for my English. > > Actually what I need is embedding a python interactive console(or other > shell console alike module) on my python program for debugging and > controlling purpose during

Re: Capturing errors raised by other scripts ?

2010-02-20 Thread Lie Ryan
On 02/20/10 14:39, northof40 wrote: > On Feb 20, 4:13 pm, MRAB wrote: >> northof40 wrote: >>> I'm using the subroutine module to run run python script A.py from >>> B.py (this is on windows fwiw). >> >>> A.py is not my script and it may raise arbitary errors before exiting. >>> How can I determine

Re: Can't Access ANY url from python (errno 61)

2010-02-20 Thread Lie Ryan
On 02/20/10 19:36, MattB wrote: > On Feb 20, 2:02 am, Lie Ryan wrote: >> On 02/20/10 13:32, MattB wrote: >> >> >> >>> I'm using the network in my own apartment. Not the campus's. >>> Moreover, my mac's MAC address is different from th

Re: Is there a way to continue after an exception ?

2010-02-20 Thread Lie Ryan
> On Sun, Feb 21, 2010 at 12:52 AM, Stef Mientki wrote: >> hello, >> >> I would like my program to continue on the next line after an uncaught >> exception, >> is that possible ? >> >> thanks >> Stef Mientki >> That reminds me of VB's "On Error Resume Next" -- http://mail.python.org/mailman/list

Re: Is there a way to continue after an exception ?

2010-02-20 Thread Lie Ryan
On 02/21/10 12:02, Stef Mientki wrote: > On 21-02-2010 01:21, Lie Ryan wrote: >>> On Sun, Feb 21, 2010 at 12:52 AM, Stef Mientki wrote: >>> >>>> hello, >>>> >>>> I would like my program to continue on the next line after an uncaught

Re: Is there a way to continue after an exception ?

2010-02-20 Thread Ryan Kelly
On Sun, 2010-02-21 at 13:17 +1100, Lie Ryan wrote: > On 02/21/10 12:02, Stef Mientki wrote: > > On 21-02-2010 01:21, Lie Ryan wrote: > >>> On Sun, Feb 21, 2010 at 12:52 AM, Stef Mientki > wrote: > >>> > >>>> hello, > >>>> &g

Re: Pure virtual functions in Python?

2010-02-21 Thread Lie Ryan
On 02/21/10 19:27, lallous wrote: > If the base defines the method and it was empty, then my C++ code > would still call the function. This is not optimal because I don't > want to go from C++ to Python if the _derived_ class does not > implement the cb. That sounds like a microoptimization; hav

Re: lists of variables

2010-02-21 Thread Lie Ryan
On 02/21/10 15:21, Steven D'Aprano wrote: >> > So it looks like variables in a list are stored as object references. > Python doesn't store variables in lists, it stores objects, always. > > Even Python variables aren't variables *grin*, although it's really > difficult to avoid using the term. P

Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Ryan Kelly
hort story: a particular test suite of mine used to run in around 25 seconds, but a bit of ctypes magic to set thread affinity dropped the running time to under 13 seconds. Cheers, Ryan -- Ryan Kelly http://www.rfk.id.au | This message is digitally signed. Please visit r...@rfk.id.au

Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Ryan Kelly
using threading2 to set the process cpu affinity at the start of the test run: r...@durian:/storage/software/fs$ nosetests fs/tests/test_fs.py:TestOSFS.test_cases_in_separate_dirs . -- Ran 1 test in 3.792s Again, best of five.

Re: Reading a large bz2 textfile exits early

2010-02-22 Thread Lie Ryan
On 02/22/10 19:43, Norman Rieß wrote: > Am 02/22/10 09:02, schrieb Steven D'Aprano: >> On Mon, 22 Feb 2010 07:49:51 +0100, Norman Rieß wrote: >> >> >>> This is the actual code: >>> >>> source_file = bz2.BZ2File(file, "r") >>> for line in source_file: >>> print line.strip() >>> >>> print "E

ANN: esky v0.4.0 [was Re: Upgrading Py2exe App]

2010-02-22 Thread Ryan Kelly
Hi All, As promised I have made a new release of esky, my auto-update framework for frozen python apps. Details below for those who are interested. Cheers, Ryan --- esky: keep frozen apps fresh Esky is an auto-update framework for frozen Python

Re: Signature-based Function Overloading in Python

2010-02-23 Thread Lie Ryan
On 02/24/10 05:25, Michael Rudolf wrote: > Just a quick question about what would be the most pythonic approach in > this. > > In Java, Method Overloading is my best friend, but this won't work in > Python: > So - What would be the most pythonic way to emulate this? > Is there any better Idom tha

Re: Spam from gmail (Was: fascism)

2010-02-23 Thread Lie Ryan
On 02/24/10 11:21, Aahz wrote: > In article , > D'Arcy J.M. Cain wrote: >> On Tue, 23 Feb 2010 02:54:25 -0800 (PST) >> Joan Miller wrote: >>> >>> *Sorry by this message off topic, but this is too important* >> >> Is it just me or has the spew from gmail on this list radically >> increased in the

Re: What's Going on between Python and win7?

2010-02-23 Thread Lie Ryan
On 02/23/10 05:30, W. eWatson wrote: > On 2/22/2010 8:29 AM, Grant Edwards wrote: >> On 2010-02-22, W. eWatson wrote: >> >>> Last night I copied a program from folder A to folder B. >> >> [tail of various windows breakages elided] >> >>> Comments? >> >> Switch to Linux? >> >> Or at least install C

Re: When will Java go mainstream like Python?

2010-02-23 Thread Lie Ryan
On 02/24/10 12:08, Nobody wrote: > On Wed, 24 Feb 2010 12:22:05 +1300, Lawrence D'Oliveiro wrote: > >>> Java - The JVM code been hacked to death by Sun engineers (optimised) >>> Python - The PVM code has seen speed-ups in Unladen or via Pyrex.. >>> ad-infinitum but nowhere as near to JVM >> >> Pyt

Re: Spam from gmail (Was: fascism)

2010-02-23 Thread Lie Ryan
On 02/24/10 12:38, Steven D'Aprano wrote: > On Wed, 24 Feb 2010 00:06:09 +0100, Daniel Fetchinson wrote: > >>> Hmm. I wonder if all the spam is coming from the NG side. I'll have >>> to look at that. One of the reasons that I stopped reading UseNet over >>> ten years ago was because of the dimi

Re: Is this secure?

2010-02-23 Thread Lie Ryan
On 02/24/10 14:09, Robert Kern wrote: > On 2010-02-23 20:43 , Steven D'Aprano wrote: >> On Wed, 24 Feb 2010 02:40:13 +, Steven D'Aprano wrote: >> >>> On Tue, 23 Feb 2010 15:36:02 +0100, mk wrote: >>> The question is: is this secure? That is, can the string generated this way be consid

Re: Upgrading Py2exe App

2010-02-24 Thread Ryan Kelly
On Wed, 2010-02-24 at 15:05 -0800, Aahz wrote: > In article , > Ryan Kelly wrote: > > > >Yes. The idea of having a "bootstrapping exe" is that actual > >application code can be swapped out without having to overwrite the > >executable file. As long a

Re: Can't Access ANY url from python (errno 61)

2010-02-25 Thread Lie Ryan
On 02/24/10 17:07, MattB wrote: > All -- problem solved. Following Lie's suggestions, and the links > from those pages, I went hunting around in my /library/preferences/ > SystemConfiguration/. I opened all of the 6 or 7 files that were in > there, and all looked as if they contained info directl

Re: When will Java go mainstream like Python?

2010-02-25 Thread Lie Ryan
On 02/25/10 07:40, Wanja Gayk wrote: > Am 24.02.2010, 00:22 Uhr, schrieb Lawrence D'Oliveiro > : > >>> Java - The JVM code been hacked to death by Sun engineers (optimised) >>> Python - The PVM code has seen speed-ups in Unladen or via Pyrex.. >>> ad-infinitum but nowhere as near to JVM >> >> Pyth

Re: What's the word on using """ to comment-out?

2010-02-25 Thread Lie Ryan
On 02/25/10 05:18, kj wrote: > I think I remember, early in my learning of Python, coming across > the commandment "THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT > LINES OF CODE", or something to that effect. But now I can't find > it! I've never heard of it, though I can think of a few reasons

Re: Docstrings considered too complicated

2010-03-01 Thread Lie Ryan
On 03/02/10 00:09, Andreas Waldenburger wrote: > On Mon, 1 Mar 2010 05:01:49 -0800 (PST) alex23 > wrote: > >> Andreas Waldenburger wrote: >>> But as I said: a) I am (we are) not in a position to impose this (We >>> don't work with the code, we just run the software). >> >> I personally believe t

Re: Is this secure?

2010-03-02 Thread Lie Ryan
On 02/25/2010 06:16 AM, mk wrote: > On 2010-02-24 20:01, Robert Kern wrote: >> I will repeat my advice to just use random.SystemRandom.choice() instead >> of trying to interpret the bytes from /dev/urandom directly. > > Out of curiosity: > > def gen_rand_string(length): > prng = random.System

Re: cpan for python?

2010-03-02 Thread Lie Ryan
On 03/03/2010 09:47 AM, TomF wrote: > On 2010-03-02 13:14:50 -0800, R Fritz said: > >> On 2010-02-28 06:31:56 -0800, sstein...@gmail.com said: >>> >>> On Feb 28, 2010, at 9:28 AM, Someone Something wrote: >>> Is there something like cpan for python? I like python's syntax, but Iuse perl

Re: Docstrings considered too complicated

2010-03-03 Thread Lie Ryan
On 03/03/2010 04:48 PM, Steven D'Aprano wrote: > Or one can simply use *reason*: what justification is there for putting > comments in strings at the top of the function? The only one I can see is > if you are writing for an embedded device, you may want to remove doc > strings to save memory --

Re: There should be one-- and preferably only one --obvious way to do it (was "Interest check in some delicious syntactic sugar for "except:pass"")

2010-03-03 Thread Lie Ryan
On 03/03/2010 08:27 PM, Oren Elrad wrote: > Howdy all, longtime appreciative user, first time mailer-inner. > > I'm wondering if there is any support (tepid better than none) for the > following syntactic sugar: > > silence: > . block > > -> > > try: > .b

Re: Asynchronous HTTP client

2010-03-07 Thread Lie Ryan
On 03/07/2010 05:53 PM, Ping wrote: > Hi, > > I'm trying to find a way to create an asynchronous HTTP client so I > can get responses from web servers in a way like > > async_http_open('http://example.com/', callback_func) > # immediately continues, and callback_func is called with response >

Re: sqlite3 is sqlite 2?

2010-03-14 Thread Ryan Kelly
u Karmic? I know > that is not a question about Python itself. That's the sqlite *bindings* version: >>> sqlite3.version '2.4.1' >>> sqlite3.sqlite_version '3.6.16' >>> So this is "pysqlite" version 2.4.1, whic

Re: sqlite savepoint problem (was: Re: sqlite3 is sqlite 2?)

2010-03-14 Thread Ryan Kelly
automatically commit the current transaction. Doesn't help with your current problem but worth pointing out :-) When debugging strange transaction behaviour, I find it easiest to create the connection with isolation_level=None so that are no implicit transactions being created behind y

Re: sqlite savepoint problem

2010-03-14 Thread Ryan Kelly
e are no-ops. If you create your own connection wrapper that explicitly creates and commits transactions, you example will work fine with isolation_level=None. Here's the relevant changes: class MyConn(sqlite3.Connection): def __enter__(self): self.execute("BEGIN")

Re: sqlite savepoint problem

2010-03-14 Thread Ryan Kelly
into a values (2)") # and committed, discarding the first savepoint. conn.execute("SAVEPOINT sp2") # a new transaction is magically created conn.execute("insert into a values (3)") # and committed, discarding the very savepoint we are trying to use.

Re: sqlite savepoint problem [solved]

2010-03-15 Thread Ryan Kelly
As far as I can tell it does nothing on __enter__ and calls > > con.commit() or con.rollback() on exit. With isolation_level=None, > > these are no-ops. > > > Thank you Ryan! You are abolutely right, and thank you for reading the > source. Now everything works as I ima

Re: to pass self or not to pass self

2010-03-16 Thread Lie Ryan
On 03/17/2010 05:59 AM, Jason Tackaberry wrote: > On Tue, 2010-03-16 at 10:04 +0100, Bruno Desthuilliers wrote: >> Answer here: >> >> http://wiki.python.org/moin/FromFunctionToMethod > > I have a sense I used to know this once upon a time, but the question > came to my mind (possibly again) and I

Re: to pass self or not to pass self

2010-03-17 Thread Lie Ryan
On 03/17/2010 04:32 PM, Steven D'Aprano wrote: > On Wed, 17 Mar 2010 15:57:17 +1100, Lie Ryan wrote: > >> Most people probably would never need to use >> descriptor protocol directly, since the immediate benefit of descriptor >> protocol are property(), clas

Re: to pass self or not to pass self

2010-03-17 Thread Lie Ryan
On 03/17/2010 08:12 PM, Bruno Desthuilliers wrote: > Patrick Maupin a écrit : >> On Mar 16, 1:59 pm, Jason Tackaberry wrote: >>> Why not create the bound methods at instantiation time, rather than >>> using the descriptor protocol which has the overhead of creating a new >>> bound method each time

Re: StringChain -- a data structure for managing large sequences of chunks of bytes

2010-03-27 Thread Lie Ryan
On 03/22/2010 07:07 PM, Steven D'Aprano wrote: > Perhaps you should have said that it was a wrapper around deque giving > richer functionality, rather than giving the impression that it was a > brand new data structure invented by you. People are naturally going to > be more skeptical about a ne

Re: StringChain -- a data structure for managing large sequences ofchunks of bytes

2010-03-30 Thread Lie Ryan
On 03/29/2010 01:59 AM, Steven D'Aprano wrote: > On Sun, 28 Mar 2010 06:48:21 +1100, Lie Ryan wrote: > >> On 03/22/2010 07:07 PM, Steven D'Aprano wrote: >>> Perhaps you should have said that it was a wrapper around deque giving >>> richer functionality, r

Re: Classes as namespaces?

2010-03-30 Thread Lie Ryan
On 03/27/2010 10:28 PM, Jonathan Hartley wrote: > one might like to name the complex block of logic, just to make it > readable: > > > x = 1 > def account_for_non_square_pixels(x): >((some complex logic)) > account_for_non_square_pixels() > y = 2 > > > But defining and then calling the func

Re: off topic but please forgive me me and answer

2010-04-01 Thread Lie Ryan
On 04/02/10 13:01, Patrick Maupin wrote: > On Apr 1, 7:49 pm, Tim Chase wrote: >> David Robinow wrote: >>> $ python -c "print 1/2 * 1/2" >>> 0 >> >>> But that's not what I learned in grade school. >>> (Maybe I should upgrade to 3.1?) >> >> That's because you need to promote one of them to a float

Re: Good Intermediate Tutorials

2010-04-01 Thread Lie Ryan
On 04/02/10 11:25, Abethebabe wrote: > I've recently finished reading A Byte Of Python and have the basics of > Python down. I want to continue practice but I'm unsure what I can do. > So I started looking for tutorials to open my mind a little, but > everything I come across are beginner tutorials

Re: How to run python without python

2010-04-03 Thread Lie Ryan
On 04/03/10 06:24, John Bokma wrote: >> >> you think virtualbox could help? i wonder if one could run linux/ >> py2exe virtually on a win machine and get it working. > > Of course that works, a virtual windows machine is just a windows > machine ;-). > > Also that you can't do a "cross compilatio

Re: Which non SQL Database ?

2010-12-05 Thread Lie Ryan
On 12/05/10 10:43, Jorge Biquez wrote: > I do not see a good reason for not using Sqlite3 BUT if for some reason > would not be an option what plain schema of files would you use? Assuming you don't want SQL, you can use filesystem-based database. Most people doesn't realize that a filesystem

Re: Comparison with False - something I don't understand

2010-12-06 Thread Lie Ryan
On 12/05/10 15:52, Tim Harig wrote: > On 2010-12-05, Tim Harig wrote: >> Another, questionable but useful use, is to ignore the complex accounting >> of your position inside of a complex data structure. You can continue >> moving through the structure until an exception is raised indicating >> th

Re: Python critique

2010-12-11 Thread Lie Ryan
On 12/11/10 11:37, Dan Stromberg wrote: > On Fri, Dec 10, 2010 at 3:51 PM, John Nagle wrote: >> On 12/10/2010 3:25 PM, Stefan Behnel wrote: >>> Benjamin Kaplan, 11.12.2010 00:13: On Fri, Dec 10, 2010 at 5:46 PM, Octavian Rasnita wrote: The only scopes Python has are module and function.

Re: Python distribution recommendation?

2010-12-11 Thread Lie Ryan
On 12/11/10 23:43, Octavian Rasnita wrote: > Hi, > > Is there a "recommended" Python distribution for Windows XP? > > I know about the one that can be downloaded from python.org (which I am using > for the moment) and the one offered by ActiveState but I don't know which one > is better for a b

Re: performance of tight loop

2010-12-13 Thread Ryan Kelly
ng myself to write "while 1" in favour of "while True" in code. Python 3 does away with this madness entirely: >>> while True: ... True = False ... File "", line 2 SyntaxError: assignment to keyword >>> Looking at the bytecode sh

Re: If/then style question

2010-12-16 Thread Ryan Kelly
stent -- sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask! In your example, the first style is difficult to read wile the second style is easy to read. You don't

Re: off topic but please forgive me me and answer

2010-04-04 Thread Lie Ryan
On 04/04/10 13:01, Patrick Maupin wrote: > On Apr 3, 9:24 pm, Steven D'Aprano cybersource.com.au> wrote: >> To put it another way, even though there are an infinite number of >> rationals, they are vanishingly rare compared to the irrationals. If you >> could choose a random number from the real n

Re: Translation docstrings with gettext

2010-04-05 Thread Lie Ryan
On 04/05/10 20:31, sapient wrote: > Hello. > > I found several discussions where this question was asked, but was not > answered. Why would you want to translate docstring? Docstring is meant for developers not users. Maintaining a translated docstring is going to be a maintenance hell and will e

Re: Tkinter inheritance mess?

2010-04-05 Thread Lie Ryan
On 04/06/10 02:38, ejetzer wrote: > On 5 avr, 12:36, ejetzer wrote: >> For a school project, I'm trying to make a minimalist web browser, and >> I chose to use Tk as the rendering toolkit. I made my parser classes >> into Tkinter canvases, so that I would only have to call pack and >> mainloop fun

Re: How to output the commands that are executed in a python script?

2010-04-05 Thread Lie Ryan
On 04/06/10 12:38, Peng Yu wrote: > I want to show what commands have been executed when I run a python > script. Is there an option which can instruct python to print the > commands automatically? > > (If you are familiar with R, what I am asking is essentially > options(echo=T) in R.) > It's n

<    3   4   5   6   7   8   9   10   11   >