>> If an OS was to be written in Python and the hardware optimized for
>> it, what changes would be made to the hardware to accomodate Python
>> strenghs and weaknesses?
I'm no expert, but this would seem like a good example of something
that python wasn't good for. I have always wondered, thoug
>> Aaron Brady wrote:
>>
>>> while 1:
>>>calculate_stuff( )
>>>if stuff < 0.5:
>>>break
>>
>> The thought police will come and get you.
Based on Aaron's previous posting history, I suspect this was a joke.
--
http://mail.python.org/mailman/listinfo/python-list
>> I (again) wonder what's the perfect way to store, OS-independent,
>> filepaths ?
I'm in agreement that perfect probably isn't applicable. If I were
doing this myself, I might store the information in a tuple:
base = 'some root structure ('/' or 'C')
path = ['some','set','of','path','names']
f
On Mon, Oct 20, 2008 at 3:52 AM, olive <[EMAIL PROTECTED]> wrote:
>>
>> Certification prooves you're an idiot who needs to spend money to work
>> for another idiot who doesn't know enough about programming to know if
>> they hire competent programmers and need an idiot paper to make them
>> feel be
> I am trying to use pymssql, and have an issue where by the execute
> (not the fetch) is appearing to load all records into memory.
>
> if I execute
>
> con = pymssql.connect(...)
> cur = con.cursor()
> cur.execute(sql)
> rec = cur.fetchone()
>
> if I put in a query which returns a lot of records
> Given the way that medical/legal licensing is used to stifle competition,
> prevent innovation, and keep people from earning a living delivering simple
> services that people need at prices they can afford, 'more like' would have
> to be done very carefully.
To draw an analogy... imagine, if you
> I would hate to live in a world where you had to have three years of
> graduate professional training to write a for-loop for pay, or where
> scientists and mathematicians were prohibited from writing code (practicing
> software) without a license. Or where someone who just wanted to practice
>
> Do you really think there are Linux or Mac systems with a C: drive?
>
> This whole question is based on the ludicrous assumption that general
> file system paths can be platform-independent. That's a bit like trying
> to write code that is programming language-independent.
That's sort of where
> To be exact, I used the words "engine/library", not "a whole framework".
> Thanks for the link, I've googled for articles and recipes myself and
> as I said, I more or less know what to do - I just thought it might be
> a good idea to ask whether perhaps the wheel has already been invented.
> App
I tend to deal with dates a lot in different formats and places...
typically I'll convert them to a time tuple with strptime(), and pass
them around like that before I need to write them back out.
One set of time/dates I'm getting are in UTC, but the string doesn't
say that specifically. So I do
at 12:23 PM, Eric Wertman <[EMAIL PROTECTED]> wrote:
> I tend to deal with dates a lot in different formats and places...
> typically I'll convert them to a time tuple with strptime(), and pass
> them around like that before I need to write them back out.
>
> One set of ti
> if python is such a good programming/scripting language, why can't they
> build a faster interpreter/compiler engine? and beat php and zend.
> to the python team, rebuild your interpreter!
while this is just a boring troll.. it does bring me to a more
interesting point... it would be cool if the
>I can't relate to anyone that want to oppose a change that would give
>more freedom to a programmer.
While in general I agree with this.. I think in the case of python
part of it's base philosophy seems to be a tendency to encourage a
single way of doing things, and create a path of least resista
Flaming Thunder is teh awesome! :P
--
http://mail.python.org/mailman/listinfo/python-list
So I'm working on some file parsing and building up a stack of regular
expressions that I need to use. I was thinking of dropping them in an
external module. I was wondering.. if I put them in a file called
regex.py like so :
import re
re1 = "..
re2 = "..
and then do:
rgx1 = re.compile(re1)
r
Flaming Thunder FTW!!!
thank you, I'm here all week.
--
http://mail.python.org/mailman/listinfo/python-list
> The number of nodes is very large: millions for sure, maybe tens
> of millions. If considering (2), take note of my BOLD text above, which
> means I can't remove nodes as I iterate through them in the main loop.
Since your use of 'node' is pretty vague and I don't have a good sense
of what test
I do this, mabye a no-no?
import os
for root,dirs,files in os.walk(dir) : break
--
http://mail.python.org/mailman/listinfo/python-list
In your case you could also use the os.environ dictionary:
import os
print os.environ['USER']
--
http://mail.python.org/mailman/listinfo/python-list
I tend to use the re module like so :
import re
my_string = re.sub('[\-,./]','',my_string)
> I wish to replace several characters in my string to only one.
> Example, "-", "." and "/" to nothing ""
> I did like that:
> my_string = my_string.replace("-", "").replace(".", "").replace("/",
> "").rep
I was considering putting together a proposal for an alternate block
syntax for python, and I figured I'd post it here and see what the
general reactions are. I did some searching, and while I found a lot
of tab vs space debates, I didn't see anything like what I'm thinking
of, so forgive me if th
> Look into any of the dozen Python-based template engines that are
> typically used for such tasks; they offer many more features than a
> way to indent blocks.
>
> George
I definitely will.. could you throw out some examples though?
Thanks!
Eric
--
http://mail.python.org/mailman/listinfo/pyth
On Apr 20, 1:29 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Sun, 20 Apr 2008 13:42:05 -0300, Matthew Woodcraft <[EMAIL PROTECTED]>
> escribió:
>
> > An alternative scheme for describing the block structure could be
> > useful in other cases, though. For example, if you wanted to suppor
I have a set of files with this kind of content (it's dumped from WebSphere):
[propertySet "[[resourceProperties "[[[description "This is a required
property. This is an actual database name, and its not the locally
catalogued database name. The Universal JDBC Driver does not rely on
information c
r printable characters. I'm
not sure if I can just use that, without worrying about it?
At any rate, thumbs up on the parser! Definitely going to add to my toolbox.
On Thu, Apr 24, 2008 at 8:19 AM, Mark Wooding <[EMAIL PROTECTED]> wrote:
>
> Eric Wertman <[EMAIL PROTECTED]>
> I would discourage you from using printables, since it also includes
> '[', ']', and '"', which are significant to other elements of the
> parser (but you could create your own variable initialized with
> printables, and then use replace("[","") etc. to strip out the
> offending characters).
> > A simple yet dangerous and rather rubbish solution (possibly more of a
> > hack than a real implementation) could be achieved by using a
> > technique described above:
> >
> > > echo exec('python foo.py');
>
> This will spawn a Python interpreter, and not be particularly
> effi
> Python Programmer" and have been trying to write a script that checks
> 'words.txt' for parameters (letters) given. The problem that is the i
> can only get results for the exact sequence of parameter 'letters'.
The "re" module comes to mind:
text = open('words.txt','r').read()
letters = 's
> Is the way I wrote the function inherently wrong? What I wrote
I would not say that. I think a lot of people probably start off like
that with python. You'll find in most cases that manually keeping
counters isn't necessary. If you really want to learn python though,
I would suggest using b
On Sat, Apr 26, 2008 at 7:50 PM, <[EMAIL PROTECTED]> wrote:
> ok.. I finally made something that works.. Please let me know what you
> think:
>
> >>> def lines(letters):
> fin = open('words.txt')
> count = 0
> rescount = 0 # count the number of results
> results
HI, that does look like a lot of fun... You might consider breaking
that into 2 separate programs. Write one that's threaded to keep a db
updated properly, and write a completely separate one to handle
displaying data from your db. This would allow you to later change or
add a web interface witho
You should check out the sets module:
http://docs.python.org/lib/module-sets.html
>
> The problem asks to create a "compareandremove" so that you can use it on a
> string, to remove the words from the string that are contained in un_words.
>
> The remaining words then need to be compared to
chuck in a jsfile.close(). The buffer isn't flushing with what you
are doing now. jsfile.flush() might work... not sure. Closing and
re-opening the file for sure will help though.
On Tue, Apr 29, 2008 at 1:26 AM, Kevin K <[EMAIL PROTECTED]> wrote:
> Hey everyone, I'm new to python and am trying
Try to ftp it in ascii mode, or find a dos2unix utility .. the file
has probably got \r\n (windows) line terminators in it.. causes
problems. I guess it's also possible that /usr/bin/env doesn't
exist... not likely though.
On Tue, Apr 29, 2008 at 1:36 AM, sandipm <[EMAIL PROTECTED]> wrote:
> Hi
I don't know about the best way.. I use this function, it works ok for
me. I have an ssh key stashed already for my user ID, but you could
look at the ssh options and supply one on the command line if you
needed to.
from popen2 import Popen3
def ssh(host,command) :
''' Wraps ssh commands '''
Something like this. I'm sure there are other ways to do it.
import re
def addspace(m) :
return ' ' + m.group(0)
strng = "ModeCommand"
newstr = re.sub('[A-Z]',addspace,strng)
print newstr.strip()
On Thu, May 8, 2008 at 9:12 PM, John Schroeder <[EMAIL PROTECTED]> wrote:
> I have a
I have a machine (PLC) that is dumping its test results into a fixed-
length text file.
While it has nothing to do with python, I found that creating a MySQL
table with the proper fixed length char() fields and using 'load data
infile' was the easiest way to deal with that sort of scenario. T
Sorry, didn't get to finish my script. Have to figure out the deal
with gmail and the tab key someday.
myfile = '/somewhere/somefile.txt'
sizes = [16,4,8,8,8]
fd = open(myfile,r)
data = []
for line in fd.readlines() :
a = []
idx1 = 0
for l in sizes :
idx2 = idx1 + l
I also like to use escaped identifiers in cases like this:
sql = "select tID,tNote from %s where %s = %%s" % ("tmp","tID")
cursor.execute(sql,1)
should work fine.
--
http://mail.python.org/mailman/listinfo/python-list
Just to make sure I understand what you are showing me here:
> columns = ('tID', 'tNote')
> table_name = 'tmp'
> sql = 'select %s from %s where tID=:1' % ( ', '.join(columns), table_name)
> cursor.execute(sql, (1,))
>
> # sql is now 'select tID, tNote from tmp where tID=:1'
> # note the comma in a
I would also be interested in anything anyone can offer. I spend some
time looking around, and took a fair stab at using the wsdl2py that
comes with The ZSI package. Ultimately I couldn't get anything to
work, and reverted to using perl (yuk).
I'm interested mostly in interrogating the ESX serve
So what exactly does that do? Returns a generator, instead of a list?
> I'm waiting for a str.xsplit still :-)
> If I write and submit a C implementation of xsplit how many chances do
> I have to see it included into Python? :-)
>
> Bye,
> bearophile
> --
> http://mail.python.org/mailman/listinf
I'm not sure about the environment variable, but os.uname() should
give you what you need otherwise.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Aug 18, 2008 at 8:50 AM, <[EMAIL PROTECTED]> wrote:
> do the ESX server provide any api's or an interactive session may ?
Yes, there's a seemingly very full-featured API, that's documented here:
http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/index.html
They ha
I've a number of scripts set up that require a username/password
combination to log in elsewhere. It's gotten to the point where I
need to keep them in a more secure location, instead of just in the
scripts themselves. I did a bit of searching, and haven't come up
with a great way to store passwo
>> Im trying to download a file from a server. But how do I detect EOF ?
Shouldn't this work as well?
f1 = urllib2.urlopen('ftp://username:[EMAIL PROTECTED]/data.zip')
f2 = file("data.zip", "wb")
while f1: # When to stop ?
try :
f2.write(f1.read(1024))
except EOFError :
b
Is the loginout file named loginout.py ? It needs to be for the
import to work. If the import works, you have to refer to those
variables within the right namespace, ie : loginout.url,
loginout.adminlogin, etc.
On Tue, Aug 26, 2008 at 12:46 PM, frankrentef <[EMAIL PROTECTED]> wrote:
> Gree
> I read the PEP8 and the "importing Python Modules" article. However,
> I'm still a little confused on what should the general rules for
> importing modules.
>
> I'm showing what I used in my current project, and will accept your
> advices on how I should change them.
> import module
>
> and then
> I'm trying to find a way to write data to excel cells (or to be more
> specific to an .xls file), let's say for the sake of argument, data
> readen from a file (although it will be calculated in the process).
> I've been searching, but couldn't find any examples which allows that.
The answer wil
> I'm doing some simple file manipulation work and the process gets
> "Killed" everytime I run it. No traceback, no segfault... just the
> word "Killed" in the bash shell and the process ends. The first few
> batch runs would only succeed with one or two files being processed
> (out of 60) before t
Yes sorry, that's a really poorly formed sentence all the way
around... not a dig on xlrd, but a warning to the OP that they may not
find what they are looking for there.
> On Aug 31, 12:57 am, "Eric Wertman" <[EMAIL PROTECTED]> wrote:
>> If you have
>> to in
I think you really want use a relational database of some sort for this.
On Tue, Sep 2, 2008 at 2:02 PM, cnb <[EMAIL PROTECTED]> wrote:
> over 17000 files...
>
> netflixprize.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list
I think Drupy is best library for these task.
On Tue, Sep 2, 2008 at 12:27 PM, Dani <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I want to create a website where new users need to be invited by an existing
> user in order to open an account. Think of it the way Orkut became popular.
>
> I need a library
> Using Python. I found "Dive Into Python" which I will be reading shortly
The title of the book is good advice all by itself. Especially with
prior programming experience, you'll get started very quickly. What
will take longer is the assimilation of some of python's neater and
more idiomatic
> I'm concerned about the formatting of the string in that I do not want the
> way I split the string up in source code to affect the way the string is
> displayed to the console. In other words, in source, if I break up a single
> string into multiple lines (using carriage returns), I would expect
+1 Bot
--
http://mail.python.org/mailman/listinfo/python-list
> Perhaps the wrong idea of what the group is. I would have thought
> that
> if one had a sufficiently developed idea and wanted to have it /
> formally/
> rejected, rather than merely sniped at, then writting a PEP would be
> more
> apposite than posting to c.l.py.
>
> It's fine to post your not
> I'm a reasonably experienced in other languages and have just decided to
> get my feet wet with Python. But I'm using FC6 which has v2.4.4 installed,
> is this good enough to start out with or am I likely to encounter bugs that
> have been fixed in later versions.
I'm sure there will be other op
I've been growing a library of my own functions, that use the names of
unix commands. They are just conveniences, of course, but I'd suggest
the same for sysadmins, it's handy.
--
http://mail.python.org/mailman/listinfo/python-list
Sorry if this is misplaced, but I could have sworn I saw a link on
this list to a package that would auto-generate data entry type forms
from a database schema, similar to django's auto-admin interface.
Does anyone recall a package like that? I did some searching, but
I've only found documentatio
> Perhaps are you talking about dabo ?
> http://www.dabodev.com
Yes, that was it. Thanks! I was a little dissapointed to see that
the wikipedia entry for that software was deleted. Is dabo not widely
used?
--
http://mail.python.org/mailman/listinfo/python-list
61 matches
Mail list logo