Does anyone know of any current Python projects that utilize Google's search
engine to return quick answers to questions? For example, if you Google "When
did Abraham Lincoln die", Google returns "April 15, 1865" before listing any
results. I know of many projects that utilize Google search to r
fixed with
now = datetime.datetime.now()
later = now + datetime.timedelta(days=2*365)
striplater = later.strftime('%Y%m%d%H')
# python3.4 makekeys.py
Enter the domain to configure keys for? test1234.com
Generating key
pair..
Time adjustment error:
# python3.4 timefix.py
2015022105
2015-02-21 05:00:00
Traceback (most recent call last):
File "timefix.py", line 15, in
ndate = datetime.datetime.strptime(timeadd, '%Y%m%d%H')
TypeError: must be str, not datetime.datetime
# cat timefix.py
#!/usr/bin/python3.4
impor
Yes, the program deletes the same files it produces. It looks to see if old
stuff is there and if it exist, it deletes the files and creates and entirely
new DNS zone with keys and then it is supposed to sign it.
The last step is where it is still failing but your code helped me to figure
out wh
# cat makekeys.py
#!/usr/bin/python3.4
import subprocess
import sys
import string
import os.path
import datetime
import shlex
from time import gmtime, strftime
from subprocess import Popen, PIPE, STDOUT
pretime = strftime("%Y%m%d%H", gmtime())
time = datetime.datetime.strptime(pretime,'%Y%m%d%H')
On 3/17/2014 3:33 PM, Thrinaxodon wrote:
In article <71ab5220-6d5d-46bf-b33a-16aae6c87...@googlegroups.com>,
bradg...@gmail.com says...
On Wednesday, February 5, 2014 2:59:23 PM UTC-8, Brad Guth wrote:
On Saturday, January 11, 2014 3:52:10 PM UTC-8, Brad Guth wrote:
NOVA and Dis
On Feb 26, 7:01 pm, NanoThermite FBibustards
wrote:
> @Xah Lee, he only tell one point, fast interpreter avoiding Edit-
> Compile-Run cycle, and make it INTERACTIVE, the guy did not teach
> nothing of design. The principle was first given by Margaret Hamilton
> and Zeldin.
>
Bret's main point is t
> >>> 0x & -327681234
>
> 3967286062
Very nice! Thanks for that example. Unsigned long longs:
0x & -9151314442815602945
9295429630893948671L
--
http://mail.python.org/mailman/listinfo/python-list
gt; >>> unpack('=I', pack('=i',-327681234))
>
> (3967286062,)
>
> I would think there's some more efficient way to do this though.
>
> Cheers,
> Chris
Thanks Chris! I was doing it backwards. I only have a few of these
right now, so performance isn't a concern. I appreciate the advice.
Brad
--
http://mail.python.org/mailman/listinfo/python-list
In C or C++, I can do this for integer conversion:
unsigned int j = -327681234; // Notice this is signed.
j will equal 3967286062. I thought with Python that I could use struct
to pack the signed int as an unsigned int, but that fails:
>>> x = struct.pack("", line 1, in
struct.error: integer ou
than the explicit acquire() and release() so I'll use that approach. I
appreciate your advice.
Brad
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Dec 16, 2011 at 9:24 AM, Brad Tilley wrote:
>
>
> On Fri, Dec 16, 2011 at 8:33 AM, Tim Wintle wrote:
>
>> On Fri, 2011-12-16 at 05:21 -0800, Brad Tilley wrote:
>> > 107 void increment_counter( unsigned int& counter )
>> > 108
On Fri, Dec 16, 2011 at 8:33 AM, Tim Wintle wrote:
> On Fri, 2011-12-16 at 05:21 -0800, Brad Tilley wrote:
> > 107 void increment_counter( unsigned int& counter )
> > 108 {
> > 109 boost::mutex::scoped_lock lock( counter_lock );
> >
++counter;
111 }
A thread locks the function on entrance and then releases it on exit.
What is the equivalent way to do this in Python?
Many thanks!
Brad
--
http://mail.python.org/mailman/listinfo/python-list
I dont understand why this is such a big deal. Nor do i understand why google
can't find a reasonable answer. If one can't figure out from the title what I'm
trying to do, then a look at code should firmly plant the intent. The general
idea of the code is, in my opinion, very basic.
I notice,
Hi All,
I've heard of Java CPUs. Has anyone implemented a Python CPU in VHDL
or Verilog?
-Brad
--
http://mail.python.org/mailman/listinfo/python-list
> From: pa...@cruzio.com
> To: santacruz-...@hotmail.com
> Subject: Fw: Python Tools for Visual Studio from Microsoft - Free & Open
> Source
> Date: Thu, 10 Mar 2011 18:47:19 -0800
>
>
> - Original Message -
> From:
> To: "roland garros" ;
> Sent: Thursday, March 10, 2011 2:03 AM
>
For those seeking to work with Python-based tools in the healthcare
IT industry, this SIG ("special interest group") can provide a forum to
discuss challenges and hopefully foster knowledge sharing and tools
development. Relevant topics include tools for working with healthcare
standard data format
On Aug 25, 4:05 am, Alex McDonald wrote:
> Your example of writing code with
> memory leaks *and not caring because it's a waste of your time* makes
> me think that you've never been a programmer of any sort.
"Windows applications are immune from memory leaks since programmers
can count on regula
p.lang.forth have a penchant for sarcasm
- one of the reasons I always read their posts. Maybe it gets lost on
the international crowd, but I love it.
-Brad
--
http://mail.python.org/mailman/listinfo/python-list
data, which you may find
preferable to an ugly crash. OTOH, bugs that cause spectacular
failures tend to be discovered. You can also initialize the stack
memory with a pattern like 0xDEAD and then after sufficiently
exercising the code, examine the memory contents to see the "high
water mark
started:
import sys
# Linux binary
if 'linux' in sys.platform.lower():
import _sqlite3_linux as _sqlite3
# Windows binary
elif 'win32' == sys.platform:
import _sqlite3_windows as _sqlite3
# Mac binary
elif 'darwin' == sys.platform:
import _sqlite3_m
On Fri, Feb 5, 2010 at 9:49 AM, Jean-Michel Pichavant
wrote:
> Anyway why would you want to use the tuple form ? it's beaten in every
> aspect by the dictionary form.
I'm subclassing a namedtuple, and adding some additional functionality
such as __getitem__, __setitem__, so that the namedtuple a
a script since you never know when the user will press it, which
is why you put the try: except KeyboardInterrupt: around as much of your
script as possible. The signal that the OS sends to the Python
interpreter is irrelevant.
--
Brad Harms -- http://alphaios.net
--
http://mail.python.org/mailman/listinfo/python-list
erm, because it's too cumbersome to say
"properties or dynamic attributes using __getattr__ or __getattribute__"
all the time.
That will be my last message for a while...good night, c.p.l.
--
Brad Harms -- http://alphaios.net
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 04 Dec 2009 18:05:03 +1100, Ben Finney wrote:
> Brad Harms writes:
>
>> Anyway, it looks like the docs agree with you
>> (http://docs.python.org/glossary.html#term-attribute), so I'm not going
>> to argue.
>
> That's good, because the te
On Tue, 2009-12-01 at 16:58 +0100, Bruno Desthuilliers wrote:
> The Music Guy a écrit :
> (snip)
> > Lie Ryan, I think I see what you're saying about using __dict__ to add
> > members
>
> No "members" in Python - only attributes.
> > to a class, but it's not quite the same. __dict__ is only for
>
On Tue, 2009-12-01 at 14:38 +, Steven D'Aprano wrote:
> On Mon, 30 Nov 2009 18:55:46 -0800, The Music Guy wrote:
>
> > Lie Ryan, I think I see what you're saying about using __dict__ to add
> > members to a class, but it's not quite the same. __dict__ is only for
> > attributes, NOT properties
st
definition of an attribute, but it's the best I can think of ATM.)
I'm not trying to discard Python's distinction between items and attributes,
but I don't want to be limited by it due to mere syntactical constraints,
either.
May the Penguin in the sky bless your every subroutine,
Brad Harms
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Nov 29, 2009 at 7:49 PM, Lie Ryan wrote:
> On 11/29/2009 12:22 PM, The Music Guy wrote:
>
>> When I first started seeing @ show up in Python code, I said "what the
>> heck is that? It looks so weird and _ugly_.I would never try to mess
>> with that." But I started seeing it more and more,
On Nov 25, 10:49 pm, Chris Rebert wrote:
> On Wed, Nov 25, 2009 at 6:35 PM, The Music Guy
>
> wrote:
> > Hello all,
>
> > I just posted to my blog about a feature that I'd like to see added to
> > Python. Before I go through the trouble of learning how to write a PEP or
> > how to extend the Pyth
g = partition(words, lambda w: len(w) < 3)
d = {1 : 'w', 2 : 'x' ,3 : 'y' ,4 : 'z'}
keys = [1, 3, 4, 9]
found, missing = partition(keys, d.has_key)
There are probably a dozen other approaches, but the existing "filter"
is fast, clear, and *almos
You are not allowed to
post to this mailing list" reply. Perhaps because I am posting through
Google groups? Or maybe one must be an approved member to post?
-Brad
--
http://mail.python.org/mailman/listinfo/python-list
the solution here would worse if func was more complex.
Either way, what I am still wondering is if people would find a built-
in implementation useful?
-Brad
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 2, 9:08 pm, Paul Rubin <http://phr...@nospam.invalid> wrote:
> Brad writes:
> > On Jul 2, 8:14 pm, Paul Rubin <http://phr...@nospam.invalid> wrote:
> > > schickb writes:
> > > > def split(seq, func=None):
> > > > if func
On Jul 2, 8:17 pm, "Pablo Torres N." wrote:
> On Jul 2, 9:56 pm, schickb wrote:
>
> > I have fairly often found the need to split a sequence into two groups
> > based on a function result.
>
> This sounds like it belongs to the python-ideas list. I suggest
> posting there for better feedback, si
or (x,y) in xs if not y)
> return (t, f)
In my testing that is 3.5x slower than the original solution (and less
clear imo). I fixed my version to take a bool default. Either way, I'm
not really looking for additional ways to do this in Python unless
I've totally missed something
P:// is somehow affecting the searching
capabilities of the string.find function. But I can't seem to locate any
documentation online that outlines restrictions when using special
characters.
Any thoughts?
Thanks!
-Brad
--
http://mail.python.org/mailman/listinfo/python-list
P:// is somehow affecting the searching
capabilities of the string.find function. But I can't seem to locate any
documentation online that outlines restrictions when using special
characters.
Any thoughts?
Thanks!
-Brad Causey
CISSP, MCSE, C|EH, CIFI
Zero Day Consulting
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 22, 11:24 pm, Tim Roberts <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> >On Sep 19, 6:42 pm, [EMAIL PROTECTED] wrote:
> >> On Sep 19, 1:24 am, Tim Roberts <[EMAIL PROTECTED]> wrote:
>
> >> > [EMAIL PROTECTED] wrote:
>
> >> > >I tried curses.setsyx(2,3) in my script and it doesn't m
Carl Banks wrote:
Out of curiosity, what does a true multimap solve that a dictionary of
lists not solve?
Nothing really. I went with a variation of the suggested work around...
it's just that with Python I don't normally have to use work arounds and
normally one obvious approach is correct:
castironpi wrote:
I don't understand what a multimap does that a map of lists doesn't do.
It counts both keys individually as separate keys. The Python workaround
does not... see examples... notice the key(s) that are '4'
Python output (using the k = [] idea):
Key: 4 Value: [[13, 'Visa'],
Mike Kent wrote:
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
k = {}
k['1'] = []
k['1'].append('Tom')
k['1'].append('Bob')
k['1'].append('Joe')
k['1']
['Tom', 'Bob', 'Joe']
Recently had a need to us a multimap container in C++. I now need to
write equivalent Python code. How does Python handle this?
k['1'] = 'Tom'
k['1'] = 'Bob'
k['1'] = 'Joe'
...
Same key, but different values. No overwrites either....
[EMAIL PROTECTED] wrote:
Hi,
it's me again with tons of questions. I hava an input file structured
like this:
X XYData-1
1. 3.08333
>
number1 number2 number3
number4 number5 number6
split is your friend.
--
http://mail
alex23 wrote:
On Aug 12, 11:13 pm, brad <[EMAIL PROTECTED]> wrote:
Very neat program. Would be cool if it could easily integrate into other
py apps instead of being a standalone CLI tool.
Perhaps, but I think you could get a long way using os.system().
Yes, that is possible, but the
alex23 wrote:
PDFMiner is a set of CLI tools written in Python, one of which
converts PDF to text, HTML and more:
http://www.unixuser.org/~euske/python/pdfminer/index.html
Very neat program. Would be cool if it could easily integrate into other
py apps instead of being a standalone CLI tool.
alex23 wrote:
On Aug 12, 12:03 pm, Brad <[EMAIL PROTECTED]> wrote:
So let's say I want to edit this file and change Volume from 940 to 950.
Personally, I'd recommend avoiding re and sticking with the standard
string functions.
Something like this should be pretty effective:
Hi, what I'd like to do is edit an input file for a calculation with
Python. Let's say that I have an input file like the following
-->>
BLAH BLAH BLAH
Other inputs, Volume 940 m^3, maybe some more stuff
STUFF STUFF
-->>
So let's say I
Kevin Walzer wrote:
>>> import os
>>> foo = os.system('whoami')
kevin
>>> print foo
0
>>>
The standard output of the system command 'whoami' is my login name. Yet
the value of the 'foo' object is '0,' not 'kevin.' How can I get the
value of 'kevin' associated with foo?
Hi Kevin, check
srinivasan srinivas wrote:
Could someone suggest me ways to convert PDF files to HTML files??
Does Python have any modules to do that job??
Thanks,
Srini
Unless there is some recent development, the answer is no, it's not
possible. Getting text out of PDF is difficult (to say the least) and a
Hi guys... I'm trying to make my Python regex code behave like my C++
regex code. In order to search large strings for *all* occurrences of
the thing I'm searching for, I loop like this in C++:
void number_search(const std::string& portion, const boost::regex& Numbers)
{
boost::smatch m
Gary Herron wrote:
My impression was (and still is):
A page of Python code looks *clean*, with not a lot of
punctuation/special symbols and (in particular) no useless lines
containing {/} or begin/end or do/done (or whatever).
what about all those 'self' thingys? :)
--
http://mail.python.o
RPM1 wrote:
...
Basically you just compile your C code as a regular C code dll. ctypes
then allows you to access the functions in the dll very easily.
Does that work with C++ code too or just C?
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
Hello,
I am new to Python, with a background in scientific computing. I'm
trying to write a script that will take a file with lines like
c afrac=.7 mmom=0 sev=-9.56646 erep=0 etot=-11.020107 emad=-3.597647
3pv=0
extract the values of afrac and etot...
Why not just sp
Just wondering if anyone has ever solved this efficiently... not looking
for specific solutions tho... just ideas.
I have one thousand words and one thousand files. I need to read the
files to see if some of the words are in the files. I can stop reading a
file once I find 10 of the words in i
I am stuck with 1.5.
Thanks,
Brad
--
http://mail.python.org/mailman/listinfo/python-list
ts the use of design
patter. So, here goes my question. Is that OK if I follow this? ...
Yes. Python does not impose design patterens onto developers. Pick your
poison. It is somewhat OOP, but allows for other development paradigms
as well... rather like C++ IMO although a bit more OOP focused.
cm_gui wrote:
Python is slow.
It ain't C++, but it ain't a punch card either... somewhere in between.
I find it suitable for lots of stuff. I use C++ when performance really
matters tho... right tool for the job. Learn a good interpreted language
(Pyhton) and a good compiled language (C or C
[EMAIL PROTECTED] wrote:
Hi,
Is it worthwhile maintaining a production application setup script in
Python as opposed to shell-script?
I do not think so. Perhaps 'in conjunction with', but not 'opposed
to'... sh is the lowest common denominator of shells. Script for sh and
your script will r
Frédéric Degraeve wrote:
Hello,
I tried this code with vs7-8 and boost1.34.1-1.35.0 and my python is a
2.4..
Try the boost users list:
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.boost.org/mailman/listinfo.cgi/boost-users
--
http://mail.python.org/mailman/lis
Vicent Giner wrote:
The usual answer is that development time is more important than running time.
This depends. Run time is not important until you are asked to scale to
millions or billions of users or computations or large data sets. I've
seen this first hand. Getting results back the sa
utationally heavy info to c++ from
within Pyhton. os.system is not ideal. Just wondering how other folks do
this? I have source to some of the c++ code, but some of it is in binary
from only. It can take stdin or arguments.
Thanks for any tips,
Brad
--
http://mail.python.org/mailman/listinfo/python-list
I want to compare two dicts that should have identical info just in a
different data structure. The first dict's contents look like this. It
is authoritative... I know for sure it has the correct key value pairs:
{'001' : '01'}
The second dict's contents are like this with a tuple instead of a
Steven D'Aprano wrote:
> On Fri, 28 Mar 2008 22:31:07 -0400, Brad wrote:
>
>> When reading a file into a list that contains windows file paths like
>> this:
>>
>> c:\documents and settings\brad\desktop\added_software\asus\a.txt
>>
>> I get a list t
When reading a file into a list that contains windows file paths like this:
c:\documents and settings\brad\desktop\added_software\asus\a.txt
I get a list that contains paths that look like this:
c:\\documents and settings\\brad\\desktop\\added_software\\asus\\a.txt
So, my list contains those
Hi folks,
I'm still fairly new to programming in python and programming in
general. A friend of mine is in a CompSci 101 course and was working
on a slider game when he encountered a problem. We eventually figured
out what the problem was and built a test case to help solve it, but I
can't for the
Martin P. Hellwig wrote:
> The tricky part is how to resolve the mail server for a mail address.
> Usually you have to query the mx record of that domain. I solved that by
> looking if I can find the nslookup binary.
The from and to are static constants... they don't change. Mail just
seems s
n the machine?
Thanks,
Brad
--
http://mail.python.org/mailman/listinfo/python-list
Just playing around with Python3000 a2 release on Windows XP 32-bit x86.
import __hello__
doesn't print 'hello world...' as it does on 2.5
The import doesn't fail or generate errors... just no output. Perhaps
this is by design?
Brad
--
http://mail.python.org/mailman/listinfo/python-list
I was just looking through the 2.5.1 source code. I noticed a few
mis-spellings in the comments. No big deal really. Can patches be
submitted that correct the spelling errors or should they just be
pointed out to some mailing list?
Thanks,
Brad
--
http://mail.python.org/mailman/listinfo
Wondering if someone would help me to better understand tempfile. I
attempt to create a tempfile, write to it, read it, but it is not
behaving as I expect. Any tips?
>>> x = tempfile.TemporaryFile()
>>> print x
', mode 'w+b' at 0xab364968>
>>> print x.read()
>>> print len(x.read())
0
>>> x
Eduardo O. Padoan wrote:
> This is a FAQ:
> http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm
Thanks to all for the feedback. I'm no language designer. I just see and
hear these criticisms and I wanted to think thro
Tommy Nordgren wrote:
>> def outer(avar=False):
>> print avar
>> if avar == True:
>> return
>>
>> def inner(avar=True):
>> print avar
>> return avar
>>
>> outer(inner())
>>
>> outer()
> This is not a general solution to this problem.
Run my exam
Rob Wolfe wrote:
> I wonder why people always complain about `len` function but never
> about `iter` or `pprint.pprint`? :)
Not complaining. len is simple and understandable and IMO fits nicely
with split(), strip(), etc... that's why I used it as an example, but
list(), etc. could be used as e
Tommy Nordgren wrote:
> Given the following:
> def outer(arg)
> avar = ''
> def inner1(arg2)
> # How can I set 'avar' here ?
Try this... works for me... maybe not for you?
def outer(avar=False):
print avar
if avar == True:
return
def inner(avar=True):
Will len(a_string) become a_string.len()? I was just reading
http://docs.python.org/dev/3.0/whatsnew/3.0.html
One of the criticisms of Python compared to other OO languages is that
it isn't OO enough or as OO as others or that it is inconsistent. And
little things such as this seem to support t
sily allows for this sort of thing (like Debian)
Brad
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> On Oct 12, 2:55 pm, Florian Lindner <[EMAIL PROTECTED]> wrote:
>> Hello,
>> is there a function in the Python stdlib to test if a string is a valid
>> email address?
here's a Perl re example... I don't know whether to laugh or cry...
don't try to replicate this in Pytho
Grant Edwards wrote:
> If you send an e-mail to an address and you get a response,
> then it's valid.
No response could be valid too. The user may not respond. For automated
tasks, I go with the no bounce method. When things start bouncing, do
domething, but so long as they don't bounce do some
Florian Lindner wrote:
> Hello,
> is there a function in the Python stdlib to test if a string is a valid
> email address?
Nope, most any string with an @ in it could be a valid email addy. Send
a message to the addy, if it doesn't bounce, then it's valid.
--
http://mail.python.org/mailman/listi
lot of memory. So, just because you have 2GB, that does not mean you can
access all of that at once. I would guess that 25% of memory is in
constant use by the OS. So, do your IO/reads in smaller chunks similar
to the example I gave earlier.
Brad
--
http://mail.python.org/mailman/listinfo/python-list
amdescombes wrote:
> Hi,
>
> I am using Python 2.5.1
> I have an application that reads a file and generates a key in a
> dictionary for each line it reads. I have managed to read a 1GB file and
> generate more than 8 million keys on an Windows XP machine with only 1GB
> of memory and all works
rtunately, there is no luhn check for SSNs. We
follow the Social Security Administration verification guideline
religiously... here's an web front-end to my logic:
http://black.cirt.vt.edu/public/valid_ssn/index.html
but still have many false positives on SSNs, so being able to id *names
and
mes in it as well." Now then, I'd have
less to review or perhaps as much as I have now, but I could push the
files with numbers and names to the top of the list so that they would
be reviewed first.
Brad
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> On Oct 11, 5:22 pm, brad <[EMAIL PROTECTED]> wrote:
>> Crazy question, but has anyone attempted this or seen Python code that
>> does? For example, if a text file contained 'Guido' and or 'Robert' and
>> or 'Susan&
Crazy question, but has anyone attempted this or seen Python code that
does? For example, if a text file contained 'Guido' and or 'Robert' and
or 'Susan', then we should return True, otherwise return False.
--
http://mail.python.org/mailman/listinfo/python-list
Erik Jones wrote:
> big_evens = range(10, 100, 2)
> big_odds = range(11, 100, 2)
Neat, but not as clever or as hard to read as mine... I'll bet it faster
though... maybe not.
The upto part is here:
ok_numbers = low_odds + big_evens + [x for x in low_evens if x <= y]
--
http://mail.python.org
Bjoern Schliessmann wrote:
> brad wrote:
>> low_odds = [1,3,5,7,9]
>> # make a list containing 10 - 98 evens only
>> big_evens = big_evens = [x for x in list(xrange(99)) if x % 2 ==
>> 0 and x >8]
>
> Why use xrange if you convert it to a full list in place
Shawn Minisall wrote:
> I just learned about if, then elif statements and wrote this program.
> The problem is, it's displaying all of the possibilities even after you
> enter a 0, or if the fat grams are more then the total number of
> calories , that is supposed to stop the program instead of
I was looking at a way to implement Ruby's upto method in python. I came
up with the code below... three years ago, I would never have thought of
list comprehension, today it seems second nature. This may be totally
un-Pythonic, but I thought it was kind of clever. Man, for some reason,
I feel
). I write/test
> on Linux, and the programs pretty much "just work" on Windows.
That sums up my experience with wxPython as well. I've never had any
problems. I develop on Linux and run on Linux, Mac and Windows.
Brad
--
http://mail.python.org/mailman/listinfo/python-list
(the official unittest that is)... especially when there's a
lot of source code. But this...
if len(x) != y:
sys.exit('...')
is a hell of a lot easier and quicker that subclassing unittest.TestCase
on small projects :)
Do others do their own "informal" unit test
How is this expressed in Python?
If x is in y more than three times:
print x
y is a Python list.
--
http://mail.python.org/mailman/listinfo/python-list
Tim Chase wrote:
> Numbers with leading zeros are parsed as octal. 8 and 9 are invalid
> digits in octal. Thus, it falls over. 00 through 07 will work fine,
> but 08 and 09 will go kaput.
>
> http://docs.python.org/ref/integers.html
>
> -tkc
Thanks... that makes sense. I'll store them as st
This works:
>>> area_group = {001:06, 002:04, 003:04, 006:9}
This does not (one the end, 09 is used instead of 9)
>>> area_group = {001:06, 002:04, 003:04, 006:09}
File "", line 1
area_group = {001:06, 002:04, 003:04, 006:09}
SyntaxError: invalid token
Why does 09 cause an invalid tok
Hrvoje Niksic xemacs.org> writes:
>
> Brad Johnson ballardtech.com> writes:
>
> > I have a place where I execute a Python command that calls into C++
> > code which then in turn calls back into Python using the same
> > interpreter. I get a fatal erro
Is this the correct way to slice the last 4 items from a list?
x = [1,2,3,4,5,6,7,8,9]
print x[-4:]
It works, but is it Pythonic?
--
http://mail.python.org/mailman/listinfo/python-list
yahoo.com> writes:
> Looks like ( from PyThreadStage_Get error ) that you lost the GIL. You
> probably
> entered some C++ code and encapsulated you're work in the
>
> Py_BEGIN_ALLOW_THREADS
>
> Py_END_ALLOW_THREADS
>
> but you're is calling back the Python function, and you forgot
> to acqui
I have embedded a single threaded instance of the Python interpreter in my
application.
I have a place where I execute a Python command that calls into C++ code which
then in turn calls back into Python using the same interpreter. I get a fatal
error which is "PyThreadStage_Get: no current thread.
1 - 100 of 195 matches
Mail list logo