Splitting a line while keeping quoted items together

2012-11-19 Thread josh
;]: append = True appended = [item[1:]] quote = item[0] else: res.append(item) return res .. This seem really ugly. Is there a cleaner way to do this? Is there a keyword I could search by to find something nicer? Thanks, Josh -- http://mail.python.org/mailman/listinfo/python-list

python university search

2005-12-04 Thread josh
or selling for something reasonable. thanks, --josh -- http://mail.python.org/mailman/listinfo/python-list

File Handling Problems Python I/O

2005-01-06 Thread Josh
ut stating the file doesn't exist. I know the code is correct because it worked for the other file. I have tried both binary and ascii modes to no avail. Any idea why this is happening? I am running Python 2.3.4 wxPython 2.5.3.1 and SPE as the IDE on Win2k. Thanks Josh -- http://mail.pyt

Re: File Handling Problems Python I/O

2005-01-06 Thread Josh
He is the function where I am making the call. If I change the open statment to another file, say "c:\test.txt", a file I know exists, it will error out stating the file does not exist. Thanks Josh def GetStartVars(self): try: DOWNFILE = open("c:\fixes.txt","r") ex

Re: File Handling Problems Python I/O

2005-01-06 Thread Josh
Peter, Thank you for the rookie correction. That was my exact problem. I changed the address to use forward slashes and it works perfect. I did not know that a backslash had special meaning within a string, but now I do! Thanks again Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: File Handling Problems Python I/O

2005-01-06 Thread Josh
Micheal, Thanks for the advice as the programming I am doing will be run on both Windows and Linux based PC's, that being the main reason for my venture into Python. I'm glad to see that people are willing to help out even the newbie's. Josh -- http://mail.python.org/mailman/

why not datetime.strptime() ?

2005-01-07 Thread josh
Shouldn't datetime have strptime? It already has strftime, and it'd be really nice to obviate datetime.fromtimestamp(time.mktime(time.strptime(...))) thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: why not datetime.strptime() ?

2005-01-11 Thread josh
David M. Cookie writes: > You don't check for errors: an exception being thrown by > PyObject_CallMethod will return obj == NULL. Oops, missed that one. Thanks. > If there's a module in sys.path called time that overrides the stdlib > time, things will fail, and you should be able to catch that.

Re: why not datetime.strptime() ?

2005-01-11 Thread josh
On Tue, Jan 11, 2005 at 08:56:33AM -0600, Skip Montanaro wrote: > * The seventh item returned from time.strptime() is the day of the week. > You're passing it into the microsecond arg of the datetime constructor Thanks! > and ignoring the timezone info (ninth item returned from >

Re: why not datetime.strptime() ?

2005-01-13 Thread josh
On Thu, Jan 13, 2005 at 08:06:56AM -0600, Skip Montanaro wrote: > > Skip> I just checked in your changes. Thanks for the effort. > > Jeez Skip... That reads poorly. How about "Thanks for your contribution"? > In any case, thanks. My pleasure. Thanks for helping me to help. And I liked the

why no time() + timedelta() ?

2005-01-20 Thread josh
Why can't timedelta arithmetic be done on time objects? (e.g. datetime.time(5)-datetime.timedelta(microseconds=3) Nonzero "days" of the timedelta could either be ignored, or trigger an exception. -- http://mail.python.org/mailman/listinfo/python-list

Handling MySQL connection

2005-01-31 Thread Josh
nnection.close() All of these Def's would fall under the same Frame class. Am I going about this incorrectly? Thanks for your help and patience. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Handling MySQL connection

2005-02-01 Thread Josh
Thanks for the help! I was able to work through it based on you example. It was lack of knowledge of the object class that was throwing me off. Josh -- http://mail.python.org/mailman/listinfo/python-list

readline: edit-and-execute-command

2005-07-04 Thread josh
anybody know why "edit-and-execute-command" doesn't work in python's readline? it doesn't even show up in a dump of readline functions: $ cat fc_test

time + timedelta

2005-02-07 Thread josh
datetime.time should support timedelta arithmetic, patch attached. Times greater than 24 hours should not raise an exception, but always wrap around. Any other behavior is too surprising. (People expect to be able to call you up at 11pm, and say "meet me in two hours" (if you're a night person)).

Re: time + timedelta

2005-02-07 Thread josh
sorry, patch really attached to this message. On Mon, Feb 07, 2005 at 11:24:20AM -0500, josh wrote: > datetime.time should support timedelta arithmetic, patch attached. > > Times greater than 24 hours should not raise an exception, but always > wrap around. Any other behavior is to

Reportlab and Barcodes

2005-02-08 Thread Josh
this method. I'm guessing that it needs to be placed on the form as some type of graphic. It's obviously not going to work with the drawText method. Any ideas? Thanks Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Reportlab and Barcodes

2005-02-09 Thread Josh
Benji, I have used those very same fonts before and they work great, but I'm trying to get away with using straight Python to accomplish this, especially since the program will most likely be used on both Linux and Windows. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Reportlab and Barcodes

2005-02-09 Thread Josh
One of the users on the Reportlabs mailing list was kinda enough to offer me the solution.. A simple call to the drawOn function, e.g.: bc = code39.Standard39("123",xdim = .015*inch) x = 6*inch y = -5*inch bc.drawOn(canvas,x,y) -- http://mail.python.org/mailman/listinfo/python-list

Re: Reportlab and Barcodes

2005-02-10 Thread Josh
Damjan, Code39 here refers to part of the Barcode Extensions available to Reportlabs. It can be imported as such from reportlab.extensions.barcode import code39 Josh -- http://mail.python.org/mailman/listinfo/python-list

Win32api shellexecute Bshow

2005-02-16 Thread Josh
.: win32api.ShellExecute (0, "print", "test.pdf", None, ".", 0) When this statment is executed, Adobe Acrobat is launched and made visible to the user, however the actual PDF is hidden. I do not wish for Acrobat to be seen either. Any thoughts? Thanks Josh -- http://ma

Re: Win32api shellexecute Bshow

2005-02-16 Thread Josh
Thanks, I'll take a look at using GhostScript and GSPrint instead. Josh -- http://mail.python.org/mailman/listinfo/python-list

Sockets SO_RCVBUF

2005-04-29 Thread Josh
I have written a simple TCP client/server. I would like to change the TCP receive buffer on the server side, to see performance differences. I am trying err = sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 4096) but that doesn't seem to actual change the buffer size. The code is:

sqlite3 views, if not exists clause

2006-11-14 Thread Josh
onnect(':memory:') conn.execute("create table foo (a int,b int)") conn.execute('create view if not exists bar as select * from foo') it fails with exception "sqlite3.OperationalError: near "not": syntax error" Can anyone confirm, or pass this on to the appropriate person? Thanks! Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite3 views, if not exists clause

2006-11-15 Thread Josh
"Tim Golden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Not a bug with the "sqlite3 api that comes with python 2.5." as such, | since .execute pretty much passes its parameters through to the database | engine. Rather, the syntax you're using is a relatively late addition | to

notify on directory changes

2006-11-17 Thread Josh
ed to know if there exists a portable c or c++ solution, too. thanks! Josh -- http://mail.python.org/mailman/listinfo/python-list

VB to Python migration

2006-01-27 Thread Josh
) and something like MySQL or PostgreSQL. But in the mean time, we need to be able to access an MSAccess (Jet) database from Python. Any answers/suggestions/pointers are greatly appreciated. Thanks, Josh Isted -- http://mail.python.org/mailman/listinfo/python-list

Re: VB to Python migration

2006-01-30 Thread Josh
Nicolas Kassis wrote: > Josh wrote: > > >>We have a program written in VB6 (over 100,000 lines of code and >>230 UI screens) that we want to get out of VB and into a better >>language. The program is over 10 years old and has already been >>ported from VB3 to VB6

Re: VB to Python migration

2006-01-30 Thread Josh
a rather fun project to be on. It's such a gigantic program though, it gets difficult to comprehend how long it's going to take to make this transision. Whether it's to Python, or some other direction. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: VB to Python migration

2006-01-30 Thread Josh
ctionality is something we also want to be very accomodating of. We are planning on rewriting in such a way that the functionality of the screens (input processing, error trapping etc.) is done is an extensibly manner. That would mean using the same code for both hardcoded windows as well as web forms. Thanks, Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: VB to Python migration

2006-01-30 Thread Josh
Thomas Ganss wrote: > You haven't specified where your main pains are. > Do you have at least rudimentary architecture ? > How often do you have code reviews / refactored your code ? > Have you been striving for good code ? Is it a total mess ? Umm... We have been striving for good code, but being

Re: VB to Python migration

2006-01-30 Thread Josh
use an ORM such as SQLObject on top of that is another > issue... mxODBC looks interesting. I'll need to research it some more. Thanks, Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: VB to Python migration

2006-01-30 Thread Josh
Magnus Lycka wrote: >> Rewrites are always good and result in smaller code base if features >> are not added. However, I doubt that will make the screens fewer. Lines >> of code? Certainly. > > > That depends on whether you just refactor the implementation > of if you look at the problem domain w

Re: VB to Python migration

2006-01-30 Thread Josh
Python. Their first lines of Python will just be VB in Python, but, once the power of Python becomes apparent, there'll be no going back. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: VB to Python migration

2006-01-31 Thread Josh
at allows easily porting it to a web app etc. As for the testing, that's something we'll need to learn about. I've read some articles about test driven programming in relation to extreme programming. Can you give me links to any good sites explaining how this all works? (Off list may be better for these off-topic links) Thanks, Josh -- http://mail.python.org/mailman/listinfo/python-list

pythonesque constructs for c++

2007-09-12 Thread Josh
I go about doing that, I was just wondering if anyone knows if they already exist? thanks, Josh -- http://mail.python.org/mailman/listinfo/python-list

how to abort on syntax errors

2007-03-26 Thread Josh
a syntax error. But, instead, it merrily proceeds on its way. Is there some idiom that you use in situations like these? thanks, josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird behavior in search in a list

2007-03-29 Thread Josh
"Su Y" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On 3ÔÂ29ÈÕ, ÏÂÎç7ʱ51·Ö, "Su Y" <[EMAIL PROTECTED]> wrote: > hi all, > I can't understand how this code work, its behavior is really weird > for me... > > I want find the first number in extend[] which is larger than num, soI > w

help with a problem from school??

2008-01-09 Thread Josh
14mA, what would you use to simulate this load? Please show your calculations used to support your answer. I appreciate anyone's help. Josh Smith [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Quick Newbie Question

2008-11-28 Thread Josh
Can Python be used on one Linux machine to drive another Linux machine through SSH? I am currently running Putty on my XP box to run tests on a Linux box. I need to automate these tests and thought it would be fun to do so from a Linux VMWare Image I recently setup. Does this sound do-able wit

Emacs vs. Eclipse vs. Vim

2008-11-29 Thread Josh
If you were a beginning programmer and willing to make an investment in steep learning curve for best returns down the road, which would you pick? I know this topic has been smashed around a bit already, but 'learning curve' always seems to be an arguement. If you feel that one is easier or ha

Re: Quick Newbie Question

2008-11-29 Thread Josh
alex23 wrote: On Nov 29, 5:09 pm, Josh <[EMAIL PROTECTED]> wrote: Can Python be used on one Linux machine to drive another Linux machine through SSH? I am currently running Putty on my XP box to run tests on a Linux box. I need to automate these tests and thought it would be fun to do s

Different times between Python and System

2008-04-14 Thread Josh
Hi, Anyone know why python would not show the same time that my system shows? [EMAIL PROTECTED]:~$ date Mon Apr 14 01:27:36 MDT 2008 [EMAIL PROTECTED]:~$ python Python 2.4.5 (#2, Mar 12 2008, 00:15:51) [GCC 4.2.3 (Debian 4.2.3-2)] on linux2 Type "help", "copyright", "credits" or "license" for mor

Re: Different times between Python and System

2008-04-14 Thread Josh
Hmm... That didn't work out so well that time. I feel like an idiot. Previously there has been an hour difference between the system time and the time that python reports. On Apr 14, 1:29 am, Josh <[EMAIL PROTECTED]> wrote: > Hi, > > Anyone know why python would not show t

Getting lazy with decorators

2012-06-23 Thread Josh English
I'm creating a cmd.Cmd class, and I have developed a helper method to easily handle help_xxx methods. I'm trying to figure out if there is an even lazier way I could do this with decorators. Here is the code: * import cmd def add_help(func): if not hasattr(func, 'im_cl

Re: Getting lazy with decorators

2012-06-25 Thread Josh English
On Sunday, June 24, 2012 1:07:45 AM UTC-7, Peter Otten wrote: > > You cannot access a class instance because even the class itself doesn't > exist yet. You could get hold of the class namespace with sys._getframe(), > > def add_help(f): > exec """\ > def help_%s(self): > f = getattr(self

Re: Getting lazy with decorators

2012-06-27 Thread Josh English
e in your __getattr__ override. Boy is my face red. On further experimentation, adding a do_xxx command without the decorator still works...ish. The undecorated do_xxx is still considered to have a help function, and it prints the raw docstring (instead of using the show_help method to clea

format() not behaving as expected

2012-06-29 Thread Josh English
I have a list of tuples, and usually print them using: print c, " ".join(map(str, list_of_tuples)) This is beginning to feel clunky (but gives me essentially what I want), and I thought there was a better, more concise, way to achieve this, so I explored the new string format and format() funct

Re: format() not behaving as expected

2012-06-29 Thread Josh English
quot;.format(c) > foo > >>> format(c, "s") > 'foo' Thank you. That's beginning to make sense to me. If I understand this, everything between the braces is the format specification, and the format specification doesn't include the braces, right? Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: format() not behaving as expected

2012-06-29 Thread Josh English
Personally, I find the documentation about format to be less than > helpful.) > Thanks. I think it's coming together. Either way, this format seems uglier than what I had before, and it's longer to type out. I suppose that's just programmers preference. Josh -- http://mail.python.org/mailman/listinfo/python-list

Help with Singleton SafeConfigParser

2012-12-08 Thread Josh English
('local.txt','w') as f: self.write(f) __options = Options() def set(section, name, value): return self.__options.set(section, name, value) def options(section): return self.__options.options # And so on This seems incredibly wasteful, and to introspect my options I get a module, not a SafeConfigParser object, so I'm wondering if there is a different way to handle this? Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with Singleton SafeConfigParser

2012-12-08 Thread Josh English
e, and when I saw the tirades against Singletons they mentioned "use modules" but, well, I haven't had my morning coffee yet. I shouldn't even be trying this sort of thing until then. Thank you for the simple answer. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: why not?

2013-01-21 Thread Josh Benner
On Mon, Jan 21, 2013 at 7:56 AM, Lie Ryan wrote: > On 22/01/13 04:02, kwakukwat...@gmail.com wrote: > >> f = open(r'c:\text\somefile.txt') >> for i in range(3): >> print str(i) + ': ' + f.readline(), >> please with the print str(i) + ‘: ‘ + f.readline(), why not print str(i) >> + f.readli

Udacity CS 101

2012-02-25 Thread Josh English
Has anyone here looked at Udacity's open CS101 course (http://www.udacity.com/overview/Course/cs101) that started this week? The goal of the seven week course is to build a web crawler. So far, I'm not impressed with the speed or content of the course. I was wondering what anyone here may think

Re: Udacity CS 101

2012-03-02 Thread Josh English
On Monday, February 27, 2012 6:37:25 PM UTC-8, Ray Clark wrote: > > You have to remember that this course assumes no prior computer > programming knowledge. > > I agree, it is starting out very basic. Give it some more time. > These guys have PhDs from MIT and/or have taught at Stanford. They >

Re: xlrd 0.7.4 released!

2012-04-03 Thread Josh English
pdated. If I try to update again, it says it's already there. When I try to import xlrd, I get an error IOError: [Errno 2] No such file or directory: 'C:\\Users\\josh\\Desktop\\Portable Python\\App\\lib\\site-packages\\xlrd-0.7.5-py2.7.egg\\xlrd\\version.txt' I also noticed that in my

PyTextile Question

2012-05-03 Thread Josh English
y its own P-tag. Hopefully (again), I won't have a bunch of unwanted BR tags thrown in. I've tried several ways of pre-processing the text in the node, but pytextile still gives me line breaks. Any suggestions? Is there a good tutorial for PyTextile that I have

Re: PyTextile Question

2012-05-14 Thread Josh English
is works. I'm trying to figure what that regular expression does, but I swear it's copying the lines twice. (Clearly, I don't speak re.) Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: %d not working in re at Python 2.7?

2012-05-14 Thread Josh McGee
% On Friday, May 11, 2012 11:58:01 AM UTC-7, vacu wrote: > I am frustrated to see %d not working in my Python 2.7 re.search, like > this example: > > >>> (re.search('%d', "asdfdsf78asdfdf")).group(0) > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'NoneType' object

understanding operator overloading

2012-06-01 Thread Josh Benner
n(self.data) -> self.data = [1, 2, 4] __getitem__(index) -> index = slice(-1, 9223372036854775807, None) [4] printing blist[-2] __getitem__(index) -> index = -2 2 Best, Josh Benner -- http://mail.python.org/mailman/listinfo/python-list

Re: text file

2011-06-30 Thread Josh Benner
import os lst = [] for x in xrange(1, 5001): lst.append(r"Data\ma{0}.wav Data\ma{0}.mfc".format(x)) lst.insert(x-1, r"Data\ja{0}.wav Data\ja{0}.mfc".format(x)) with open("filename.txt", "w") as fd: sep = os.linesep fd.write(sep.join(lst)) On Thu, Jun 30, 2011 at 5:19 PM, Sibonis

Looking for general advice on complex program

2011-07-15 Thread Josh English
nk, to have a way to check if the GUI is editing a node before the XManager reads the file, so the thread needs to be interrupted, or paused, because I don't know if threads would stop if a wxDialog is being show modally or not. So, am I on the right track here? josh -- http://mail.py

Re: Looking for general advice on complex program

2011-07-16 Thread Josh English
Cameron, You use a directory as lock mechanism. I think I get how that works. When you're done manipulating the file, do you just remove the director? Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for general advice on complex program

2011-07-16 Thread Josh English
nd leaves the memory filled. If it does, I don't know if the OS will overwrite that memory. I'm afraid of taking up lots of space that I don't need with this program. The docs indicate that Unix recovers the memory, but I'm not sure about Windows. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for general advice on complex program

2011-07-16 Thread Josh English
uters on the network, and I don't know if I can make a socket work. I do know they put an internal wiki in the system, and if I could figure out how to do these requests over HTTP, I may try that, but that seems to be the wrong solution. (Yes, I am a programming neophyte way over my he

Re: Looking for general advice on complex program

2011-07-17 Thread Josh English
guy who almost has to re-invent the wheel. When I started XML processing, it was on an old computer and I couldn't get things like lxml to work, or understand the ones I did manage to install. To fully understand XML processing and validating, I had to write my own XML validation utility. J

Re: Looking for general advice on complex program

2011-07-18 Thread Josh English
That would be one of mine, probably. http://code.google.com/p/pyxmlcheck/ It's an old version. I haven't updated it in a while. And while my program worked fine at home, my test environment gave me some grief. Apparently the lock files are being deleted properly. I have a few ideas about that,

removing nested iffs

2011-07-29 Thread Josh Benner
I'm writing a function to create a string that gets longer iff an argument is defined. In there a more elegant way than nesting all those ifs? def format_rsync_src_string(args, server="RSYNC"): """ Format an rsync source directory string. """ if args.server is None: raise CopyNigh

Re: removing nested iffs

2011-07-29 Thread Josh Benner
On Fri, Jul 29, 2011 at 1:07 PM, Wolfgang Rohdewald wrote: > On Freitag 29 Juli 2011, Josh Benner wrote: > > if args.build not None: > > which python version understands this? > > -- > Wolfgang > Apparently the version running in my head understands it ;-) Sorr

import hooks (PEP 302) broken in Python >=2.5?

2011-08-07 Thread Josh Haberman
iding when writing new code. --http://orestis.gr/blog/2008/12/20/python-import-hooks/#c264 Does anyone know what this is referring to? Should I be wary of relying on import hooks? Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regular expression in python

2011-08-18 Thread Josh Benner
On Thu, Aug 18, 2011 at 4:03 PM, Matt Funk wrote: > Hi guys, > > thanks for the suggestions. I had tried the white space before as well (to > no > avail). So here is the expression i am using (based on suggestions), but > still > no success: > > instance_linetype_pattern_str =\ >r'(([-+]?

Understanding .pth files

2011-08-27 Thread Josh English
folder) So my C:\Python27\lib\site-packages\xmldb.pth file has one line: c:\dev\XmlDB\xmldb (I've tried the slashes the other way, too, but it doesn't seem to work). Is the only solution to delete the installed library and add the dev folder to my site.py file? Josh -- http://mail.python.org/mailman/listinfo/python-list

Understanding .pth in site-packages

2011-08-27 Thread Josh English
PYTHONPATH variable? Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding .pth in site-packages

2011-08-27 Thread Josh English
kages directory 2. an Egg file (still unsure why) 3. A .pth file It's a strange juju that I haven't figured out yet. Thanks for the hint. Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding .pth in site-packages

2011-08-27 Thread Josh English
eople from seeing the code? Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding .pth in site-packages

2011-08-27 Thread Josh English
When I run: os.listdir('c:\Python27\lib\site-packages') I get the contents in order, so the folders come before .pth files (as nothing comes before something.) I would guess Python is using os.listdir. Why wouldn't it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding .pth in site-packages

2011-08-27 Thread Josh English
e-packages/foo before it finds and reads site-packages/foo.pth. At least this solution gives me a way to develop my libraries outside of site-packages. Josh -- http://mail.python.org/mailman/listinfo/python-list

Windows alternative: multiprocessing.connection.wait on Pipe, Tkinter File Handlers

2017-10-23 Thread Josh Jacobson
The two functions in the subject are not fully implementable on Windows, and so I am looking for an alternative. Relevant SO postings including full code and description, with bounty: Freezes

__hash__ and ordered vs. unordered collections

2017-11-20 Thread Josh B.
ot;, but to be clear, I think this behavior is totally right. However, I'm less confident that this kind of behavior is useful for MyColl and MyOrderedColl. Could anyone who feels more certain one way or the other please explain the rationale and possibly even give some real-world examples? Thanks! Josh -- https://mail.python.org/mailman/listinfo/python-list

Re: __hash__ and ordered vs. unordered collections

2017-11-20 Thread Josh B.
On Monday, November 20, 2017 at 1:55:26 PM UTC-5, Chris Angelico wrote: > But what you have is the strangeness of non-transitive equality, which > is likely to cause problems. But this is exactly how Python's built-in dict and OrderedDict behave: >>> od = OrderedDict([(1, 0), (2, 0), (3, 0)]) >>>

Re: __hash__ and ordered vs. unordered collections

2017-11-20 Thread Josh B.
On Monday, November 20, 2017 at 2:31:40 PM UTC-5, MRAB wrote: > What if there are duplicate elements? > > Should that be MyColl(some_elements) == MyOrderedColl(other_elements) > iff len(some_elements) == len(other_elements) and set(some_elements) == > set(other_elements)? Yes, that's what I mea

Re: __hash__ and ordered vs. unordered collections

2017-11-21 Thread Josh B.
http://bidict.rtfd.io>. Feedback always welcome. Thanks, Josh -- Forwarded message -- From: Raymond Hettinger Date: Mon, Nov 20, 2017 at 4:46 PM Subject: Re: __hash__ and ordered vs. unordered collections To: j...@math.brown.edu If you want to make ordered and unordered coll

Mysterious Logging Handlers

2016-09-09 Thread Josh English
ER.handlers >>> [] >>> XLOGGER.debug('test') >>> DEBUG:XLREADER:test >>> LOG.handlers >>> [, ] >>> [h.formatter._fmt for h in LOG.handlers] >>> ['%(asctime)-15s %(name)s %(level)-8s %(message)s', '%(asctime)-15s %(name)s %(level)-8s %(message)s'] How can I track where this formatting is coming from? Josh -- https://mail.python.org/mailman/listinfo/python-list

Re: Mysterious Logging Handlers

2016-09-12 Thread Josh English
On Friday, September 9, 2016 at 11:29:32 AM UTC-7, John Gordon wrote: > In <247db0ab-efe7-484b-a418-dd219f68a...@googlegroups.com> Josh English > writes: > > > When I run the scriptI get logging information from only xlreader, not > > from the main script: > >

Re: Mysterious Logging Handlers

2016-09-12 Thread Josh English
On Friday, September 9, 2016 at 11:31:13 AM UTC-7, Peter Otten wrote: > Josh English wrote: > > > > > LOG = logging.getLogger('SHIPPING') > > FORMAT = '%(asctime)-15s %(name)s %(level)-8s %(message)s' > > That should be either levelname or

Best Practices for Internal Package Structure

2016-04-04 Thread Josh B.
ably do it anyway in order to really explicit about what the public API is. """ Curious what folks on this list recommend, or if there are best practices about this published somewhere. Thanks, Josh -- https://mail.python.org/mailman/listinfo/python-list

Understanding Python Documentation

2005-11-24 Thread Josh Cronemeyer
Hi, I have very little experience programming in python but considerable experience with java. One thing that is frustrating me is the differences in the documentation style. Javadocs, at the top level are just a list of packages. Drilling down on a package reveals a list of classes in that

Re: Understanding Python Documentation

2005-11-24 Thread Josh Cronemeyer
On Thursday 24 November 2005 09:27 am, Simon Brunning wrote: > On 24/11/05, Josh Cronemeyer <[EMAIL PROTECTED]> wrote: > > I have very little experience programming in python but considerable > > experience with java. One thing that is frustrating me is the > > diffe

Announcement: AsyncSocket module

2005-04-14 Thread Josh Close
and let me know what they think, and any bugs that are found. https://sourceforge.net/projects/asyncsocket/ Thanks. -Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to schedule my script?

2014-12-18 Thread Josh English
On Wednesday, December 17, 2014 11:11:11 AM UTC-8, Juan Christian wrote: > I know about the schedule modules and such but they work in situations like > 'run this in a X hours/minutes/seconds interval', I already have my code in a > while loop with sleep (it's a bit ugly, I'l change to a schedule

Oddity using sorted with key

2014-03-11 Thread Josh English
sort properly. Any ideas why I'm seeing two different results? Especially as the correct form is giving me the wrong results? Josh English -- https://mail.python.org/mailman/listinfo/python-list

Re: Oddity using sorted with key

2014-03-11 Thread Josh English
A comprehensive and educational answer, Peter. Thank you. Josh -- https://mail.python.org/mailman/listinfo/python-list

Re: Oddity using sorted with key

2014-03-11 Thread Josh English
On Tuesday, March 11, 2014 9:25:29 AM UTC-7, John Gordon wrote: > > > > > Why do you say that 'key=lambda x: x.name.lower' is the correct form? That > > returns the str.lower() function object, which is a silly thing to sort > > on. Surely you want to sort on the *result* of that function, w

Switching between cmd.CMD instances

2014-04-01 Thread Josh English
tween them. Exiting either of the sub-command objects returns back to the BossCmd. I have defined both a do_done and do_exit method on the sub-commands. Is it possible to flag BossCmd so when either of the other two process do_exit, the BossCmd will also exit? Josh -- https://mail.pytho

Re: Switching between cmd.CMD instances

2014-04-03 Thread Josh English
d('submission {}'.format(line)) return True Boss = BossCmd() Sub = SubmissionCmd(Boss) Story = StoryCmd(Boss) Boss.cmdloop() This gives me a flexible framework to bounce between Cmd instances at will, and quit the program from anywhere. Josh -- https://mail.python.org/mailman/listinfo/python-list

Re: Keeping track of things with dictionaries

2014-04-07 Thread Josh English
On Sunday, April 6, 2014 12:44:13 AM UTC-7, Giuliano Bertoletti wrote: > obj = brands_seen.get(brandname) > > if obj is None: > obj = Brand() > brands_seen[brandname] = obj > > Would dict.setdefault() solve this problem? Is there any advantage to defaultdict ov

Re: Keeping track of things with dictionaries

2014-04-07 Thread Josh English
On Monday, April 7, 2014 9:08:23 PM UTC-7, Chris Angelico wrote: > That depends on whether calling Brand() unnecessarily is a problem. > Using setdefault() is handy when you're working with a simple list or > something, but if calling Brand() is costly, or (worse) if it has side > effects that you

Re: [ANNC] pybotwar-0.9 : now using pybox2d-2.3b0

2014-05-06 Thread Josh English
I loved RoboWar on my Mac, many ages ago. I wrote a Stack based language very similar to the one RoboWar used. If you're interested, let me know. Josh English On Saturday, May 3, 2014 3:28:34 PM UTC-7, Lee Harr wrote: > pybotwar is a fun and educational game where players > wri

Yet another "simple" headscratcher

2014-05-30 Thread Josh English
em in a particular row is assigning the same row values to every row. This should be one of those really simple Python things, but for the life of me I don't see it. The first [[4, 0], [4, 0]] is clearly wrong. In each step, this algorithm is repeating the row. Any ideas as to why this is happening? Python 2.7.5, Windows 7, so nothing exotic. Josh -- https://mail.python.org/mailman/listinfo/python-list

Re: Yet another "simple" headscratcher

2014-05-30 Thread Josh English
Mea culpa, gang. I found it. It had absolutely nothing to do with the multiplication. It was in zero_matrix. I feel like a fool. Josh -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   >