Re: Zope newsgroups? Need help with POSKeyError

2005-01-03 Thread Dan Stromberg
On Sat, 01 Jan 2005 10:47:41 +1100, richard wrote: > Bob Horvath wrote: >> I have a Zope/Plone combination that I have been having POSKeyErrors >> with for a while now. Are there any newsgroups that deal with Zope? > > No, but there is a mailing list - see zope.org > > Also, try google searchin

Re: Checking for X availability

2005-01-11 Thread Dan Stromberg
On Tue, 11 Jan 2005 03:32:01 -0800, Flavio codeco coelho wrote: > I have a program that uses pythondialog for its UI. > > Pythondialog is a wrapper of the shell dialog and xdialog libs. > > But I would like for it to switch between using Dialog ( when X is not > available ) and xdialog (when X

buffered socket class

2005-01-17 Thread Dan Stromberg
I finally took a moment to put my buffered socket class, bufsock.py, on a web page. It's a wrapper class for python sockets. It should reduce tinygrams, as well as provide a more convenient interface to the application programmer. It includes functions for reading a certain number bytes, readin

pure python code to do modular-arithmetic unit conversions?

2005-01-21 Thread Dan Stromberg
Is there already a pure python module that can do modular-arithmetic unit conversions, like converting a huge number of seconds into months, weeks... or a bandwidth measure into megabits/s or gigabits/s or megabytes/s or gigabytes/s, whatever's the most useful (ala df -h)? Thanks! -- http://mai

mounting a filesystem?

2005-02-03 Thread Dan Stromberg
Is there a python module that can mount a filesystem? More specifically, a loopback filesystem with a particular offset, under linux? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Logging all activity on a tty/pty?

2005-08-23 Thread Dan Stromberg
Is there a way, using python, to (voluntarily) log all activity in a given shell, in a way that should work on pretty much all *ix's with a port of python? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

netmask arithmetic?

2005-02-25 Thread Dan Stromberg
Before I go and reinvent the wheel, does anyone already have python code that can do netmask arithmetic - for example, determining if a list of hostnames are on subnets described by a list of networks+netmasks like: 128.200.34.0/24 128.195.16.128/25 ...and so on? Thanks! -- http://mail.python

psyco -and- python -O

2005-02-27 Thread Dan Stromberg
Is it useful to combine psyco with python -O, or do they conflict? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

HTML purifier using BeautifulSoup?

2004-12-21 Thread Dan Stromberg
Has anyone tried to construct an HTML janitor script using BeautifulSoup? My situation: I'm trying to convert a series of web pages from .html to palmdoc format, using plucker, which is written in python. The plucker project suggests passing html through "tidy", to get well-formed html for pluc

mime to text in python?

2005-03-24 Thread Dan Stromberg
I'm looking for a python program that can: 1) Convert mime to text 2) Is callable from a .procmailrc 3) Would at least keep pgp signed text, if not actually verify the signatures 4) It'd be beyond cool if it could also render .jpeg attachments as ANSI text graphics :) 5) Maybe even convert wo

sparse sets of integers?

2005-04-04 Thread Dan Stromberg
Does anyone have a python implementation (or python C/C+ extension) that would allow me to perform set operations (union, intersection, difference, number of elements, &c) over very large collections of integers? Some of the sets may have over 10**11 (probably less than 10**13 though) integers in

bourne shell parser in python

2005-04-07 Thread Dan Stromberg
Hi folks. We have a huge collection of sysadmin knowledge that's encoded in a vast array of bourne shell scripts. I'm now beginning to think that a transition to cfengine or similar might be a good idea, but I'm loathe to toss out all that /bin/sh code that's kept us from having to worry about n

converting binary data

2005-04-27 Thread Dan Stromberg
I've written up a page about how to convert native binary data to another platform's native binary data, as I did some fortran data conversions for a client. The programs and documentation are at: http://dcs.nac.uci.edu/~strombrg/converting-binary.html So far, the page includes a variety of pro

Re: RapydScript : Python to Javascript translator

2013-11-18 Thread Dan Stromberg
On Sun, Nov 17, 2013 at 11:16 AM, Salvatore DI DIO < salvatore.di...@gmail.com> wrote: > Hello, > > If someone is interested about a fast Python to Javascript translator > (not a compiler like Brython which is another beast) > RapydScript is interesting. Here's a comparison of several Python-in-

Re: sendmail library ?!

2013-11-18 Thread Dan Stromberg
On Tue, Nov 12, 2013 at 8:52 PM, Tamer Higazi wrote: > Hi people! > > I am looking for a python library that does mailing directly through > "sendmail". > I use: http://stromberg.dnsalias.org/svn/mailer/trunk/mailer.py -- https://mail.python.org/mailman/listinfo/python-list

Re: Recursive generator for combinations of a multiset?

2013-11-21 Thread Dan Stromberg
On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan wrote: > > Short story: the subject says it all, so if you have an answer already, > fire away. Below is the long story of what I'm using it for, and why I > think it needs to be recursive. It may even be of more general > interest in terms of filteri

Re: python for everyday tasks

2013-11-22 Thread Dan Stromberg
Teach that Python emphasizes readability. Perhaps talk about bugs / lines_of_code being roughly a constant. Then talk about the fact that Python generally takes fewer lines of code to express the same thing. This implies fewer bugs for many projects. Teach the fundamental types, with difference

Re: Recursive generator for combinations of a multiset?

2013-11-22 Thread Dan Stromberg
On Fri, Nov 22, 2013 at 4:58 PM, John O'Hagan wrote: > On Thu, 21 Nov 2013 12:59:26 -0800 > Dan Stromberg wrote: > > > On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan > > wrote: > > > > > > > > Short story: the subject says it all, so if yo

Re: python for everyday tasks

2013-11-22 Thread Dan Stromberg
I almost forgot: Talk about pypi and pip (or similar) too. On Fri, Nov 22, 2013 at 3:59 PM, wrote: > >> Hello, >> >> I'm about held a short course with the title indicated in the subjects. >> The students are very experienced programmers of our company, with deep >> knoledge on C, C++, C#, Perl a

Re: Recursive generator for combinations of a multiset?

2013-12-05 Thread Dan Stromberg
On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan wrote: > > Short story: the subject says it all, so if you have an answer already, > fire away. Below is the long story of what I'm using it for, and why I > think it needs to be recursive. It may even be of more general > interest in terms of filteri

Re: squeeze out some performance

2013-12-06 Thread Dan Stromberg
On Fri, Dec 6, 2013 at 2:38 PM, Mark Lawrence wrote: > On 06/12/2013 16:52, John Ladasky wrote: > >> On Friday, December 6, 2013 12:47:54 AM UTC-8, Robert Voigtländer wrote: >> >> I try to squeeze out some performance of the code pasted on the link >>> below. >>> http://pastebin.com/gMnqprST >>>

One liners

2013-12-06 Thread Dan Stromberg
Does anyone else feel like Python is being dragged too far in the direction of long, complex, multiline one-liners? Or avoiding temporary variables with descriptive names? Or using regex's for everything under the sun? What happened to using classes? What happened to the beautiful emphasis on r

Re: One liners

2013-12-06 Thread Dan Stromberg
On Fri, Dec 6, 2013 at 4:10 PM, Michael Torrie wrote: > On 12/06/2013 04:54 PM, Dan Stromberg wrote: > > Does anyone else feel like Python is being dragged too far in the > direction > > of long, complex, multiline one-liners? Or avoiding temporary variables > > wit

Re: One liners

2013-12-06 Thread Dan Stromberg
On Fri, Dec 6, 2013 at 6:07 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Fri, 06 Dec 2013 15:54:22 -0800, Dan Stromberg wrote: > > > Does anyone else feel like Python is being dragged too far in the > > direction of long, complex, multi

Movie (MPAA) ratings and Python?

2013-12-09 Thread Dan Stromberg
Is anyone using a module or database that gives Python 3.x access to MPAA ratings (EG G, PG, PG-13, etc.)? I explored a few of the possibilities on Pypi, a couple of web interfaces, and the IMDB flat text file with ratings and reasons for those ratings, but I've not been really impressed yet. The

Re: ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')'

2013-12-10 Thread Dan Stromberg
On Mon, Dec 9, 2013 at 12:41 AM, Jai wrote: > > sql = """insert into `category` (url, catagory,price) VAlUES > ('%s', '%s', '%s')"""%(link1,x,y) > Is that VALUES or VAlUES or VAIUES? It probably should be VALUES. -- https://mail.python.org/mailman/listinfo/python-list

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Mon, Dec 9, 2013 at 10:40 PM, Ben Finney wrote: > Dan Stromberg writes: > > > Is anyone using a module or database that gives Python 3.x access to MPAA > > ratings (EG G, PG, PG-13, etc.)? > > What information would you want access to? Why would a library (rather >

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Mon, Dec 9, 2013 at 10:48 PM, Paul Scott wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 10/12/2013 08:40, Ben Finney wrote: > > Dan Stromberg writes: > > > >> Is anyone using a module or database that gives Python 3.x access > >

Re: Trouble with Multi-threading

2013-12-10 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 8:21 AM, wrote: > I am running PYTHON 2.7.3 and executing a PYTHON program that uses > multi-threading. I am running this on a 64-bit Windows 2008 R2 server > (Service Pack 1). > > Three months ago, I was able to execute this program just fine. I ran the > program and op

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 1:07 PM, Petite Abeille wrote: > > On Dec 10, 2013, at 6:25 AM, Dan Stromberg wrote: > > > The IMDB flat text file probably came the closest, but it appears to > have encoding issues; it's apparently nearly windows-1255, but not quite. > > It&

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 3:34 PM, Ben Finney wrote: > Michael Torrie writes: > > > I'm not sure whether there's actual confusion here on your part, or > > deliberate obtuseness. > > Not confusion, but a desire to avoid guesses based on very vague > requirements. > What part of "movie ratings (EG

Re: Movie (MPAA) ratings and Python?

2013-12-10 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 4:07 PM, Mark Lawrence wrote: > On 10/12/2013 23:50, Dan Stromberg wrote: > >> >> But I believe imdbpy is 2.7 only. >> > > I guess it wouldn't be that difficult to run it through 2to3. Try that > and see what happens? > 2to3

Re: Movie (MPAA) ratings and Python?

2013-12-11 Thread Dan Stromberg
On Wed, Dec 11, 2013 at 10:35 AM, Ned Batchelder wrote: > On 12/10/13 6:50 PM, Dan Stromberg wrote: > Now the question becomes: Why did chardet tell me it was windows-1255? :) > > It probably told you it was Windows-1252 (I'm assuming the last 5 is a > typo). > > Wind

Re: Tracking the status of python script execution

2013-12-11 Thread Dan Stromberg
Long ago, I saw a C program that took another C program as input. It would output a copy of the original C program, interspersed with fprintf's that would display the text of the line current being executed. You might write something similar for Python, perhaps outputting the line being executed

Re: [newbie] trying socket as a replacement for nc

2013-12-11 Thread Dan Stromberg
On Wed, Dec 11, 2013 at 3:08 PM, Jean Dubois wrote: > I have an ethernet-rs232 adapter which allows me to connect to a > measurement instrument by means of netcat on a linux system. > e.g. entering nc 10.128.59.63 7000 > allows me to enter e.g. > *IDN? > after which I get an identification string

Re: Movie (MPAA) ratings and Python?

2013-12-11 Thread Dan Stromberg
On Wed, Dec 11, 2013 at 3:24 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Wed, 11 Dec 2013 15:07:35 -0800, Dan Stromberg wrote: > > > $ chardet mpaa-ratings-reasons.list > > mpaa-ratings-reasons.list: windows-1255 (confidence: 0.97) >

Re: grab dict keys/values without iterating ?!

2013-12-11 Thread Dan Stromberg
On Tue, Dec 10, 2013 at 4:02 PM, Tamer Higazi wrote: > Hi people! > > Is there a way to get dict by search terms without iterating the entire > dictionary ?! > > Let us assume I have: > > {'Amanda':'Power','Amaly':'Higgens','Joseph':'White',' > Arlington','Black','Arnold','Schwarzenegger'} > > I

Re: Movie (MPAA) ratings and Python?

2013-12-11 Thread Dan Stromberg
On Wed, Dec 11, 2013 at 5:01 PM, Ned Batchelder wrote: > On 12/11/13 6:39 PM, Dan Stromberg wrote: > >> >> On Wed, Dec 11, 2013 at 3:24 PM, Steven D'Aprano >> > <mailto:steve+comp.lang.pyt...@pearwood.info>> wrote: >> >> On

Re:

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 12:06 AM, marcinmltd wrote: > Hello, > > I'm big fan of multiprocessing module, but recently I started looking at > threading in Python more closely and got couple of questions I hope You can > help me with: > > 1. When I run two or more threads in my python process are the

Re: [newbie] trying socket as a replacement for nc

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 12:28 AM, Jean Dubois wrote: > On Thursday, December 12, 2013 12:20:36 AM UTC+1, Dan Stromberg wrote: >> On Wed, Dec 11, 2013 at 3:08 PM, Jean Dubois wrote: >> >> I have an ethernet-rs232 adapter which allows me to connect to a measurement >

Re: [newbie] trying socket as a replacement for nc

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards wrote: >> Sockets reserve the right to split one socket.send() into multiple >> socket.recv()'s on the other end of the communication, or to aggregate >> multiple socket.send()'s into a single socket.recv() - pretty much any way >> the relevant IP st

Re: [newbie] trying socket as a replacement for nc

2013-12-12 Thread Dan Stromberg
On Thu, Dec 12, 2013 at 7:23 PM, Jean Dubois wrote: > Op donderdag 12 december 2013 22:23:22 UTC+1 schreef Dan Stromberg: >> On Thu, Dec 12, 2013 at 12:28 AM, Jean Dubois >> wrote: >> >> > On Thursday, December 12, 2013 12:20:36 AM UTC+1, Dan Stromberg wrote: >

Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Dan Stromberg
> s.close() >> > print 'Received:', data >> > >> > Can anyone here tell me how to do it properly? >> > thanks in advance >> > jean >> Such equipment often implements a telnet protocol. Have use try using the >> telnetlib module

Re: [newbie] trying socket as a replacement for nc

2013-12-14 Thread Dan Stromberg
On Fri, Dec 13, 2013 at 8:06 AM, Grant Edwards wrote: > On 2013-12-12, Dan Stromberg wrote: >> On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards >> wrote: >> >>>> Sockets reserve the right to split one socket.send() into multiple >>>> socket.recv()&#

Re: a Python Static Analyzer

2013-12-14 Thread Dan Stromberg
On Sat, Dec 14, 2013 at 4:35 PM, wrote: > Hi, > > I thought it would be worth contributing some awareness of Yin Wang's > PySonar2 Python static analyzer being open sourced, it's here > https://github.com/yinwang0/pysonar2. I recently converted it from being > implemented in Java to being imp

Re: [newbie] trying socket as a replacement for nc

2013-12-15 Thread Dan Stromberg
On Sun, Dec 15, 2013 at 7:35 AM, Jean Dubois wrote: >> You can "svn checkout ". You might try Sliksvn if you're on >> Windows, or if you're on Linux it's in synaptic or yum or whatever. >> You can "wget ". >> You can bring up the URL in a web browser and cut and paste. > I'm using Linux, I did t

Re: Unpacking the structures

2013-12-18 Thread Dan Stromberg
On Wed, Dec 18, 2013 at 8:32 PM, wrote: > > Hi all, >While performing the packing/unpacking of xdr structures of rpc I get an > error as following. > > > x = struct.unpack('>L', data)[0] struct.error: unpack requires a string > argument of length 4. > > Can anybody help me in this regard?

Re: Why Python is like C++

2013-12-21 Thread Dan Stromberg
On Fri, Dec 20, 2013 at 9:34 PM, Mark Lawrence wrote: > On 20/12/2013 14:19, Roy Smith wrote: >> >> http://xkcd.com/1306/ >> > > I believe that to be a very superficial like. They're unlike in that once > C++ people have compiled their code they can head down to the pub, but > Python people have

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-23 Thread Dan Stromberg
On Sat, Dec 14, 2013 at 4:25 AM, Chris Angelico wrote: > On Sat, Dec 14, 2013 at 11:12 PM, Jai wrote: >> GUI:-want to learn GUI programming in python , how should i proceed. >> >> There are lots of book here so I am confuse which book i should refer so >> that i don't waste time . please answ

Re: need to print seconds from the epoch including the millisecond

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 10:32 AM, wrote: > i am using 2.7. I need to print the time in seconds from the epoch with > millisecond precision. i have tried many things but have failed. heres my > latest: > > from time import time, strftime > from datetime import datetime, time

Re: How to learn Python effectively

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 6:54 PM, 汪伟斌 wrote: > I am a beginner in Python, and I find that there are various books about > Python. > There are almost the same contents between some, So I want a recommendation > of a > good order of the books, which can make me learn Python more effectively. > Thanks

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 9:04 PM, Travis McGee wrote: > What's the deal? If I want to make a distributable software package, should > it be 2 or 3? Enquiring minds want to know. 3.x alone isn't a bad option, but it doesn't really have to be an either-or decision. That is, even pretty substantial

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Dan Stromberg
On Thu, Dec 26, 2013 at 9:43 PM, Rustom Mody wrote: > On Fri, Dec 27, 2013 at 10:50 AM, Andrew Berg wrote: > As for 2 maybe we need a wiki page. (Or do we have one already?) > Heres my largely ignoramus attempt at starting that: > > 1. print: Use print with (). Dont use funny 2 syntax. In fact,

Python 2.x and 3.x usage survey

2013-12-30 Thread Dan Stromberg
I keep hearing naysayers, nay saying about Python 3.x. Here's a 9 question, multiple choice survey I put together about Python 2.x use vs Python 3.x use. I'd be very pleased if you could take 5 or 10 minutes to fill it out. Here's the URL: https://www.surveymonkey.com/s/N5N5PG2 -- https://mail.

Python 2.x vs 3.x survey

2014-01-03 Thread Dan Stromberg
The results of the survey are at: https://wiki.python.org/moin/2.x-vs-3.x-survey -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a list with holes

2014-01-03 Thread Dan Stromberg
On Fri, Jan 3, 2014 at 7:37 AM, Chris Angelico wrote: > Depending on what exactly you need, it's probably worth just using a > dict. In what ways do you need it to function as a list? You can > always iterate over sorted(some_dict.keys()) if you need to run > through them in order. FWIW, sorting

Re: Creating a list with holes

2014-01-03 Thread Dan Stromberg
On Fri, Jan 3, 2014 at 7:00 PM, Chris Angelico wrote: > On Sat, Jan 4, 2014 at 1:58 PM, Dan Stromberg wrote: >> On Fri, Jan 3, 2014 at 7:37 AM, Chris Angelico wrote: >>> Depending on what exactly you need, it's probably worth just using a >>> dict. In what ways

Re: Postfix conditionals

2014-01-05 Thread Dan Stromberg
On Sun, Jan 5, 2014 at 12:41 PM, Roy Smith wrote: > In article , > Göktu€ Kayaalp wrote: > >>py> for i in [False]: >>... break if not i > > Python is not Perl. Personally, I find the suggested syntax jarring. I'd prefer that it not go into Python. -- https://mail.python.org/mailma

Re: "More About Unicode in Python 2 and 3"

2014-01-05 Thread Dan Stromberg
On Sun, Jan 5, 2014 at 2:32 PM, Serhiy Storchaka wrote: > I wonder why nobody complains about the absent of implicit conversion > between int and str. In PHP you can write 2 + "3" and got 5, but in Python > this is an error. So sad! I like Python strongly typed, thank you very much. Please don'

Re: "More About Unicode in Python 2 and 3"

2014-01-05 Thread Dan Stromberg
On Sun, Jan 5, 2014 at 4:46 PM, Ethan Furman wrote: > While I don't agree with his assessment of Python 3 in total, I definitely > feel his pain with regards to bytestrings in Py3 -- because they don't > exist. 'bytes' /looks/ like a bytestring, but really it's just a bunch of > integers: > > -->

Re: Learning python networking

2014-01-08 Thread Dan Stromberg
Nice response Chris. Seriously. On Wed, Jan 8, 2014 at 3:29 PM, Chris Angelico wrote: > One extremely critical point about your protocol. TCP is a stream - > you don't have message boundaries. You can't depend on one send() > becoming one recv() at the other end. It might happen to work when you

Re: Learning python networking

2014-01-08 Thread Dan Stromberg
On Wed, Jan 8, 2014 at 4:07 PM, Chris Angelico wrote: > Maybe it's not the best way to do things, but it can be extremely > simple in the code. For small projects, the added complexity doesn't bite you. At least, not much. For large projects, with thousands or millions of callbacks, it can be v

setup.py issue - some files are included as intended, but one is not

2014-01-11 Thread Dan Stromberg
Hi folks. I have a setup.py problem that's driving me nuts. I have a treap.py file that tries to "import * from pyx_treap.so", and failing that, it'll "import * from py_treap.py" (sans extensions of course). Naturally, all 3 of these should be included - although in the case of pyx_treap.so, it

Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined?

2014-01-11 Thread Dan Stromberg
On Sat, Jan 11, 2014 at 12:07 AM, pintreo mardi wrote: > Hi, I've just begun to learn programming, I have an open question for the > group: > Is the Python language an all in one computer language which could replace C, > C++, Java etc.. I only ask becuase I am starting off with python and I wan

Re: setup.py issue - some files are included as intended, but one is not

2014-01-14 Thread Dan Stromberg
On Sat, Jan 11, 2014 at 2:04 PM, Dan Stromberg wrote: > Hi folks. > > I have a setup.py problem that's driving me nuts. Anyone? I've received 0 responses. > I have a treap.py file that tries to "import * from pyx_treap.so", and > failing that, it'll &quo

Re: How to write this as a list comprehension?

2014-01-17 Thread Dan Stromberg
On Fri, Jan 17, 2014 at 3:19 PM, Piet van Oostrum wrote: > Hi, > > I am looking for an elegant way to write the following code as a list > comprehension: > > labels = [] > for then, name in mylist: > _, mn, dy, _, _, _, wd, _, _ = localtime(then) > labels.append(somefunc(mn, day, wd, name)

Re: setup.py issue - some files are included as intended, but one is not

2014-01-17 Thread Dan Stromberg
On Wed, Jan 15, 2014 at 7:18 AM, Piet van Oostrum wrote: > Dan Stromberg writes: > >> On Sat, Jan 11, 2014 at 2:04 PM, Dan Stromberg wrote: >>> Hi folks. >>> >>> I have a setup.py problem that's driving me nuts. >> >> Anyone? I

Re: Can post a code but afraid of plagiarism

2014-01-19 Thread Dan Stromberg
On Sat, Jan 18, 2014 at 10:31 PM, Steven D'Aprano wrote: > On Sat, 18 Jan 2014 14:32:21 -0800, indar kumar wrote: > >> @Roy Smith >> >> Can you help me privately because its an assignment and have to submit >> plagiarism free > > Then don't plagiarise. > > > Plagiarism means YOU copy other people.

Re: 1st Sketch at at ReadOnly dict

2014-01-20 Thread Dan Stromberg
On Mon, Jan 20, 2014 at 12:09 PM, Charles Hixson wrote: > class RODict: > #Instance Variable Doc > ##@var_ddict > #This variable holds the reference to the dict. > > ##Class initializer. > #@paramddictThe data dictionary to which this is a read

Python 1.0 - release date?

2014-01-21 Thread Dan Stromberg
Does anyone know when Python 1.0 was released? I want to say August of 1993, but there are apparently those who disagree. Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about `list.insert`

2014-02-06 Thread Dan Stromberg
On Thu, Feb 6, 2014 at 3:59 PM, cool-RR wrote: > Hi, > > I'm curious. If I append an item to a list from the left using `list.insert`, > will Python always move the entire list one item to the right (which can be > super-slow) or will it check first to see whether it can just allocate more > me

Weird python 2.7 import thing

2016-02-18 Thread Dan Stromberg
OK, I'd rather be on 3.x, but that's not going to happen today. So 2.7. I have added directories to my sys.path hundreds of times before importing from them, and know what to expect from that. I confess, I don't have a lot of package or egg experience. However, I have a somewhat special (appare

Re: Weird python 2.7 import thing

2016-02-19 Thread Dan Stromberg
On Thu, Feb 18, 2016 at 5:40 PM, Dan Stromberg wrote: > > BTW, this is not a package I pip installed from pypi - it's an > internal-only project. I need to correct this: It's not installed from pypi.python.org, but it probably is installed from our internal pypi server.

Re: Weird python 2.7 import thing

2016-02-19 Thread Dan Stromberg
On Fri, Feb 19, 2016 at 10:33 AM, Dan Stromberg wrote: > On Thu, Feb 18, 2016 at 5:40 PM, Dan Stromberg wrote: > >> >> BTW, this is not a package I pip installed from pypi - it's an >> internal-only project. > > I need to correct this: It's not installed

nosepipe error

2016-02-23 Thread Dan Stromberg
Hi folks. I'm using (or trying to use) nosepipe to get nose test isolation; I'm working on an almost-big test suite, and the tests appear to be lacking test isolation. I'm encountering a bug in nosepipe: == ERROR: testCreateFileM

Re: nosepipe error

2016-02-23 Thread Dan Stromberg
On Tue, Feb 23, 2016 at 9:43 AM, Chris Angelico wrote: > On Wed, Feb 24, 2016 at 4:36 AM, Dan Stromberg wrote: >> Message: Unhandled exception in thread started by >> sys.excepthook is missing >> lost sys.stderr >> >> That 1433299041 looks like ASCII: >

"from module import data; print(data)" vs "import module; print(module.data)"

2016-02-24 Thread Dan Stromberg
Could people please compare and contrast the two ways of doing imports in the Subject line? I've long favored the latter, but I'm working in a code base that prefers the former. Is it fair to say that the former increases the surface area of your shared (sometimes mutable) state? It's clear that

Re: "from module import data; print(data)" vs "import module; print(module.data)"

2016-02-25 Thread Dan Stromberg
On Wed, Feb 24, 2016 at 7:39 PM, Steven D'Aprano wrote: > On Thursday 25 February 2016 12:07, Dan Stromberg wrote: > >> Could people please compare and contrast the two ways of doing imports >> in the Subject line? > > from module import data; print(data) > &g

Re: "from module import data; print(data)" vs "import module; print(module.data)"

2016-02-25 Thread Dan Stromberg
On Thu, Feb 25, 2016 at 8:15 AM, Dan Stromberg wrote: > On Wed, Feb 24, 2016 at 7:39 PM, Steven D'Aprano > wrote: >> On Thursday 25 February 2016 12:07, Dan Stromberg wrote: >> >>> Could people please compare and contrast the two ways of doing imports >>&g

Re: Testing whether the VPN is running?

2016-02-25 Thread Dan Stromberg
On Thu, Feb 18, 2016 at 1:45 AM, Ervin Hegedüs wrote: > Hi Adam, > > On Thu, Feb 18, 2016 at 09:26:58AM +, Adam Funk wrote: >> I'd like to test (inside a python 3 program) whether the VPN is >> running or not. The only thing I can think of so far is to use >> subprocess to run the 'ifconfig'

Re: (test) ? a:b

2014-10-22 Thread Dan Stromberg
On Wed, Oct 22, 2014 at 2:05 AM, wrote: > Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast escreveu: >> Hello >> >> >> >> Is there in Python something like: >> >> >> >> j = (j >= 10) ? 3 : j+1; >> >> >> >> as in C language ? >> >> >> >> thx > > without not: > j = [j+1, 3][j>=10] > w

Re: When to use assert

2014-10-22 Thread Dan Stromberg
On Wed, Oct 22, 2014 at 9:01 AM, Chris Angelico wrote: > On Thu, Oct 23, 2014 at 2:49 AM, Steven D'Aprano > wrote: >> Chris Angelico wrote: > I agree that the assert is preferable to the comment. But maybe my > level of paranoia is just lower than most people's, as I wouldn't > bother checking th

Re: (test) ? a:b

2014-10-24 Thread Dan Stromberg
On Fri, Oct 24, 2014 at 1:38 AM, Steven D'Aprano wrote: > I don't get why that's considered hard to read. > So why is it hard to read when the index is a flag? > > value = [f, g][cond]() It's clear to you, it's clear to me, but is it clear to everyone? I very much doubt it. Also, you've gone t

Re: (test) ? a:b

2014-10-25 Thread Dan Stromberg
On Sat, Oct 25, 2014 at 1:45 PM, Ben Finney wrote: > Steven D'Aprano writes: >> title = ('Mr', 'Ms')[person.sex == 'F'] >> >> which should be clear to anyone who understands indexing in Python and >> that True == 1 and False == 0. > > I consider it an accident of history, and one which should not

id == vs is

2014-10-26 Thread Dan Stromberg
Are the following two expressions the same? x is y Id(x) == id(y) ? I ported some Java code to Python, and it was using Java's idea of equality (via ==) in some places. Right now, I have a suite of unit tests working using the second expression above, but I'm thinking about switching to the fi

Re: checking whether a string is text or binary

2014-10-28 Thread Dan Stromberg
On Tue, Oct 28, 2014 at 3:21 PM, Rick Dooling wrote: > I tried to convert the code using 2to3 and it broke. > > The error I get when using Python 3 is on this line: > > _null_trans = string.maketrans("", "") > > and the error reads > > AttributeError: 'module' object has no attribute 'maketrans' >

Re: [OFF-TOPIC] It is true that is impossible write in binary code, the lowest level of programming that you can write is in hex code?

2014-11-05 Thread Dan Stromberg
On Tue, Nov 4, 2014 at 10:39 PM, Cameron Simpson wrote: > Bah! He asked if there were lower levels than binary. Ergo: chip design! > (And microcode, the intermediate layer. Or one of the layers, depending > where you draw the line.) Should we stop before we reach the quantum foam of > spacetime?

Re: I love assert

2014-11-11 Thread Dan Stromberg
On Tue, Nov 11, 2014 at 11:40 AM, Peter Cacioppi wrote: > I get the impression that most Pythonistas aren't as habituated with assert > statements as I am. Is that just a misimpression on my part? If not, is there > a good reason to assert less with Python than other languages? > > As far as I c

Re: Efficient Threading

2014-11-15 Thread Dan Stromberg
On Fri, Nov 14, 2014 at 10:42 AM, Empty Account wrote: > Hi, > > I am thinking about writing a load test tool in Python, so I am interested > in how I can create the most concurrent threads/processes with the fewest OS > resources. I would imagine that I/O would need to be non-blocking. > > There

Re: fileno() not supported in Python 3.1

2014-11-15 Thread Dan Stromberg
On Thu, Nov 13, 2014 at 3:48 PM, wrote: > import sys > for stream in (sys.stdin, sys.stdout, sys.stderr): >print(stream.fileno()) > > > io.UnsupportedOperation: fileno > > Is there a workaround? > -- > https://mail.python.org/mailman/listinfo/python-list Works for me, although it's a

Re: import os

2014-11-16 Thread Dan Stromberg
On Sun, Nov 16, 2014 at 5:10 PM, Abdul Abdul wrote: > Thanks for your reply. Yes, I came across this page, but didn't understand > what is meant by the operating system dependent functionality. What does > that mean? Is importing that module that serious? The os module has mostly lower level OS i

Re: Using map()

2014-11-16 Thread Dan Stromberg
On Sun, Nov 16, 2014 at 4:09 PM, Steven D'Aprano wrote: > Pavel Volkov wrote: > >> I checked my modules with pylint and saw the following warning: >> >> W: 25,29: Used builtin function 'map' (bad-builtin) >> >> Why is the use of map() discouraged? >> It' such a useful thing. > > That's a bug in py

Re: Different behaviour in list comps and generator expressions

2014-11-17 Thread Dan Stromberg
On Mon, Nov 17, 2014 at 3:30 PM, Steven D'Aprano wrote: >> The following list comprehension and generator expression are almost, but >> not quite, the same: >> >> [expr for x in iterable] >> >> list(expr for x in iterable) >> >> >> The difference is in the handling of StopIteration raised inside t

Re: Recurring Task

2014-11-23 Thread Dan Stromberg
On Sun, Nov 23, 2014 at 7:23 AM, wrote: > Hi All > Looking for some advice. I'm creating a small netwok poller and wondered what > people recommend to use? Will be polling up to 100 hosts every ten reconds or > so > > Options I can see > > Home grown using worker threads with Queue and dispatch

Re: Recurring Task

2014-11-23 Thread Dan Stromberg
On Sun, Nov 23, 2014 at 10:35 AM, Dennis Lee Bieber wrote: > On Sun, 23 Nov 2014 07:23:43 -0800 (PST), t...@timothyarnold.co.uk declaimed > the following: > >>Hi All >>Looking for some advice. I'm creating a small netwok poller and wondered what >>people recommend to use? Will be polling up to 10

Re: "**" in python

2014-11-23 Thread Dan Stromberg
On Sun, Nov 23, 2014 at 5:00 PM, Cameron Simpson wrote: > On 23Nov2014 18:43, Tim Chase wrote: >> >> On 2014-11-24 01:33, Abdul Abdul wrote: >>> >>> Wxy**2 >>> >>> What do ** mean here? >> >> >> "to the power of", so your code squares the value of "Wxy", or "Wxy * >> Wxy" >> >> https://docs.pytho

Re: Comprehension with two variables - explanation needed

2014-11-24 Thread Dan Stromberg
On Sun, Nov 23, 2014 at 8:42 PM, Steven D'Aprano wrote: > On Sun, 23 Nov 2014 08:45:39 -0800, Rustom Mody wrote: >> First a one-line solution in haskell >> >> sieve (p:xs) =p:sieve [x | x <- xs, x `mod` p /= 0] > > Don't use that! That is a horribly inefficient way to generate primes. > > Ma

Python 2.x vs 3.x survey - new owner?

2014-12-02 Thread Dan Stromberg
Last year in late December, I did a brief, 9 question survey of 2.x vs 3.x usage. I like the think the results were interesting, but I don't have the spare cash to do it again this year. I probably shouldn't have done it last year. ^_^ Is anyone interested in taking over the survey? It's on Su

Re: Python, C++ interaction

2014-12-03 Thread Dan Stromberg
On Wed, Dec 3, 2014 at 12:29 AM, Michael Kreim wrote: > Hi, > I did some googleing on extending Python by C++ code but I did not find > something that satisfies me. I gave SWIG a try, but several webpages > disadvised me of using it. Also my small experiments did not work. Now, I > read about cty

Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition

2014-12-11 Thread Dan Stromberg
On Thu, Dec 11, 2014 at 11:35 AM, Mark Roberts wrote: > I disagree. I know there's a huge focus on The Big Libraries (and wholesale > migration is all but impossible without them), but the long tail of > libraries is still incredibly important. It's like saying that migrating the > top 10 Perl lib

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