Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Adam Mercer
On Fri, Aug 9, 2013 at 8:42 AM, Antoon Pardon wrote: > That is probably beside the point. I suspect Adam is just giving a > minimal example to show the kind of thing he is trying to do. > > Nit picking the specific example instead of advising on the problem > is likely to be le

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Adam Mercer
On Fri, Aug 9, 2013 at 8:29 AM, Chris Angelico wrote: > You shouldn't need to use 'echo' here. Just provide tee with the text > on its standard input, and don't bother with the pipe at all. Thanks, that's much better! Cheers Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Using sudo to write to a file as root from a script

2013-08-09 Thread Adam Mercer
uot;echo -n %s | sudo tee %s > /dev/null" % (channel, config_file) try: retcode = subprocess.call(command, shell=True) if retcode < 0: sys.exit('Error: Failed to set channel.conf') except OSError as e: sys.exit('Error: Execution failed "%s"' % e) But I was under the impression that Popen was the preferred approach to running external processes? Cheers Adam -- http://mail.python.org/mailman/listinfo/python-list

Resolving import errors reported by PyLint in modules using Python.NET

2013-08-08 Thread adam . preble
PyLint can't figure out imports of .NET code being referenced in my Python scripts that use Python.NET. I can kind of see why; you have to evaluate some clr.AddReference calls for the imports to even succeed. I wonder if I have any recourse. Generally, to import a DLL you have to do a few thi

Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?"

2013-08-08 Thread adam . preble
On Thursday, August 8, 2013 3:50:47 AM UTC-5, Peter Otten wrote: > Peter Otten wrote: > Oops, that's an odd class name. Fixing the name clash in Types.__new__() is > > left as an exercise... Interesting, I got __main__.T, even though I pretty much just tried your code wholesale. For what it's

Using sudo to write to a file as root from a script

2013-08-08 Thread Adam Mercer
, 'sudo', 'tee', config_file] p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, _ = p.communicate() But it seems as if this isn't doing anything. I just want to write the contents of the variable channel to the file /opt/ldg/etc/channel.con

Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?"

2013-08-08 Thread adam . preble
On Thursday, August 8, 2013 3:04:30 AM UTC-5, Terry Reedy wrote: > I cannot help but note that this is *more* typing. But anyhow, something It wasn't so much about the typing so much as having "test" in front of everything. It's a problem particular to me since I'm writing code that, well, run

Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?"

2013-08-08 Thread adam . preble
On Thursday, August 8, 2013 3:50:47 AM UTC-5, Peter Otten wrote: > Peter Otten wrote: > Oops, that's an odd class name. Fixing the name clash in Types.__new__() is > > left as an exercise... I will do some experiments with a custom test loader since I wasn't aware of that as a viable alternativ

Is it possible to make a unittest decorator to rename a method from "x" to "testx?"

2013-08-07 Thread adam . preble
We were coming into Python's unittest module from backgrounds in nunit, where they use a decorate to identify tests. So I was hoping to avoid the convention of prepending "test" to the TestClass methods that are to be actually run. I'm sure this comes up all the time, but I mean not to have to

Re: Having troubles with list methods

2013-08-01 Thread Adam Sweiger
On Thursday, August 1, 2013 8:11:42 PM UTC-5, Sam Whitehead wrote: > Your indentation is such that the first print statement is the only thing > inside the while loop. I corrected the indentation and it works perfectly now. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Having troubles with list methods

2013-08-01 Thread Adam Sweiger
The code: pastebin.com/MyrLB704 I'm working on this program in my Python book, and for some reason it doesn't seem to be working. I've read my code, it seems fine to me. Here's what the book says: The High Scores program uses list methods to create and maintain a list of the user's best scores

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Adam Jiang
rint "A" class B(A): def __init__(self, arg): super(B, self).__init__(arg) Is this correct? As the result, whenever you wanted to refer to a method in parent class, super() functions has to be called. This seems inefficient. How to refer to a field defined in parent class?

What is the semantics meaning of 'object'?

2013-06-22 Thread Adam
the semantics meaning of such kind of notation? Thanks, /Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: ValueError: I/O operation on closed file. with python3

2013-06-12 Thread Adam Mercer
8')) > > I've run it with 2.6, 2.7, 3.2, and 3.3. Thanks that's very helpful, I hadn't realised that .readfp() had been deprecated. Cheers Adam -- http://mail.python.org/mailman/listinfo/python-list

ValueError: I/O operation on closed file. with python3

2013-06-11 Thread Adam Mercer
tarting to have some users wanting to use python3 and others sticking to python2 so I'd like to accommodate them both if possible. Cheers Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: How to avoid PEP8 'imported but unused'

2013-05-05 Thread Adam Jiang
Thank you. Problem solved. /Adam On Sun, May 05, 2013 at 06:27:44PM +0100, Fábio Santos wrote: > That assert will never fail. If the symbol is not imported, the import > statement raises ImportError. And actually "assert" makes sure that > the value is not false-ish, not Non

Re: How to avoid PEP8 'imported but unused'

2013-05-05 Thread Adam Jiang
Thanks. It works very well. One more question. In this particular case it seems 'assert' should be safe as a workaround, doesn't it? 'assert' will check if the symbol is imported and not NULL. Is there side effect if I just applied this rule as a generic one. /Adam On S

How to avoid PEP8 'imported but unused'

2013-05-05 Thread Adam Jiang
e views.py. It seems to me that the code is okay because Django requires all functions serve as 'view' is typically go into views.py. 'import' is about get 'signup' function into module 'views.py'. Or, I am totally wrong? Is there a proper way to avoid this w

Re: Print to an IPP printer (pkipplib?)

2013-04-10 Thread Adam Tauno Williams
On Wed, 2010-10-20 at 14:45 +, Martin Gregorie wrote: > On Fri, 15 Oct 2010 15:28:10 -0400, Adam Tauno Williams wrote: > > I've found the module pkipplib which seems to work well for things like > > interrogating an IPP (CUPS) server. But is there a way to send a print >

Re: help needed

2013-04-08 Thread Adam Mesha
e/directory". If you're on Windows it's the same idea, you run the "cmd" program, but you would have to specify the full path to the python interpreter instead of just "python", or follow the directions that have been offered for fixing Windows. Adam www.mesha.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows Deployment Of Python Modules

2013-03-21 Thread Adam Tauno Williams
David Robinow wrote: >On Thu, Mar 21, 2013 at 4:14 PM, Adam Tauno Williams > wrote: >> >> Python itself is easy to deploy on Windows; just toss the MSI in >your >> local update server and away it goes. >> >> That's slick; LSUS is awesome. >>

Windows Deployment Of Python Modules

2013-03-21 Thread Adam Tauno Williams
. Is there some trick to getting modules installed on Windows workstations en masse [in an automated fashion]? It seems like I must be missing something. For example, I want Python installed, and the iniparse module. -- Adam Tauno Williams GPG D95ED383 Systems Administrator, Python Developer,

Re: Why are timezone aware and naive datetimes not distinct classes?

2013-03-11 Thread Adam Tauno Williams
itemiceconsulting.com/2012/10/setting-course-for-utc.html> > Well, it turns out, one of them was a timezone-aware datetime, and all > the others were naive! I finally figured it out when I tried Welcome! -- Adam Tauno Williams GPG D95ED383 Systems Administrator, Python Developer, LP

Re: Do you feel bad because of the Python docs?

2013-02-26 Thread Adam W.
I think learning a language from the documentation is an unreasonable expectation and burden for the authors. Buy a book, take a class, they are designed to provide you with a path from start to finish in a sensible manner, the documentation in my opinion is supposed to be a reference and a ref

Re: stmplib MIMEText charset weirdness

2013-02-26 Thread Adam W.
On Tuesday, February 26, 2013 2:10:28 AM UTC-5, Steven D'Aprano wrote: > On Mon, 25 Feb 2013 20:00:24 -0800, Adam W. wrote: > > The documentation for MIMEText is rather terse, but it implies that the > > parameter given should be a string, not bytes: > > >

stmplib MIMEText charset weirdness

2013-02-25 Thread Adam W.
Can someone explain to me why I can't set the charset after the fact and still have it work. For example: >>> text = MIMEText('❤¥'.encode('utf-8'), 'html') >>> text.set_charset('utf-8') >>> text.as_string() Traceback (most recent call last): File "", line 1, in text.as_string() File "C:\

Re: using urllib on a more complex site

2013-02-24 Thread Adam W.
On Sunday, February 24, 2013 7:27:54 PM UTC-5, Chris Rebert wrote: > On Sunday, February 24, 2013, Adam W. wrote: > I'm trying to write a simple script to scrape > http://www.vudu.com/movies/#tag/99centOfTheDay/99c%20Rental%20of%20the%20day > > > > > in order

Re: using urllib on a more complex site

2013-02-24 Thread Adam W.
On Sunday, February 24, 2013 7:30:00 PM UTC-5, Dave Angel wrote: > On 02/24/2013 07:02 PM, Adam W. wrote: > > > I'm trying to write a simple script to scrape > > http://www.vudu.com/movies/#tag/99centOfTheDay/99c%20Rental%20of%20the%20day > > > > > > i

using urllib on a more complex site

2013-02-24 Thread Adam W.
I'm trying to write a simple script to scrape http://www.vudu.com/movies/#tag/99centOfTheDay/99c%20Rental%20of%20the%20day in order to send myself an email every day of the 99c movie of the day. However, using a simple command like (in Python 3.0): urllib.request.urlopen('http://www.vudu.com/mo

Re: Python scheduler

2013-02-21 Thread Adam Tauno Williams
y 5 mins, 10 secs, 20 secs, 1 min and so forth. I > was wondering what is the best way to do this? If you need a scheduler - use a scheduler! :) <https://pypi.python.org/pypi/APScheduler/> Works great, and very flexible. -- Adam Tauno Williams GPG D95ED383 Systems Administrator, Python

Re: Detecting a click on the turtle screen when the turtle isn't doing anything?

2013-02-06 Thread Adam Funk
On 2013-02-05, Dennis Lee Bieber wrote: > I'll echo the "Ugh" about the use of global AND ADD a dislike of the > busy loop that only exits if some other return sets a value. If the busy > loop were performing some action that changed the test state within the > loop itself, okay... TBH, I w

Re: Detecting a click on the turtle screen when the turtle isn't doing anything?

2013-02-06 Thread Adam Funk
On 2013-02-05, Dave Angel wrote: > I'm no fan of Java. But it's not about a "main" method, it's about > sharing data between functions. Most of the time non-constant globals > are a mistake. If the data can't be passed as an argument, then it > should probably be part of the instance data of

Re: Detecting a click on the turtle screen when the turtle isn't doing anything?

2013-02-05 Thread Adam Funk
On 2013-02-05, Adam Funk wrote: > I'm trying to get a program to do some plotting with turtle graphics, > then wait for the user to click on the graphics window, then do some > more plotting, &c. So far I have the following, which doesn't work: > > #v+ > wait

Re: Detecting a click on the turtle screen when the turtle isn't doing anything?

2013-02-05 Thread Adam Funk
On 2013-02-05, woo...@gmail.com wrote: > Note that the code you posted does not call onclick(). It does, actually, but I accidentally snipped it when C&Ping code into my original post. Sorry! > Globals are > confusing IMHO. Code becomes cleaner and easier to write and read > when you becom

Detecting a click on the turtle screen when the turtle isn't doing anything?

2013-02-05 Thread Adam Funk
? [1] <http://csil-web.cs.surrey.sfu.ca/cmpt120fall2010/wiki/IntroToEventHandling/> Thanks, Adam -- But the government always tries to coax well-known writers into the Establishment; it makes them feel educated. [Robert Graves] -- http://mail.python.org/mailman/listinfo/python-list

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread Adam Tauno Williams
really need a real IDE, as the windows guys around me say I do, You don't need one. You are crazy if you don't WANT one. Check out geany <http://www.geany.org/> -- Adam Tauno Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: changing process name

2012-12-30 Thread Adam Tauno Williams
On Mon, 2012-11-19 at 10:39 +, andrea crotti wrote: > I have very long processes to spawn which I want to lauch as separate > processes (and communicate with ZeroMQ), but now the problem is that the > forked process appears in "ps" with the same name as the launcher > process. > This is a simpl

Re: Paid Python work for 30mins - 1 hour

2012-11-19 Thread Mark Adam
On Mon, Nov 19, 2012 at 10:14 AM, wrote: > I have three scripts that I would like written, they are designed to do the > following: > > Backup.py – Zip a folder and store it on amazon S3 using BOTO with the date > and time as the folder name. > > Restore.py – Grab a file from S3 and download it

Re: date and time comparison how to

2012-11-02 Thread Adam Tauno Williams
On Mon, 2012-10-29 at 16:13 -0700, noydb wrote: > All, > I need help with a date and time comparison. > Say a user enters a date-n-time and a file on disk. I want to compare > the date and time of the file to the entered date-n-time; if the file > is newer than the entered date-n-time, add the fil

Re: a.index(float('nan')) fails

2012-10-27 Thread Mark Adam
On Thu, Oct 25, 2012 at 9:04 PM, Terry Reedy wrote: > On 10/25/2012 9:46 PM, mambokn...@gmail.com wrote: > > a = [float('nan'), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > a >> >> [nan, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > > a.index(float('nan')) >> >> Traceback (most recent call last):

Escaping from the tedium of naive datetime objects.

2012-10-26 Thread Adam Tauno Williams
ns. <http://www.whitemiceconsulting.com/2012/10/setting-course-for-utc.html> [constructive] Feedback and other suggestions appreciated. -- Adam Tauno Williams -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't run any script without it failing due to calling tkinter for no reason

2012-10-14 Thread Adam G
ve built them as command line apps. I've tried uninstalling python 3 > > and reinstalling it to no avail. What did I do, and how can I fix it? > > > > > > Thanks, > > > Adam > > > -- > > > > IDLE uses Tkinter. If you don't have Tk installed, just

Re: Basic JSON question: Do I really need the quotes

2012-10-12 Thread Adam Tauno Williams
On Fri, 2012-10-12 at 19:27 +0200, Roel Schroeven wrote: > moo...@yahoo.co.uk schreef: > > Hi, > > I need to define some configuration in a file that will be manually created. > > Internally, the data will be stored as a dict, which contains various > > properties related to a design > > e.g. Desi

Re: Emulating C++ namespaces with ChainMap and metaclass trickery

2012-10-03 Thread Mark Adam
On Wed, Oct 3, 2012 at 1:26 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > C++ namespaces are useful for encapsulating related objects within a > single file, subdividing the global namespace without using classes. > Python has modules, but they come in separate files. > > Us

Re: Are ABCs an anti-pattern?

2012-10-02 Thread Mark Adam
On Tue, Oct 2, 2012 at 9:23 AM, Demian Brecht wrote: > I don't use them anymore, but I'm curious about others opinions on this > list... > Interesting question. I think they haven't been useful for representing the real world as everyone hoped, but are pretty good for organizing structures withi

Re: python file API

2012-09-24 Thread Mark Adam
On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin wrote: > There are many situations where a little bit of attribute access magic is a > good thing. However, operations that involve the underlying OS and that are > prone to raising exceptions even in bug free code should not be performed > implicitl

Re: Looking for an IPC solution

2012-09-22 Thread Adam Tauno Williams
On Fri, 2012-08-31 at 21:04 +0200, Laszlo Nagy wrote: > I have seen a stand alone cross platform IPC server before that could > serve "channels", and send/receive messages using these channels. But I > don't remember its name and now I cannot find it. Can somebody please help? I strongly recomm

Re: Sending USB commands with Python

2012-08-30 Thread Adam W.
On Thursday, August 30, 2012 12:55:14 AM UTC-4, Dennis Lee Bieber wrote: > > How many bytes did it claim to send? > 11, which is what I expected. But I changed the byte value to 16 (because I was having trouble getting single digit hex values working in the command) and sent this command:

Re: Sending USB commands with Python

2012-08-29 Thread Adam W.
On Wednesday, August 29, 2012 10:07:54 PM UTC-4, Dennis Lee Bieber wrote: > On Wed, 29 Aug 2012 16:45:10 -0700 (PDT), "Adam W." > > I'm a tad curious if using the notation > > > > b'\x1bA' > > > > without the .en

Re: Sending USB commands with Python

2012-08-29 Thread Adam W.
On Wednesday, August 29, 2012 6:56:16 PM UTC-4, Dennis Lee Bieber wrote: > > BUT you do give a possible clue. Is the OP using a 3.x Python where > > strings are Unicode -- in which case the above may need to be explicitly > > declared as a "byte string" rather than text (unicode) string. >

Re: Sending USB commands with Python

2012-08-29 Thread Adam W.
On Wednesday, August 29, 2012 4:09:49 PM UTC-4, Dennis Lee Bieber wrote: > > Don't the commands require an character? "\x1BA" (or >"\x1B\x41") > > OTOH, if the is issued behind the scenes, I'm not sure which esc char it is asking for, I don't think libusb is providing its own,

Re: Sending USB commands with Python

2012-08-29 Thread Adam W.
On Wednesday, August 29, 2012 2:45:17 AM UTC-4, Tim Roberts wrote: > Which operating system are you using? If you are on Windows, then the > > operating system has already loaded a printer driver for this device. > > > The libusb or libusbx libraries can be used to talk to USB devices. There

Sending USB commands with Python

2012-08-28 Thread Adam W.
eone could tell me how to send and receive these commands with Python. Perhaps if you were feeling generous and wanted to write a bit of sample code, sending the "Get Printer Status" command and receiving the response (page 17 of the PDF) would be perfect to get me on my way. T

Re: pycups

2012-08-20 Thread Adam Tauno Williams
On Thu, 2012-08-09 at 04:30 -0700, loial wrote: > I am looking to monitor print jobs on linux via python. > pycups looks a possibility, but I cannot find any useful tutorial, examples > of how to use it. > Can anyone help? Modern CUPs can provide event notifications via RSS; perhaps that would w

Re: Object Models - decoupling data access - good examples ?

2012-08-07 Thread Adam Tauno Williams
On Sat, 2012-08-04 at 20:26 -0700, shearich...@gmail.com wrote: > > > > Just out of curiosity, why do you eschew ORMs? > Good question ! > I'm not anti-ORM (in fact in many circs I'm quite pro-ORM) but for > some time I've been working with a client who doesn't want ORMs used > (they do have quit

Re: PySerial could not open port COM4: [Error 5] Access is denied- please help

2012-06-28 Thread Adam
"Roel Schroeven" wrote in message news:mailman.1618.1340910525.4697.python-l...@python.org... > Temia Eszteri schreef: >> Actually, I believe someone in an earlier thread in the newsgroup or >> elsewhere pointed out that serial ports automatically open under >> Windows. I'd have to look it back

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-28 Thread Adam
"Grant Edwards" wrote in message news:jshotj$s55$1...@reader1.panix.com... > On 2012-06-28, Adam wrote: > >> Obviously pySerial considers the serial port open > > Because it's already been opened by the Python program. > >> and will not open an a

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-27 Thread Adam
"Grant Edwards" wrote in message news:jsg4o8$o4p$1...@reader1.panix.com... > On 2012-06-27, Adam wrote: >> >>> Actually, I believe someone in an earlier thread in the newsgroup or >>> elsewhere pointed out that serial ports automatically open under >>

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-27 Thread Adam
"Temia Eszteri" wrote in message news:ra2nu7h75720i75ijhabg12dngrab75...@4ax.com... > On Wed, 27 Jun 2012 22:18:59 + (UTC), Grant Edwards > wrote: > >>> Can you post a small example showing what you're doing? >> >>The best way to get help is to write as small a program as possible >>that de

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-27 Thread Adam
"Grant Edwards" wrote in message news:jsftah$bb5$1...@reader1.panix.com... > On 2012-06-27, Adam wrote: > >> The Python script needed a call to ser.close() before ser.open() in >> order to work. > > IOW, the port opened OK, but when you tried to open it a seco

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-27 Thread Adam
"Paul" wrote in message news:jsfhv2$ta9$1...@dont-email.me... > Adam wrote: > >> >> This is a tough one. > > Try > >handle -a > allhand.txt > > Then open the allhand.txt with Notepad and look for interesting entries. > > **

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-27 Thread Adam
"Paul" wrote in message news:jsfatv$djt$1...@dont-email.me... > Adam wrote: >> "Paul" wrote in message >> news:jseu9c$sp3$1...@dont-email.me... >>> Adam wrote: >>>> "John Nagle" wrote in message >>>> news:jse604

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-27 Thread Adam
"Paul" wrote in message news:jseu9c$sp3$1...@dont-email.me... > Adam wrote: >> "John Nagle" wrote in message >> news:jse604$1cq$1...@dont-email.me... >>> On 6/26/2012 9:12 PM, Adam wrote: >>>> Host OS:Ubuntu 10.04 LTS >>>&

Re: PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-27 Thread Adam
"John Nagle" wrote in message news:jse604$1cq$1...@dont-email.me... > On 6/26/2012 9:12 PM, Adam wrote: >> Host OS:Ubuntu 10.04 LTS >> Guest OS:Windows XP Pro SP3 >> >> >> I am able to open port COM4 with Terminal emulator. >> >>

PySerial could not open port COM4: [Error 5] Access is denied - please help

2012-06-26 Thread Adam
Host OS:Ubuntu 10.04 LTS Guest OS:Windows XP Pro SP3 I am able to open port COM4 with Terminal emulator. So, what can cause PySerial to generate the following error ... C:\Wattcher>python wattcher.py Traceback (most recent call last): File "wattcher.py", line 56, in ser.open()

Nexus Programming Language

2012-06-09 Thread Adam Campbell
The Nexus programming language version 0.5.0 has been released. It is an "object-oriented, dynamically-typed, reflective programming language", drawing from Lua and Ruby. www.nexuslang.org -- http://mail.python.org/mailman/listinfo/python-list

Re: cmd2, an extenstion of cmd that parses its argument list

2012-05-31 Thread Adam Tauno Williams
On Thu, 2012-05-31 at 15:21 -0400, Adam Tauno Williams wrote: > On Thu, 2012-04-26 at 12:16 -0700, anntzer@gmail.com wrote: > > On Sunday, March 18, 2012 10:12:24 PM UTC-7, anntz...@gmail.com wrote: > > > Dear all, > > > I would like to announce the first public re

Re: cmd2, an extenstion of cmd that parses its argument list

2012-05-31 Thread Adam Tauno Williams
On Thu, 2012-04-26 at 12:16 -0700, anntzer@gmail.com wrote: > On Sunday, March 18, 2012 10:12:24 PM UTC-7, anntz...@gmail.com wrote: > > Dear all, > > I would like to announce the first public release of cmd2, an extension of > > the standard library's cmd with argument parsing, here: > > ht

Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-19 Thread Adam Tauno Williams
On Thu, 2012-05-17 at 11:13 +1000, Chris Angelico wrote: > On Thu, May 17, 2012 at 9:01 AM, Ethan Furman wrote: > > A record is an interesting critter -- it is given life either from the user > > or from the disk-bound data; its fields can then change, but those changes > > are not reflected on

Re: Questions on __slots__

2012-05-19 Thread Adam Tauno Williams
On Fri, 2012-05-18 at 09:53 -0700, Charles Hixson wrote: > Does __slots__ make access to variables more efficient? Absolutely, yes. > If one uses property() to create a few read-only pseudo-variables, does > that negate the efficiency advantages of using __slots__? > (Somehow I feel the documen

Re: parallel subprocess.getoutput

2012-05-14 Thread Adam Skutt
On May 11, 8:04 am, Jaroslav Dobrek wrote: > Hello, > > I wrote the following code for using egrep on many large files: > > MY_DIR = '/my/path/to/dir' > FILES = os.listdir(MY_DIR) > > def grep(regex): >     i = 0 >     l = len(FILES) >     output = [] >     while i < l: >         command = "egrep

Re: Alternative to subprocess in order to not wait for calling commands to complete

2012-05-14 Thread Adam Skutt
would not worry about it for now, but it may be something you need to consider in the future. Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get outer class name from an inner class?

2012-05-09 Thread Adam Skutt
      pass > > This will make it easier in the future for organizing lots of sub-errors. It's no more or less organized than using a module, so use a module. This is why they exist, after all. That being said, this seems like a bad idea to me: this is a lot of code and type

Re: indexed property? Can it be done?

2012-05-08 Thread Adam Tauno Williams
On Mon, 2012-05-07 at 20:15 -0700, Charles Hixson wrote: > class Node: > def__init__(self, nodeId, key, value, downRight, downLeft, parent): > dirty=True > dlu=utcnow() > self.node=[nodeId, downLeft, [key], [value], > [downRight], parent

Re: How can I read streaming output of a subprocess

2012-05-02 Thread Adam Skutt
y clear and worth reading. I encourage you to look through it carefully. It does, unfortunately, gloss over which resources need to be cleaned up and when. Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Communication between C++ server and Python app

2012-05-01 Thread Adam Tauno Williams
On Sat, 2012-04-28 at 17:45 -0700, kenk wrote: > I've got a server process written in C++ running on Unix machine. > On the same box I'd like to run multiple Python scripts that will > communicate with this server. > Can you please suggest what would be best was to achieve this ? Time to start us

Re: why () is () and [] is [] work in other way?

2012-04-28 Thread Adam Skutt
On Apr 28, 7:26 am, Kiuhnm wrote: > On 4/27/2012 19:15, Adam Skutt wrote: > > On Apr 27, 11:01 am, Kiuhnm  wrote: > >> The abstraction is this: > >> - There are primitives and objects. > >> - Primitives are not objects. The converse is also true. > >

Re: CPython thread starvation

2012-04-27 Thread Adam Skutt
concern is being CPU oversubscribed by using lots of processes, I suspect it's probably misplaced. A whole mess of CPU- bound tasks is pretty much the easiest case for a scheduler to handle. Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Borg identity [was Re: why () is () and [] is [] work in other way?]

2012-04-27 Thread Adam Skutt
On Apr 27, 2:40 pm, Steven D'Aprano wrote: > On Fri, 27 Apr 2012 10:33:34 -0700, Adam Skutt wrote: > >> Why should the caller care whether they are dealing with a singleton > >> object or an unspecified number of Borg objects all sharing state? A > >> clev

Re: Direct vs indirect [was Re: why () is () and [] is [] work in other way?]

2012-04-27 Thread Adam Skutt
On Apr 27, 1:06 pm, Steven D'Aprano wrote: > On Thu, 26 Apr 2012 04:42:36 -0700, Adam Skutt wrote: > > On Apr 26, 5:10 am, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > >> But I was actually referring to something more fundamental than that. > &

Re: Python id() does not return an address [was Re: why () is () and [] is [] work in other way?]

2012-04-27 Thread Adam Skutt
On Apr 27, 1:12 pm, Steven D'Aprano wrote: > On Thu, 26 Apr 2012 04:42:36 -0700, Adam Skutt wrote: > > On Apr 26, 5:10 am, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > >> Solution to *what problem*? > > > This confusion that many

Re: Borg identity [was Re: why () is () and [] is [] work in other way?]

2012-04-27 Thread Adam Skutt
On Apr 27, 12:56 pm, Steven D'Aprano wrote: > On Thu, 26 Apr 2012 04:42:36 -0700, Adam Skutt wrote: > > You're going to have to explain the value of an "ID" that's not 1:1 with > > an object's identity, for at least the object's lifecycle, for a &

Re: why () is () and [] is [] work in other way?

2012-04-27 Thread Adam Skutt
On Apr 27, 11:01 am, Kiuhnm wrote: > On 4/27/2012 1:57, Adam Skutt wrote: > > On Apr 26, 6:34 pm, Kiuhnm  wrote: > >>> If you > >> understand that your 'a' is not really an object but a reference to it, > >> everything becomes clear and you

Re: why () is () and [] is [] work in other way?

2012-04-27 Thread Adam Skutt
with defining equality even if NaN didn't exist. We must treat floating-point numbers as a special case in order to write useful working programs. This includes defining equality in a way that's different from what works for nearly every other data type. Adam [1] Due to register spillin

Re: why () is () and [] is [] work in other way?

2012-04-27 Thread Adam Skutt
On Apr 26, 10:56 pm, "OKB (not okblacke)" wrote: > Adam Skutt wrote: > > If I write a function that does a value comparison, then it should > > do value comparison on _every type that can be passed to it_, > > regardless of whether the type is a primitive or an obje

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 7:33 pm, Steven D'Aprano wrote: > On Thu, 26 Apr 2012 12:22:55 -0700, Adam Skutt wrote: > > I often wonder what the world would be like if Python, C#, and Java > > embraced value types more, and had better support for pure functions. > > They would be s

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Thu, Apr 26, 2012 at 5:39 PM, Ian Kelly wrote: > On Thu, Apr 26, 2012 at 1:34 PM, Adam Skutt wrote: >> What I think you want is what I said above: ValueError raised when >> either operand is a /temporary/ object.  Really, it should probably be >> a parse-time error,

Re: Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Thu, Apr 26, 2012 at 12:05 PM, Evan Driscoll wrote: > This thread has already beaten a dead horse enough that the horse came back > as a zombie and was re-killed, but I couldn't help but respond to this part: > > > On 01/-10/-28163 01:59 PM, Adam Skutt wrote: >>

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 6:34 pm, Kiuhnm wrote: > On 4/26/2012 20:54, Adam Skutt wrote: > > On Apr 26, 12:02 pm, Kiuhnm  wrote: > >> On 4/26/2012 16:00, Adam Skutt wrote: > >>> On Apr 26, 9:37 am, Kiuhnm   wrote: > >> The fact that you think that that's "differ

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 2:31 pm, John Nagle wrote: > On 4/26/2012 4:45 AM, Adam Skutt wrote: > > On Apr 26, 1:48 am, John Nagle  wrote: > >> On 4/25/2012 5:01 PM, Steven D'Aprano wrote: > > >>> On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: > > >>>&

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 1:34 pm, rusi wrote: > On Apr 26, 7:44 pm, Adam Skutt wrote: > > On Apr 26, 10:18 am, rusi wrote: > > > > On Apr 26, 4:42 pm, Adam Skutt wrote: > > > > > In a mathematical sense, you're saying that given f(x) = x+2, using > > > >

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 12:02 pm, Kiuhnm wrote: > On 4/26/2012 16:00, Adam Skutt wrote: > > On Apr 26, 9:37 am, Kiuhnm wrote: > >> On 4/26/2012 13:45, Adam Skutt wrote: > > >>> On Apr 26, 1:48 am, John Naglewrote: > >>>> This assumes that everythin

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 10:18 am, rusi wrote: > On Apr 26, 4:42 pm, Adam Skutt wrote: > > > > > In a mathematical sense, you're saying that given f(x) = x+2, using > > f(x) is somehow more "direct" (whatever the hell that even means) than > > using '

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 9:37 am, Kiuhnm wrote: > On 4/26/2012 13:45, Adam Skutt wrote: > > > > > > > > > > > On Apr 26, 1:48 am, John Nagle  wrote: > >> On 4/25/2012 5:01 PM, Steven D'Aprano wrote: > > >>> On Wed, 25 Apr 2012 13:49:24 -07

Re: Overlayong PDF Files

2012-04-26 Thread Adam Tauno Williams
/hgweb/coils/coils/file/9d6c304dd405/src/coils/logic/workflow/actions/doc/watermark.py> -- Adam Tauno Williams <http://www.whitemiceconsulting.com> System Administrator, OpenGroupware Developer, LPI / CNA Fingerprint 8C08 209A FBE3 C41A DD2F A270 2D17 8FA4 D95E D383 signature.asc Descripti

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 1:48 am, John Nagle wrote: > On 4/25/2012 5:01 PM, Steven D'Aprano wrote: > > > On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: > > >> Though, maybe it's better to use a different keyword than 'is' though, > >> due to th

Re: why () is () and [] is [] work in other way?

2012-04-26 Thread Adam Skutt
On Apr 26, 5:10 am, Steven D'Aprano wrote: > On Wed, 25 Apr 2012 20:50:21 -0700, Adam Skutt wrote: > > On Apr 25, 8:01 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > >> On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: > >> >

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Adam Skutt
On Apr 25, 8:01 pm, Steven D'Aprano wrote: > On Wed, 25 Apr 2012 13:49:24 -0700, Adam Skutt wrote: > > Though, maybe it's better to use a different keyword than 'is' though, > > due to the plain English > > connotations of the term; I like 'sameobj&#

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Adam Skutt
mplementation-dependent. > > And what's wrong with that? If you want a language which precisely > specifies all observable behaviour, you're going to end up with a rather > useless language. For a start, it can't have a time() function. For > similar reason

Re: os.system()

2012-04-20 Thread Adam Skutt
t terminates, but there are many correct ways to do that depending on your application and the subprocess. A thread, as suggested by Jacob, is one way to accomplish it. Adam -- http://mail.python.org/mailman/listinfo/python-list

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