New development windows, IronPython or PythonWin

2006-03-23 Thread Dan
Just starting to do some windows Client / Server programming. Which would you recommend? I need to create a server to fire events and communicate with clients over a lan. Thanks -- http://mail.python.org/mailman/listinfo/python-list

COM callbacks in Python

2006-03-23 Thread Dan
I need to register for a COM callback under Windows. I am using an ADO recordset interface like this: import win32com.client import time connect = win32com.client.Dispatch("ADODB.Connection") recordset = win32com.client.Dispatch("ADODB.Recordset") connect.Open("Driver={SQLServer};Server=devserver

Re: New development windows, IronPython or PythonWin

2006-03-24 Thread Dan
>> IronPython is currently nowhere near production quality. I would not >> recommend it. I realise its in beta. But long term, do you think that the win32com, win32gui etc... will have no support because everyone jumps on the Microsoft bandwagon? Aren't the windows support extensions supported pri

Re: COM callbacks in Python

2006-03-24 Thread Dan
Looked at the makepy, code now looks like this: import win32com.client import win32gui import time import pythoncom finished = 0 defaultNamedNotOptArg=pythoncom.Empty class ADOEvents: def OnRecordsetChangeComplete(self, adReason=defaultNamedNotOptArg, pError=defaultNamedNotOptArg,

Re: COM callbacks in Python

2006-03-24 Thread Dan
Ok, seems to fire at least once now, had to implement OnWillChangeRecordset as well. Definitely don't have to implement all the events though. Still not sure why its not acting like it should. Maybe I am looking at the wrong event? I want to know if the database has changed when someone else enters

Re: New development windows, IronPython or PythonWin

2006-03-27 Thread Dan
th the COM support. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: COM Client / Server creation?

2006-03-27 Thread Dan
Thanks, I am going to try to implement with Python. -- http://mail.python.org/mailman/listinfo/python-list

COM server / COM client

2006-03-27 Thread Dan
Does the COM server created with python have to be compiled? I have the need to integrate database access but, I can not have any proprietary software. Meaning no compiled programs built by me. So, if python can do com clients and servers without compiling, Im good. But I don't know if that is poss

Re: COM server / COM client

2006-03-27 Thread Dan
now if it will allow me to subscribe to the events properly. In the ADO interfaces at least you can not receive the events fired from the server via Javascript or VBScript. Thanks, Dan -- http://mail.python.org/mailman/listinfo/python-list

Creating COM server Events?

2006-03-29 Thread Dan
I have need to create a com server that will fire events back to clients. I have looked at some of the documentation and I am new to Python so cant quite get it. I have created an IDL file of the interfaces. Can someone tell me approximately what needs to be done here. I have seen examples of imple

Re: Creating COM server Events?

2006-03-29 Thread Dan
at the interface for the interfacepointer should look like. I mean in my typelib listed in my previous post, the interface for the events were marked as Source so that COM knows that the client must implement them. How do you do that in Python? Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: COM callbacks in Python

2006-03-29 Thread Dan
One final note, The code posted does work. Unfortunately, the event only fires for the ADO connection who actually triggered the event. In my opinion, completely useless event. So the Python worked, The ADO does not do what its name implies. Thanks to all. Dan -- http://mail.python.org/mailman

Can't deepcopy bytes-derived class

2010-12-08 Thread Dan
I have a simple type derived from bytes... class atom(bytes): pass ... that I cannot deepcopy(). The session below demonstrates how deepcopy() of "bytes" works fine, but deepcopy() of "atom" does not. What's going wrong? Thanks, Dan. Python 3.1.2 (r312:79149, Mar

Re: Can't deepcopy bytes-derived class

2010-12-09 Thread Dan
On Dec 8, 9:05 pm, Terry Reedy wrote: > On 12/8/2010 7:11 PM, Ned Deily wrote: > > > > > > > > > > > In article, Terry > > Reedy  wrote: > >> On 12/8/2010 2:42 PM, Dan wrote: > >>> I have a simple type derived from bytes... >

Pickle Encoding Errors

2009-09-20 Thread Dan
more odd is that with an existing "pickle.txt" and destruct set to 1 it seems to work correctly: Unpickled just fine Pickling from destructor... Pickled just fine I'm running Python 2.5.4 on Debian Sid. If anybody understands the error please enlighten me. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickle Encoding Errors

2009-09-20 Thread Dan
On 20 Sep, 13:29, Christian Heimes wrote: > Dan wrote: > > Error unpickling > > Pickling from destructor... > > Exception exceptions.LookupError: 'unknown encoding: raw-unicode- > > escape' in > instance at 0xb7d3decc>> ignored > > > I

Windows binary stdin goes EOF after \x1a character

2010-10-15 Thread Dan
Erlang to launch the Python program as a subprocess. The Erlang fragment that launches this and sends the data is: Port=open_port( {spawn_executable, "c:/Python31/pythonw.exe"}, [{args, ["c:/iotest/main.pyw"]}]), Port ! {self(),{command,lists:seq(

Re: Windows binary stdin goes EOF after \x1a character

2010-10-15 Thread Dan
On Oct 15, 2:42 pm, Neil Cerutti wrote: > On 2010-10-15, Dan wrote: > > > I am writing a Windows program in Python 3.1.2 that reads > > binary data from stdin.  Whenever it hits a \x1a character, > > stdin goes EOF and no more data can be read.  A short program > >

Out of Office AutoReply: Returned mail: Data format error

2005-07-18 Thread Romascanu, Dan (Dan)
Title: Out of Office AutoReply: Returned mail: Data format error I am out-of-office, on a business trip, untill July 23, 2005, and may be able to read your e-mail only after this date. If you need to contact me urgently, please call the mobile phone number +1-917-957-0270. Regards, Dan

Re: Red Black Tree implementation?

2013-05-06 Thread Dan Stromberg
On Mon, May 6, 2013 at 5:55 PM, duncan smith wrote: > > What license? >> >> Thanks! >> >> > Here's the text I usually prepend. > > > ##Copyright (c) 2013 duncan g. smith > ## > ##Permission is hereby granted, free of charge, to any person obtaining a > ##copy of this software and associated docume

Re: First python program, syntax error in while loop

2013-05-06 Thread Dan Sommers
On Mon, 06 May 2013 17:17:01 -0700, alex23 wrote: > One of these days I'll work out why some programmers consider typing to > be "effort". An ironic comment from someone who goes by the moniker wu wei! ;-) The effort, of course, comes in determining what to type, and often how to type less. --

Re: Making safe file names

2013-05-07 Thread Dan Stromberg
On 5/7/13, Andrew Berg wrote: > Currently, I keep Last.fm artist data caches to avoid unnecessary API calls > and have been naming the files using the artist name. However, > artist names can have characters that are not allowed in file names for most > file systems (e.g., C/A/T has forward slashe

Re: Red Black Tree implementation?

2013-05-08 Thread Dan Stromberg
OK, I've got one copy of trees.py with md5 211f80c0fe7fb9cb42feb9645b4b3ffe. You seem to be saying I should have two though, but I don't know that I do... On 5/8/13, duncan smith wrote: > On 07/05/13 02:20, Dan Stromberg wrote: >> >> On Mon, May 6, 2013

Re: object.enable() anti-pattern

2013-05-08 Thread Dan Sommers
a thread: initialize it synchronously, and then let it execute asynchronously. We tend towards that pattern even when we know that execution will be synchronous, because we also that it could be asynchronous one day. Yes, we could wrap that up in a neat bundle, but explicit is better than implicit. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: object.enable() anti-pattern

2013-05-08 Thread Dan Sommers
s it: > > f = open("some_file.txt") # if this succeeds, f is ready to use > data = f.read() That's just the "enable" paradigm in a socially acceptable and traditional wrapper. Opening and closing the file is an implementation detail, often defeated by caching (application level or OS level) anyway. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: object.enable() anti-pattern

2013-05-09 Thread Dan Sommers
on could provide encoding, or isatty, on un-opened files. Of these, truncate might be the closest use case of creating a file object without any intent to write to it, for some definition of "write to it." Dan [0] Yes, I understand that asking first instead of trying to delete the file is ju

Re: Red Black Tree implementation?

2013-05-11 Thread Dan Stromberg
5 11 False 6 15 11 False 6 15 11 False 6 15 Thoughts? BTW, printing an empty tree seems to say "sentinel". 'not sure if that was intended. Thanks! On Thu, May 9, 2013 at 6:52 AM, duncan smith wrote: > On 09/05/13 02:40, Dan Stromberg wrote: > >> OK, I've got o

Re: Red Black Tree implementation?

2013-05-11 Thread Dan Stromberg
On Sat, May 11, 2013 at 4:24 PM, Dan Stromberg wrote: > > I'm afraid I'm having some trouble with the module. I've checked it into > my SVN at > http://stromberg.dnsalias.org/svn/red-black-tree-mod/trunk/duncan > > I have two versions of your tests in there now

Re: [Off topic] Software epigrams

2013-05-13 Thread Dan Sommers
ned my program the right way, what's relevant in one place (package, module, function, line of code) is different from what's relevant in another. Dan -- http://mail.python.org/mailman/listinfo/python-list

TypeError: unbound method add() must be called with BinaryTree instance as first argument (got nothing instead)

2013-05-18 Thread Dan Stromberg
I'm getting the error in the subject, from the following code: def add(self, key): """ Adds a node containing I{key} to the subtree rooted at I{self}, returning the added node. """ node = self.find(key) if not node: node.key = key

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

2013-05-18 Thread Dan Stromberg
With CPython 2.7.3: ./t time taken to write a file of size 52428800 is 15.86 seconds time taken to write a file of size 52428800 is 7.91 seconds time taken to write a file of size 52428800 is 9.64 seconds With pypy-1.9: ./t time taken to write a file of size 52428800 is 3.708232 seconds

Ordered dictionaries compared

2013-05-22 Thread Dan Stromberg
What kind of ordered dictionaries? Sorted by key. I've redone the previous comparison, this time with a better red-black tree implementation courtesy of Duncan G. Smith. The comparison is at http://stromberg.dnsalias.org/~strombrg/python-tree-and-heap-comparison/just-trees/ The Red-Black tree g

Re: Modules list-tool

2013-05-22 Thread Dan Stromberg
On Tue, May 21, 2013 at 12:35 PM, Gisle Vanem wrote: > Are anyone aware of a tool that can show me at run-time > which modules (pyd/dll) are loaded into a Python program at a specific > time (or over time)? > > To clarify, e.g. when running a sample from PyQt4 > (examples\tutorials\**addressbook\

Re: Ordered dictionaries compared

2013-05-23 Thread Dan Stromberg
On Thu, May 23, 2013 at 9:41 AM, duncan smith wrote: > > RBT is quicker than Treap for insertion with randomized data, but slower > with ordered data. Randomized data will tend to minimize the number of tree > rotations needed to keep the RBT balanced, whilst the Treap will be > performing rotatio

Re: Help with implementing callback functions using ctypes

2013-05-23 Thread Dan Stromberg
On Wed, May 8, 2013 at 10:54 PM, dieter wrote: > jamadagni writes: > > ... > I cannot help you with "ctypes". But, if you might be able to use > "cython", then calling callbacks is not too difficult > (you can find an example in e.g. my "dm.xmlsec.binding"). > > Note, however, that properly hand

Re: Prepending string "@" to usernames

2013-05-24 Thread Dan Stromberg
On Fri, May 24, 2013 at 3:53 PM, Thomas Murphy wrote: > Hi beloved list, > > I'm having a dumb and SO doesn't seem to have this one answered. I was > sent a long list of instagram usernames to tag for a nightlife > announcement in this format(not real names(i hope)) > > cookielover93 > TheGermanHa

Survey of Python-in-browser technologies

2013-05-24 Thread Dan Stromberg
I'm putting together a spreadsheet about Python-in-the-browser technologies for my local python user group. I've been hitting the mailing lists for the various implementations already, but I thought I should run it by people here at least once. Anyway, here it is: http://stromberg.dnsalias.org/~

Re: Survey of Python-in-browser technologies

2013-05-24 Thread Dan Stromberg
Security is an important topic... but I'm not sure how I could gather info about the security of these implementations. Still, it's an idea worth at least keeping in the back of my mind. On Fri, May 24, 2013 at 4:43 PM, Carlos Nepomuceno < carlosnepomuc...@outlook.com> wrote: &

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

2013-05-25 Thread Dan Sommers
"license" for more information. >>> import random >>> random.random() + 1e200 1e+200 >>> random.random() - 1e200 -1e+200 >>> random.random() / 1e309 0.0 But you knew that. ;-) Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with implementing callback functions using ctypes

2013-05-26 Thread Dan Stromberg
On Sun, May 26, 2013 at 9:12 AM, Shriramana Sharma wrote: > On Friday, May 24, 2013 8:56:28 AM UTC+5:30, Dan Stromberg wrote: > > Cython is good. So is the new cffi, which might be thought of as a > > safer (API-level) version of ctypes (which is ABI-level). > > Hi -- can you

Re: Python #ifdef

2013-05-28 Thread Dan Stromberg
Here're slides from a presentation about writing code that runs on 2.x and 3.x: http://stromberg.dnsalias.org/~dstromberg/Intro-to-Python/ And in case you still want a preprocessor for Python (you likely don't need one this time), here's an example of doing this using the venerable m4: https://pyp

Re: How clean/elegant is Python's syntax?

2013-05-29 Thread Dan Stromberg
On Wed, May 29, 2013 at 11:13 AM, Ma Xiaojun wrote: > Hi, list. > > For the core language, I have mixed feeling. On one hand, I find that > Python has some sweet feature that is quite useful. On the other hand, > I often find Pyhton snippets around hard to understand. I admit that I > never learn

Re: Python 2-3 compatibility

2013-06-02 Thread Dan Stromberg
From http://stromberg.dnsalias.org/~dstromberg/Intro-to-Python/Python%202%20and%203.pdf: Try/Except: both 2.x and 3.x try: print(1/0) except ZeroDivisionError: extra = sys.exc_info()[1] print('oops') HTH On Sun, Jun 2, 2013 at 7:13 AM, Jason Swails wrote: > Hello Everyone, > > I ha

Re: PyWart: The problem with "print"

2013-06-02 Thread Dan Sommers
on-and-off" nonsense, are you willing to have you code slowed by >>numerous calls to a dead function containing a comparison that >>will always be false? > > Hmm. Could be costly ... Yeah, all that time that I have left over and have to find something else to do instead of debugging my program. What a waste! ;-) Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Arp cache poisoning using scapy

2013-06-02 Thread Dan Stromberg
On Sun, Jun 2, 2013 at 11:19 AM, wrote: > > I am trying to get the arp cache poisoning working with scapy and python > but having problems > > The python script itself is very simple: > root@ubuntu:/home/joker/Downloads/scapy-2.2.0/scripts# cat arp_poison.py > #!/usr/bin/env python > > import sys

Re: Issue converting to string to integer.

2013-06-02 Thread Dan Stromberg
On Sun, Jun 2, 2013 at 6:12 PM, Fdama wrote: > Hi, > > I was following an exercise in a book when I edited the code and came > across something I did not get. Here is the relevant part of the code that > works: > > start=None #initialise > while start !="": > start=input("\nStart: ") > >

Re: Issue converting to string to integer.

2013-06-02 Thread Dan Sommers
first version, the "if" statement prevents the conversion from happening when there is no input. In the second version, though, python tries to do the conversion with no input, and fails. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: The problem with "print"

2013-06-02 Thread Dan Sommers
On Sun, 02 Jun 2013 20:16:21 -0400, Jason Swails wrote: > ... If you don't believe me, you've never hit a bug that 'magically' > disappears when you add a debugging print statement ;-). Ah, yes. The Heisenbug. ;-) We used to run into those back in the days of C and assembly language. They're m

Re: PyWart: The problem with "print"

2013-06-02 Thread Dan Sommers
On Sun, 02 Jun 2013 23:23:42 -0400, Jason Swails wrote: > On Sun, Jun 2, 2013 at 11:10 PM, Dan Sommers > wrote: >> Ah, yes. The Heisenbug. ;-) > > Indeed. Being in the field of computational chemistry/physics, I was > almost happy to have found one just to say I wa

Python Heisenbugs? (was: Re: PyWart: The problem with "print")

2013-06-02 Thread Dan Sommers
On Mon, 03 Jun 2013 13:37:27 +1000, Tim Delaney wrote: > With the increase in use of higher-level languages, these days > Heisenbugs most often appear with multithreaded code that doesn't > properly protect critical sections, but as you say, with lower-level > languages uninitialised memory is a c

Re: How to get an integer from a sequence of bytes

2013-06-03 Thread Dan Stromberg
On Mon, Jun 3, 2013 at 7:31 AM, Grant Edwards wrote: > That's a common assumption, but historically, a "byte" was merely the > smallest addressable unit of memory. The size of a "byte" on widely > used used CPUs ranged from 4 bits to 60 bits. > > Quoting from http://en.wikipedia.org/wiki/Byte > >

Re: How to get an integer from a sequence of bytes

2013-06-03 Thread Dan Stromberg
On Mon, Jun 3, 2013 at 4:18 PM, Carlos Nepomuceno < carlosnepomuc...@outlook.com> wrote: > > > Date: Mon, 3 Jun 2013 15:41:41 -0700 > > Subject: Re: How to get an integer from a sequence of bytes > > From: drsali...@gmail.com > > To: python-list@python.org > [...]

Re: [Python-Dev] Do you consider Python a 4GL? Why (not)?

2013-06-04 Thread Dan Stromberg
On Tue, Jun 4, 2013 at 4:53 PM, Carlos Nepomuceno < carlosnepomuc...@outlook.com> wrote: > Do you consider Python a 4GL? Why (not)? > By the wikipedia definition of 4GL and 5GL, I'd say Python is neither. And it's not a VHLL either, again according to the wikipedia definition. But IMO it is too

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-06 Thread Dan Stromberg
On Thu, Jun 6, 2013 at 9:49 AM, Rick Johnson wrote: > Congrats: Again you join the ranks of most children who make excuses for > their foolish actions along the lines of: > > "Hey, they did it first!" > > Well, the lemmings get what they deserve i suppose. > Lemmings don't really jump off cliffs

Re: Python Game Development?

2013-06-07 Thread Dan Stromberg
On Fri, Jun 7, 2013 at 8:53 AM, wrote: > I also understand that Python isn't exactly the *BEST* choice programming > a game, but I have heard it is possible. Tell me if it's true. Thanks! > One of the Blizzard people told me that it's very common to program game logic in Python, with the 3D stuf

Re: Version Control Software

2013-06-15 Thread Dan Sommers
On Sat, 15 Jun 2013 15:29:27 +, Giorgos Tzampanakis wrote: > Also, is working without connection to the server such big an issue? > One would expect that losing access to the central server would > indicate significant problems that would impact development anyway. Everyone and every device i

Re: None shown in output

2012-06-21 Thread Dan Sommers
) formats that None into the string "None." Finally, this: print "%r" % (get_numbers(1, 2, 'minus')) prints that string. > Output: > > C:\code\python>ex19.py > -1 This "-1" comes from get_numbers. > None This "None" comes f

Re: How keep python socket alive for ever by setting Keep alive flag.

2012-06-25 Thread Dan Stromberg
http://www.unixguide.net/network/socketfaq/4.7.shtml It's better to add the ability to recreate a socket if it encounters trouble. SO_KEEPALIVE is there to help you detect if the other end of your connection has disappeared. Network programming has relatively few absolutes - it's best to build in

Re: I can't send images to this mail-list

2012-06-29 Thread Dan Sommers
On Fri, 29 Jun 2012 21:59:41 -0400 Dave Angel wrote: > On 06/29/2012 06:59 PM, Dennis Lee Bieber wrote: > > On Fri, 29 Jun 2012 21:13:09 +0100, Mark Lawrence > > declaimed the following in > > gmane.comp.python.general: > > > >> On 29/06/2012 16:26, Ethan Furman wrote: > >>> Ben Finney wrote: >

Re: when "normal" parallel computations in CPython will be implemented at last?

2012-07-01 Thread Dan Stromberg
If something happens with this for CPython, it'll likely come from Pypy developers first. They seem to be interested in doing things in a way that is (or can be made) compatible with CPython. If you want to help them along, they're taking donations to fund the work, or you could donate your own t

Re: when "normal" parallel computations in CPython will be implemented at last?

2012-07-01 Thread Dan Stromberg
On Sun, Jul 1, 2012 at 11:58 AM, Thomas Jollans wrote: > On 07/01/2012 08:44 PM, Dan Stromberg wrote: > > IronPython, sadly, lacks a python standard library. > > > Beg pardon? > > > https://github.com/IronLanguages/main/tree/master/External.LCA_RESTRICTED/Languages/

Re: Best data structure for DFS on large graphs

2012-07-03 Thread Dan Stromberg
On Tue, Jul 3, 2012 at 3:08 PM, Miheer Dewaskar wrote: > On Tue, Jul 3, 2012 at 8:10 PM, Tim Chase > wrote: > I want it to be a generic Game solver.So the number of states depends > on the game. > Keep in mind that it would probably be a generic game solver for games that have simple board evalu

Why site-packages?

2012-07-03 Thread Dan Stromberg
Why is it that so much 3rd party python code gets installed to site-packages? Even for things that are almost certainly going to be used by a single application? Even for things you might only use once? Even for things that might require one version for one app, and another version for another a

Re: Why site-packages?

2012-07-03 Thread Dan Stromberg
On Tue, Jul 3, 2012 at 9:04 PM, Ian Kelly wrote: > On Tue, Jul 3, 2012 at 2:40 PM, Dan Stromberg wrote: > > > > Why is it that so much 3rd party python code gets installed to > > site-packages? > > Because that's what site-packages is for? > Agh. But -why-

Re: Why site-packages?

2012-07-03 Thread Dan Stromberg
On Tue, Jul 3, 2012 at 10:04 PM, Ian Kelly wrote: > > >> The site module has to process any .pth files in the site-packages, > >> but apart from that, I think the actual amount of stuff in > >> site-packages should be irrelevant. > > > > Irrelevant to what? More stuff in site slowing things dow

Re: How to safely maintain a status file

2012-07-09 Thread Dan Stromberg
On Mon, Jul 9, 2012 at 8:24 PM, John Nagle wrote: > On 7/8/2012 2:52 PM, Christian Heimes wrote: > >> You are contradicting yourself. Either the OS is providing a fully >> atomic rename or it doesn't. All POSIX compatible OS provide an atomic >> rename functionality that renames the file atomical

Re: lambda in list comprehension acting funny

2012-07-14 Thread Dan Stromberg
On Sat, Jul 14, 2012 at 4:29 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > I don't remember whether it is Javascript or PHP that uses dynamic > binding, but whichever it is, it is generally considered to be a bad > idea, at least as the default or only behaviour. > > Bash is

Re: PyPy, is it a 1:1 replacement for CPython?

2012-07-20 Thread Dan Stromberg
On Fri, Jul 20, 2012 at 8:59 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Sat, 21 Jul 2012 13:35:21 +1000, Simon Cropper wrote: > > > Hi, > > > > Can you use PyPy as a direct replacement for the normal python or is it > > a specialized compiler that can only work with li

command line option parsing and pylint?

2012-07-22 Thread Dan Stromberg
Is there such a thing as a Python option parsing module, that plays well with pylint? I've been doing my own option parsing to get working static analysis. -- http://mail.python.org/mailman/listinfo/python-list

default repr?

2012-07-22 Thread Dan Stromberg
If a class has defined its own __repr__ method, is there a way of getting the default repr output for that class anyway? I'm attempting to graph some objects by digging around in the garbage collector's idea of what objects exist, and when I go to format them for the graph node labels, the ones th

Re: howto do a robust simple cross platform beep

2012-07-24 Thread Dan Stromberg
On Sat, Jul 14, 2012 at 1:00 AM, Gelonida N wrote: > > What I do at the moment is: > > For Windows I use winsound.Beep > > For Linux I create some raw data and pipe it into sox's > 'play' command. > > I don't consider this very elegant You may want to get over that. Some software vendors/distr

Re: dict: keys() and values() order guaranteed to be same?

2012-07-26 Thread Dan Stromberg
On Thu, Jul 26, 2012 at 9:06 PM, Ethan Furman wrote: > Chris Angelico wrote: > >> On Tue, Jul 24, 2012 at 1:20 AM, Steven D'Aprano >> > >> wrote: >> >>> (Although if you think about the implementation of dicts as hash tables, >>> it does seem likely that it is trivial to enforce this -- one would

Re: Extracting bit fields from an IEEE-784 float

2012-07-29 Thread Dan Sommers
bit fields from the int, e.g. to grab the sign bit: > > (i & 0x8000) >> 63 > 3) Any other problems with the way I am doing this? No, but perhaps this would be clearer: import math sign = math.copysign(1.0, x) There are solutions that use math.frexp, too,

Re: Is Python a commercial proposition ?

2012-07-29 Thread Dan Stromberg
On Sun, Jul 29, 2012 at 5:52 PM, Andrew Berg wrote: > On 7/29/2012 7:12 PM, Rodrick Brown wrote: > > Python is a glue language much like Perl was 10 years ago. Until the > > GIL is fixed I doubt anyone will seriously look at Python as an option > > for large enterprise standalone application devel

Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Dan Stromberg
On Mon, Jul 30, 2012 at 12:44 AM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > I wish to extract the bit fields from a Python float, call it x. First I > cast the float to 8-bytes: > > s = struct.pack('=d', x) > i = struct.unpack('=q', s)[0] > > Then I extract the bit fields fr

Re: Linux shell to python

2012-07-30 Thread Dan Stromberg
On Mon, Jul 30, 2012 at 9:26 PM, Barry Scott wrote: > lspci gets all its information from the files in /sys/bus/pci/devices. > > You can use os.listdir() to list all the files in the folder and then open > the files you want to get the data you need. > Gee, wouldn't it be more portable to parse

Re: Linux shell to python

2012-07-30 Thread Dan Stromberg
On Mon, Jul 30, 2012 at 11:14 PM, Emile van Sebille wrote: > On 7/30/2012 3:56 PM Dan Stromberg said... > > >> On Mon, Jul 30, 2012 at 9:26 PM, Barry Scott > > > And of course you can write list comprehensions on as many lines as >> it take to make the code

Re: Looking for a good introduction to object oriented programming with Python

2012-08-05 Thread Dan Sommers
On 2012-08-06 at 00:27:43 +, Steven D'Aprano wrote: > I frequently draw diagrams to understand the relationships between my > classes and the problem I am trying to solve. I almost invariably use one > type of box and one type of arrowhead. Sometimes if I'm bored I draw > doodles on the di

Re: trying to create simple py script

2012-08-10 Thread Dan Stromberg
CGI's old stuff. Sure it's easy to find doc about it - it's been around longer. I'd recommend either CherryPy or Bottle - because these are the two (that I know of) that support Python 3 today. Here's a nice comparison of Python REST frameworks: http://www.youtube.com/watch?v=AYjPIMe0BhA I'm u

Re: Threads and sockets

2012-08-10 Thread Dan Stromberg
A select() loop should work. On Fri, Aug 10, 2012 at 1:01 PM, loial wrote: > I am writing an application to send data to a printer port(9100) and then > recieve PJL responses back on that port. Because of the way PJL works I > have to do both in the same process(script). > > At the moment I do n

Re: Unable to execute the script

2012-08-10 Thread Dan Stromberg
This sounds like a ScriptAlias thing: http://httpd.apache.org/docs/2.2/howto/cgi.html On Fri, Aug 10, 2012 at 5:14 PM, Smaran Harihar wrote: > Hi, > > I have set executable permissions for my py script (cgi-script) but for > some reason rather than executing it, the browser simply downloads the p

Re: [OT] Posting under ones full name

2012-08-15 Thread Dan Sommers
ese antlers on I am dictating and when I take them off I am not dictating. -- Dan (who doesn't mind whether you use my last name or not) -- http://mail.python.org/mailman/listinfo/python-list

Re: [CGI] Why is HTML not rendered?

2012-08-17 Thread Dan Sommers
red: ... [with all due respect and apologies to another thread on this list!] > print "Content-Type: text/plain;charset=utf-8" That line tells the browser that the response is plain text. Do this instead to have the browser render the HTML: print "Content-Type: text/html

Re: python 6 compilation failure on RHEL

2012-08-20 Thread Dan Stromberg
On Mon, Aug 20, 2012 at 10:25 PM, Cameron Simpson wrote: > I was going to chime in with this anyway had the thread said nothing; I > strongly prefer to specify --prefix explicitly with configure. > > My personal habit to to build with (adjust to match): > > --prefix=/usr/local/python-2.6.4 > >

Reimporting modules, and sandboxing?

2012-08-21 Thread Dan Stromberg
I know I've seen this discussed before, and I came away from observing the discussion thinking "Python doesn't do that very well...", but we have some people here who really would like to do this, and I need to better understand the pros and cons now. Is there a good way of reimporting an _indepen

Re: Flexible string representation, unicode, typography, ...

2012-08-26 Thread Dan Sommers
then you get that, too. Calling your code points int32 is a bad idea for the same reason that it turned out to be a bad idea to call all my old ASCII characters int8. Or all my pointers int (or unsigned int), for n in 16, 20, 24, 32, 36, 48, or 64 (or I'm sure other values of n that I never had

Re: Comparing strings from the back?

2012-09-03 Thread Dan Sommers
would propose = for the third string-equality operator! ;-) Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-10 Thread Dan Goodman
ted, use interned versions of the strings. This is basically the same solution but even better. In this case, your startup costs will be higher (creating the strings) but your comparisons will always be instant. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-10 Thread Dan Goodman
Python is very clever as always! :) Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-10 Thread Dan Goodman
On 10/09/2012 18:07, Dan Goodman wrote: On 04/09/2012 03:54, Roy Smith wrote: Let's assume you're testing two strings for equality. You've already done the obvious quick tests (i.e they're the same length), and you're down to the O(n) part of comparing every charac

Re: using text file to get ip address from hostname

2012-09-15 Thread Dan Katorza
בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת Dan Katorza: > hello , > > > > i'm new to Python and i searched the web and could not find an answer for my > issue. > > > > i need to get an ip address from list of hostnames which are in a textfile

Re: using text file to get ip address from hostname

2012-09-15 Thread Dan Katorza
בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת Dan Katorza: > hello , > > > > i'm new to Python and i searched the web and could not find an answer for my > issue. > > > > i need to get an ip address from list of hostnames which are in a textfile

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
בתאריך יום ראשון, 16 בספטמבר 2012 01:43:31 UTC+3, מאת Dan Katorza: > בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת Dan Katorza: > > > hello , > > > > > > > > > > > > i'm new to Python and i searched t

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
בתאריך יום רביעי, 19 בספטמבר 2012 11:14:29 UTC+3, מאת Chris Angelico: > On Wed, Sep 19, 2012 at 5:41 PM, Dan Katorza wrote: > > > > > > Hello again, > > > I have another question and i hope you will understand me.. > > > Is there any option where you can

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
בתאריך יום רביעי, 19 בספטמבר 2012 11:50:56 UTC+3, מאת Dan Katorza: > בתאריך יום רביעי, 19 בספטמבר 2012 11:14:29 UTC+3, מאת Chris Angelico: > > > On Wed, Sep 19, 2012 at 5:41 PM, Dan Katorza wrote: > > > > > > > > > > > > > > Hello agai

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
בתאריך יום רביעי, 19 בספטמבר 2012 12:11:04 UTC+3, מאת Dan Katorza: > בתאריך יום רביעי, 19 בספטמבר 2012 11:50:56 UTC+3, מאת Dan Katorza: > > > בתאריך יום רביעי, 19 בספטמבר 2012 11:14:29 UTC+3, מאת Chris Angelico: > > > > > > > On Wed, Sep 19, 20

Re: using text file to get ip address from hostname

2012-09-19 Thread Dan Katorza
בתאריך יום רביעי, 19 בספטמבר 2012 15:28:23 UTC+3, מאת Dan Katorza: > בתאריך יום רביעי, 19 בספטמבר 2012 12:11:04 UTC+3, מאת Dan Katorza: > > > בתאריך יום רביעי, 19 בספטמבר 2012 11:50:56 UTC+3, מאת Dan Katorza: > > > > > > > בתאריך יום רביעי, 19 בספטמבר 2012 1

Static analysis tools

2012-10-11 Thread Dan Stromberg
I'm familiar with pylint, and have recently played with pyflakes and flake8. I've also heard of pychecker. Are there others, perhaps including some that aren't written in Python, but still check Python? We're considering doing static analysis of a large CPython 3.2 project, but so far the traditi

Re: A desperate lunge for on-topic-ness

2012-10-18 Thread Dan Stromberg
On Wed, Oct 17, 2012 at 11:06 PM, Zero Piraeus wrote: > : > > Okay, so, first thing vaguely Python-related that comes to mind [so > probably not even slightly original, but then that's not really the > point]: > > What are people's preferred strategies for dealing with lines that go > over 79 cha

Good debugger for CPython 3.2?

2012-10-19 Thread Dan Stromberg
What's a good debugger for CPython 3.2? I'd prefer to use it on Linux Mint 13, and I'd be happy with something based on X11 or curses. I tried winpdb, but it was cranky that Linux didn't have a spawn callable. Why they didn't use the portable subprocess module escapes me. I also tried ddd, but i

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