Getting clear error messages with a Python templating system?

2008-07-21 Thread Tom Machinski
d suggestions about alternative templating systems that provide better error messages. Thanks, Tom - # foo.mako: hello ${data} >>> print mako.template.Template(filename="foo.mako").render(data="world") hello world >>> print mako.template.Template(filename

Re: Python Written in C?

2008-07-21 Thread Tom Machinski
thought Emacs was written in Lisp. Large parts of Emacs are indeed implemented in Emacs Lisp. There's are some core functions implemented in C. MS-Word, afaik, had very substantial parts written in Visual Basic. Tom > DaveM > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

strptime and timezones

2008-08-13 Thread Tom Anderson
= time.altzone else: tz = time.timezone return t - tz So, firstly, does that work? Answer: i've tested it a it, and yes. Secondly, do you really have to do this just to parse a date with a timezone? If so, that's ridiculous. tom -- 102 FX 6 (goblins) -- http://mail.python.org/mailman/listinfo/python-list

Re: strptime and timezones

2008-08-14 Thread Tom Anderson
On Wed, 13 Aug 2008, Christian Heimes wrote: Tom Anderson wrote: Secondly, do you really have to do this just to parse a date with a timezone? If so, that's ridiculous. No, you don't. :) Download the pytz package from the Python package index. It's *the* tool for timez

Re: How to have unittest tests to be executed in the order they appear?

2008-04-15 Thread tom arnall
| > Ben Finney a better approach maybe is just to write your own test harness. it's trivial to write a minimal system, which is then a solid basis for the enhancements which are best for you. tom arnall arcata -- http://mail.python.org/mailman/listinfo/python-list

Delivery Status Notification (Failure)

2008-08-20 Thread TOM MCCULLOUGH
You Suck big time! <>-- http://mail.python.org/mailman/listinfo/python-list

Buffer objects

2008-09-01 Thread Tom Harris
Greetings, I need a little help with buffer objects. Many Python objects export the buffer interface, or can be persuaded to create a buffer object with a buffer() call. First question, the buffer() function appears very quick. Does it just wrap the internal pointer and then exit? Second questio

Re: Numeric literal syntax

2008-09-08 Thread Tom Harris
side it. Of course not applicable to Python. -- Tom Harris -- http://mail.python.org/mailman/listinfo/python-list

Docstrings for class attributes

2008-09-22 Thread Tom Harris
implementation of PEP 224. The only solution that I can see is to subclass int.__new__(), since once I have an int all it's attributes are immutable. -- Tom Harris -- http://mail.python.org/mailman/listinfo/python-list

Type Hinting vs Type Checking and Preconditions

2006-03-07 Thread Tom Bradford
Let me first say that I'm sure that this subject has come up before, and so forgive me for beating a dead horse. Secondly, let me say that Python's strength is its dynamic nature, and I don't believe that it should ever require a precondition scaffolding. With that said, I do believe that somethin

Re: Type Hinting vs Type Checking and Preconditions

2006-03-07 Thread Tom Bradford
Thanks for the info... Kinda comforting that Guido's syntactic ideas were somewhat similar to my own. -- http://mail.python.org/mailman/listinfo/python-list

Re: Type Hinting vs Type Checking and Preconditions

2006-03-08 Thread Tom Bradford
Really what we're talking about here is weak typing in the form of optional type hinting performed on a function by function basis. As an option, what it would do is allow an author to semantically 'hint' to the interpreter that a function is expecting a certain type, and perform any implicit conv

Re: Type Hinting vs Type Checking and Preconditions

2006-03-08 Thread Tom Bradford
This type of hinting would only break type ducking in-so-much as a function that leveraged that hinting would be looking specifically for an instance of a particular type, which would be absolutely no different than a developer performing the type check manually and throwing it out if the type were

Re: Type Hinting vs Type Checking and Preconditions

2006-03-09 Thread Tom Bradford
I don't use isinstance() and type() at all, nor am I testing the type of all variables being passed into function. What I'm arguing for here is a semantic safety mechanism that is neither required, nor imposed. Ultimately what it looks like what I'm proposing is a syntactic shorthand for the adapt

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread Tom Pacheco
W. eWatson wrote: I'm trying to store analytic data in a folder called Analysis. If the user doesn't have the folder, I make one for him, and then write a txt file into it. In this case a histogram of values, x and frequency. However, it appears that I made a mistake somewhere and cannot delete

Dangerous behavior of list(generator)

2009-12-12 Thread Tom Machinski
ng bug: `lambda:2` is never reached, and a truncated list of 1 element (instead of 3) is "successfully" generated.. Just wondered what you guys think, -- Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-12-28 Thread Tom Kermode
def twice(parameter = 2) return 4 2009/9/20 daggerdvm : >  Write the definition of a function  twice , that receives an  int > parameter and returns an  int that is twice the value of the > parameter. > > how can i do this > -- > http://mail.python.org/mailman/listinfo/python-list > -- http

Re: Dangerous behavior of list(generator)

2009-12-30 Thread Tom Machinski
irst_or_raise(genexp): L = list(islice(genexp, 1)) if not L: raise RuntimeError('no elements found') return L[0] I also think Jean-Paul's had a good point about how the problems in the list/genexp interaction could be addressed. Thank you, -- Tom

Re: Dangerous behavior of list(generator)

2009-12-31 Thread Tom Machinski
On Wed, Dec 30, 2009 at 4:01 PM, Steven D'Aprano wrote: > On Wed, 30 Dec 2009 15:18:11 -0800, Tom Machinski wrote: >> Bottom line, I'm going to have to remove this pattern from my code: >> >>   foo = (foo for foo in foos if foo.bar).next() > > I don't

Re: Dangerous behavior of list(generator)

2009-12-31 Thread Tom Machinski
he simpler cases. As you surely realize, to be perfectly safe, especially when the iterable can contain any value (including your sentinel), we must use an out-of-band return value, hence an exception is the only truly safe solution. -- Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: Dangerous behavior of list(generator)

2009-12-31 Thread Tom Machinski
es). > --S That's not a bad idea. Another nice feature is support for callable "default" values; it would make several new things easier, including raising an exception when you really want that (i.e. if not finding a single element is truly exceptional). -- Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: "Advanced" Python programming book?

2010-01-10 Thread Tom Pacheco
Ryniek90 wrote: I've just finished reading a sort of beginner Python book, and I know quite a bit now but I'm looking for a book that can teach me advanced aspects of Python - code optimisation, threading, etc. Any recommendations? Cheers. Check those link: http://www.amazon.com/Beginni

Re: Combining python and sqlite DB into a single, "executeable".

2009-10-07 Thread Tom Cumming
Thanks!, but I already thought of your suggestion. I've already gotten the clear impression that the amount of work to implement this is more than the ROI. Having said that, it might work if on exiting the app could re-zip itself. One _big_ problem with zip files or compiled python executables

efficient way of splitting a list in to lists where the sum of the values in each does not exceed n

2010-11-24 Thread Tom Boland
way of doing this beautifully :) Many thanks. Tom. -- http://mail.python.org/mailman/listinfo/python-list

Re: efficient way of splitting a list in to lists where the sum of the values in each does not exceed n

2010-11-24 Thread Tom Boland
Thanks for the reply Ian, I've looked in to the bin-packing problem in a general sense now, and I think my ugly algorithm is actually not too bad (although not too efficient either!) :) It was only for a quick job any how. Thanks again. Tom. On 24/11/10 16:16, Ian Kelly wrote: O

Nothing to repeat

2011-01-09 Thread Tom Anderson
rn as '(spa|m)*'. But what i neglected to mention above is that i'm actually generating patterns from structures of objects (representations of XML DTDs, as it happens), and as it stands, patterns like this are a possibility. Any thoughts on what i should do? Do i have to bite the bulle

Re: Perl Hacker, Python Initiate

2011-02-02 Thread Tom Boland
sted. If this is an excercise in just trying to do a straight port of your program, and you're not interested in doing it in a nicer fashion, then I would see the simple response from Carl Banks, however, you should really have posted the python code you're trying instead! Cheers.

Wing in mod_python vs wsgi?

2011-02-08 Thread Tom Stambaugh
for any other Python IDE I've tried. Does Wing do better in mod_wsgi? Is it time for me to migrate from mod_python to mod_wsgi? Has anybody tried to do this (mod_wsgi and apache) in a Windoze environment? Thx, Tom S. -- Tom Stambaugh 63 Boston Ave Somerville, MA 02144 617-776-8934 (land

Help: python unicode

2011-02-17 Thread tom z
Hi all~ My script can't work.I've changed my defaultencoding from 'ascii' to 'utf-8',but Python also raises a 'UnicodeEncodeError' error. the error likes this: >>> s=u'La Pe\xf1a' >>>print s UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 5: ... And in my script, the

Striving for PEP-8 compliance

2010-04-07 Thread Tom Evans
t. Is there any way to do something semantically the same as this with python? Cheers Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: Striving for PEP-8 compliance

2010-04-07 Thread Tom Evans
On Wed, Apr 7, 2010 at 4:10 PM, geremy condra wrote: > On Wed, Apr 7, 2010 at 10:53 AM, Tom Evans wrote: >> [ Please keep me cc'ed, I'm not subscribed ] >> >> Hi all >> >> I've written a bunch of internal libraries for my company, and they >&

Re: [wxPython-users] wxPython 2.8.11.0 release

2010-05-25 Thread Tom Browder
6f8b2513941d0f4/6d77c3d4ebd0e919?lnk=gst&q=python+3#6d77c3d4ebd0e919 Thanks, -Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: importing modules from higher level directory

2010-06-25 Thread Tom Pacheco
from .. import module or from ..module import foo this is intended for use within packages. see http://www.python.org/dev/peps/pep-0328/ also search for python relative import - tom Nathan Huesken wrote: Hi, Is it somehow possible to import modules from *.py files in a higher level

Re: GNU Emacs Developement Inefficiency (commentary)

2010-07-18 Thread Tom Lord
On Jul 17, 11:11 am, Emmy Noether wrote: > Well, there is a lot of resistance from the emacs community in sharing > information. Richard Stallman is a true STALLER of progress. He has > held the whole process hostage by not sharing information. He has > RENEGED on his promise to make it truly ope

Re: Orange County, California Python User Group

2010-07-27 Thread Calhoon, Tom
Tom Calhoon (714) 834-6632 -- http://mail.python.org/mailman/listinfo/python-list

Eval cannot see globals from another module

2010-08-16 Thread Tom Harris
Greetings, I want a debugging function with the effect of the function below (in a seperate module): def dump(expr): print expr, '=', eval(expr) foo = 33 dump('foo') Of course this fails when called from another module because eval does not know the globals or locals of the caller. Is the

How to Customize the New 2.7 ArgumentParser Library Class (module argparse)?

2010-08-20 Thread Tom Browder
; # capitalize 'usage' 2. change "optional arguments:" to "Optional arguments:" # capitalize 'Optional' Does anyone know how to do it without modifying source code? Thanks, -Tom Thomas M. Browder, Jr. Niceville, Florida USA -- http://mail.python.org/mailman/listinfo/python-list

Re: retrieve bitwise float representation

2009-06-11 Thread Tom K.
On Jun 10, 8:41 am, Ulrich Eckhardt wrote: > I need to pack a floating point value into a vector of 32-bit unsigned > values in IEEE format. Further, I maintain a CRC32 checksum for integrity > checking. For the latter, I actually need the float as integral value. ... > What I'm wondering is wheth

No trees in the stdlib?

2009-06-25 Thread Tom Reed
thing other reason? Seems like a good fit for the collections module. Can anyone shed some light? Thanks. -- Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: can i write a assemly language programs in python

2009-07-09 Thread Tom Kermode
I wonder if the OP is trying to find out whether python programmes can be compiled and run as stand alone executables. (I know assembly and machine code are not the same, but it might be what they're after.) On windows you can use http://www.py2exe.org/ to bundle python programs into stand alone

Re: gett error message: "TypeError: 'int' object is not callable"

2009-07-09 Thread Tom Kermode
will learn which names to avoid, but it's a bit of a pitfall early on. Cheers, Tom 2009/7/9 Richard Brodie : > > "Nick" wrote in message > news:e54c4461-c0b7-42fb-8542-cefd7bf5f...@h18g2000yqj.googlegroups.com... > >> file = open(prefix1) >> text = file.read

Re: A Bug By Any Other Name ...

2009-07-18 Thread Tom Kermode
Maybe the IDE is the best place to warn you of something like that. You could have an IDE where you specify which language you're more familiar with and then have it display warnings likely to be relevant to you. People could collaborate to add support for gradually more niche languages. Python

Re: An assessment of the Unicode standard

2009-09-17 Thread Tom Morris
o C and vice versa. And do so reliably. Where are they? Show me perfect machine translation and then we can maybe stop bothering about other languages. [1] http://en.wikipedia.org/wiki/Unicode_Mathematical_Operators -- Tom Morris <http://tommorris.org/> -- http://mail.python.org/mailman/listinfo/python-list

Safely decoding user input

2010-09-02 Thread Tom Miller
tely decode all strings in sys.argv[] with something like sys.argv = [string.decode(sys.stdin.encoding) for string in sys.argv]? 2) Can something similar be done to anything returned by raw_input()? Thanks, Tom -- http://mail.python.org/mailman/listinfo/python-list

Python 2.7 Won't Build

2010-09-16 Thread Tom Browder
NPATH and LD_LIBRARY_PATH, but python2.7 is my default python. I guess my next step will be to manually remove python 2.7 unless I hear some solutions soon. Thanks, -Tom Thomas M. Browder, Jr. Niceville, Florida USA -- http://mail.python.org/mailman/listinfo/python-list

File holes in Linux

2010-09-29 Thread Tom Potts
ere to take it next, I'd really appreciate it. Thanks a lot, Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: if the else short form

2010-09-29 Thread Tom Potts
, this kind of coding is absolutely fine, but it makes things harder to read and doesn't really save much space. I wouldn't recommend using this kind of style yourself, at least until you're more familiar with programming in Python. Tom On 29 September 2010 11:42, Tracubik wrote:

PyCObject & malloc creating memory leak

2010-09-29 Thread Tom Conneely
I'm attempting to write a library for reading data via USB from a device and processing the data to display graphs. I have already implemented parts of this code as pure python, as a proof of concept but I have now moved on to implementing the functions in a C extension. My original plan was to ha

Re: PyCObject & malloc creating memory leak

2010-09-30 Thread Tom Conneely
d; some will simply set > it aside for the next allocation. > Another possible (and related) issue is memory fragmentation. Again, it > depends on the memory allocator. Yes, I know that's the case but the "freed" memory should be used for the next allocation, or atleas

Re: PyCObject & malloc creating memory leak

2010-09-30 Thread Tom Conneely
the PYCObject's destructor, the pointer is for the constant "foo", not the memory I initially allocated. I only posted this to help people searching, sorry for the noise. Tom Conneely -- http://mail.python.org/mailman/listinfo/python-list

Re: 2D List

2010-10-11 Thread Tom Pacheco
ibuteError: 'int' object has no attribute 'append' your creating a 1d list this creates a 2d list a=[[[]]*5 >>> [0]*5 [0, 0, 0, 0, 0] >>> [[]]*5 [[], [], [], [], []] - tom -- http://mail.python.org/mailman/listinfo/python-list

Re: socket.sendto / UDP problem

2010-10-22 Thread Tom Pacheco
d d ". This will obviously overflow the PLC and cause a reset. Any ideas? Regards, - - Todd -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.16 (GNU/Linux) iEYEARECAAYFAkzAnQUACgkQwnknPuQqPIOx6QCgjNP/S/dODwO/c7xk8xKZk1A7 IMQAniGKd5yaqRo3nAmHJJsrkEP6iL/j =aH+4 -END PGP SIGNATURE- wh

Re: socket.sendto / UDP problem

2010-10-22 Thread Tom Pacheco
d d ". This will obviously overflow the PLC and cause a reset. Any ideas? Regards, - - Todd -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.16 (GNU/Linux) iEYEARECAAYFAkzAnQUACgkQwnknPuQqPIOx6QCgjNP/S/dODwO/c7xk8xKZk1A7 IMQAniGKd5yaqRo3nAmHJJsrkEP6iL/j =aH+4 -END PGP SIGNATURE- wh

Accessing application data portably

2006-08-23 Thread Tom E H
"datafile" relative to where the executable (made by py2exe) is installed. Then I could detect the operating system, and choose appropriately. To be that explicit seems undesirable. Any cleverer ideas? Tom (Please CC me on replies: I'm not subscribed. The From address is munged) -

Re: Accessing application data portably

2006-08-23 Thread Tom E H
Larry Bates wrote: > Tom E H wrote: >> My Python application includes some data files that need to be accessed >> by modules I distribute with it. >> >> Where can I put them, and how should I arrange my code, so that it works >> across platforms? >> > I a

Re: Accessing application data portably

2006-08-23 Thread Tom E H
system you are running on? Tom -- http://mail.python.org/mailman/listinfo/python-list

Active Python versions

2006-06-18 Thread Tom Del Rosso
Why is the Windows msi install file for ActivePython-2.4.3.12 only 15MB whereas the older msi file for ActivePython-2.4.2.10 was 19MB? BTW, is that the prefered Python environment? -- Reply in group, but if emailing add another zero, and remove the last word. -- http://mail.python.org/mailm

Re: Active Python versions

2006-06-19 Thread Tom Del Rosso
Trent Mick <[EMAIL PROTECTED]> typed in news://[EMAIL PROTECTED], > Tom Del Rosso wrote: >> Why is the Windows msi install file for ActivePython-2.4.3.12 only >> 15MB whereas the older msi file for ActivePython-2.4.2.10 was 19MB? >> >> BTW, is that the prefere

Re: Active Python versions

2006-06-19 Thread Tom Del Rosso
[EMAIL PROTECTED] <[EMAIL PROTECTED]> typed in news://[EMAIL PROTECTED], > Maybe the OP is refering to PythonWin editor (as compared to IDLE) > which is in ActiveState's release but not in the Python.org release... > makes for a very different subject, and hopefully for very different > answer dir

Re: Active Python versions

2006-06-19 Thread Tom Del Rosso
Thanks very much guys. -- Reply in group, but if emailing add another zero, and remove the last word. -- http://mail.python.org/mailman/listinfo/python-list

Update of Gnuplot.py

2008-01-09 Thread Tom La Bone
Can someone suggest where to get a version of Gnuplot.py (for Windows) that has been updated to use numpy? Or, is there another interface available to use GnuPlot from Python? Thanks. Tom -- View this message in context: http://www.nabble.com/Update-of-Gnuplot.py-tp14710180p14710180.html

Application Error

2017-08-15 Thread Alhassan Tom Alfa
corrected? I really need to use this application Thank you in anticipation for a quick response Best Regards, Tom <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free. www.avast.com <https:

Writing a C extension - borrowed references

2018-03-20 Thread Tom Evans via Python-list
ated to my use of the thing I borrowed it from? Is this cargo cult advice (sometimes the gods need this structure, and so to please the gods it must be everywhere), sensible belt and braces or needless overkill? Cheers Tom [1] http://pythonextensionpatterns.readthedocs.io/en/latest/refcount.htm

Re: Writing a C extension - borrowed references

2018-03-20 Thread Tom Evans via Python-list
a few functions. Cheers Tom -- https://mail.python.org/mailman/listinfo/python-list

[OT] Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Tom Evans via Python-list
WD and automatic transmission are more expensive options than FWD and manual transmissions, and most cars are FWD and manual. At least most cars I can afford.. Cheers Tom -- https://mail.python.org/mailman/listinfo/python-list

Re: Writing a C extension - borrowed references

2018-03-20 Thread Tom Evans via Python-list
RMAT_PERSISTENT); into ctypes compatible syntax, when I can simply adapt the working C code to Python. :) Plus, there is the library static initialisation to manage, the issues of distributing the C libraries if I do a C wrapper to call from ctypes. This way, it can be distributed from our devpi very

Trying to Download PygameZero

2020-10-10 Thread Tom Hedge via Python-list
I am in a 8 grade coding class at the moment and my teacher asked me to download a script called pgzero. I can not seem to download pgzer or pygame when i try it shoots me a error message:  ERROR: Command errored out with exit status 1:     command: 'c:\program files\python39\python.exe' -c 'imp

<    2   3   4   5   6   7