Where can I find the code...
I have checked starship, "the vaults" and googled for a long time. either
they point to starshup(wiki) where it doesn't exists, or to dead links.
Any help would be much appreciated.
TIA
--
http://mail.python.org/mailman/listinfo/python-list
has anyone successfully installed PyGeo under python 2.7 (prefer ubuntu
10.04) ,
the site says
http://www.wspiegel.de/pymaxima/index_en.html
"Note: The installation of PyGeo work's only under Python 2.4 (The
further development of pygeo seems to be stopped)"
is this to do with re-org of sit
On 30/08/10 05:00, Thomas Jollans wrote:
On Sunday 29 August 2010, it occurred to L to exclaim:
has anyone successfully installed PyGeo under python 2.7 (prefer ubuntu
10.04) ,
the site says
http://www.wspiegel.de/pymaxima/index_en.html
"Note: The installation of PyGeo work
On 30/08/10 18:59, Thomas Jollans wrote:
On Monday 30 August 2010, it occurred to L to exclaim:
I have tried it and as soon as you try any of the examples in the
examples dir it cannot find numpy etc
I have manually move the pygeo dirs and contents to
/usr/lib/python2.6/dis-packages
Hi all,
I'm interning and have been given the job of extending a program that has been
written by someone else. I've never used Python before so it's a bit of a
struggle but I've got to say I'm loving the language so far.
In on of the scripts there is
def set_usage(self,s):
self.usage_str = s
On Tuesday, 9 July 2013 18:03:41 UTC+1, L O'Shea wrote:
> Hi all,
>
> I'm interning and have been given the job of extending a program that has
> been written by someone else. I've never used Python before so it's a bit of
> a struggle but I've g
Hi all,
I've been asked to take over a project from someone else and to extend the
functionality of this. The project is written in Python which I haven't had any
real experience with (although I do really like it) so I've spent the last week
or two settling in, trying to get my head around Pyth
27;}
need help to correct the below regex
(?P(date=(?P[^\s]+))\s+(time=(?P[^\s]+)))"
so that It will have : 'datetime': '2012-11-28 21:14:59' instead of
'datetime': 'date=2012-11-28 time=21:14:59'
any help would be greatly appreciated
Thanks
Mohan L
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Jul 16, 2013 at 2:12 PM, Joshua Landau wrote:
> On 16 July 2013 07:55, Mohan L wrote:
> >
> > Dear All,
> >
> > Here is my script :
> >
> > #!/usr/bin/python
> > import re
> >
> > # A string.
> > logs = "dat
Hello everyone,
We are trying to implement our own interactive interpreter in our
applicationusing an embedded Python interpreter.
I was wondering what would be the best way to retreive as text the result of
executing Python code. The text must be exactly the same as it would be in
thestand
> Is the `code` module (http://docs.python.org/library/code.html) an
> insufficiently exact copy of an interpreter for you?
The problem isn't really to emulate the behavior of the interpreter as to
obtain the result of the execution as a string in c++. The code module doesn't
seem to help with
> If you use the same workflow as you do currently, it won't
You're right it shouldn't cause a blocking call.
> Come to think of it, you might as well just use StringIO.
Yes I could probably replace std{in, out, err} with stringIO objects and
retrieve their contents throughthe api.
I'll look into
See here for a workaround: https://bugs.launchpad.net/ipython/+bug/290228
First result on Google for the query "ipython emacs windows", BTW.
On May 17, 3:00 am, rusi wrote:
> If I use ipython under emacs on linux it works (at least basic REPL)
> ie I can type an expression and I get a result fol
Hi,
I have a app loading python35.dll. Use python API PyImport_AddModule
to run a py file. And use PyDict_DelItemString to delete the module.
There is a global vailable in the py file. The global variable is not
destroyed when calling PyDict_DelItemString to delete the module. That
cause the memor
Thanks for the replay.
I run this script as __main__ module, this module is removed from
sys.modules, and the ref count becomes 0.
2016-09-20 0:00 GMT+08:00 Chris Angelico :
> On Mon, Sep 19, 2016 at 4:47 PM, dl l wrote:
> > I have a app loading python35.dll. Use python API PyImport_
equires my customers to update their python scripts. That
may make them unhappy :(. Is there a workaround in my code C++ side to call
Python C APIs to resolve the memory leak issue?
2016-09-20 13:49 GMT+08:00 Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info>:
> On Monday 19 Septembe
Thank you all for the help.
I found the problem is resolved if call PyGC_Collect() after
PyDict_DelItemString(). Is it expected to call PyGC_Collect() here for
Python 3.5 which is not needed for Python 3.3?
2016-09-20 16:01 GMT+08:00 Chris Angelico :
> On Tue, Sep 20, 2016 at 4:19 PM, d
=
2016-09-21 13:09 GMT+08:00 dieter :
> dl l writes:
> > I found the problem is resolved if call PyGC_Collect() after
> > PyDict_DelItemString(). Is it expected to call PyGC_Collect() here for
> > Python 3.5 which is not needed for Python 3.3?
>
> Usually, Python use
I want to check the references of an object. Any way to get the references
of an object with Python C API? Like: gc.get_referrs(), is there similar
API in C lib?
--
https://mail.python.org/mailman/listinfo/python-list
Thanks for reply. Is there any function in C to get the reference objects
of a object? I want to debug where are referencing the object.
2016-09-27 15:01 GMT+08:00 dieter :
> dl l writes:
> > I want to check the references of an object. Any way to get the
> references
> >
What is the difference between PyImport_AddModule and PyImport_Import?
When need to use PyImport_AddModule?
When need to use PyImport_Import?
--
https://mail.python.org/mailman/listinfo/python-list
Thanks. That's helpful. I did not notice the note.
2016-09-27 19:24 GMT+08:00 Ned Batchelder :
> On Tuesday, September 27, 2016 at 3:54:01 AM UTC-4, dl l wrote:
> > What is the difference between PyImport_AddModule and PyImport_Import?
> >
> > When need to use PyImpo
When I debug in C++, I see the reference count of a PyObject is 1. I don't
know where is referencing this object. How can I find out where is
referencing this object?
2016-09-27 15:47 GMT+08:00 dl l :
> Thanks for reply. Is there any function in C to get the reference objects
> of
Hi All,
I am using the bellow script to watch directories. Using 20 seconds to
aggregate together a larger chunk of events and enabled coalescing of
events.
I wanted to send an email notification with content of logfile after 15
mins on any change. The idea is I want to send only one mail for ch
:
devicename1 10
devicename2 11
devicename3 12
I spend quit some time still not able to figure out how to parse. Can some
one through some light on how to phrase it.
--
Thanks & Regards
Mohan L
--
https://mail.python.org/mailman/listinfo/python-list
Hi All,
Please ignore it, I was able to figure out it.
for dev in devlist:
print (dev.name, dev.id)
--
Thanks & Regards
Mohan L
On Fri, Sep 27, 2019 at 8:41 PM Mohan L wrote:
> Hi All,
>
> I am using get_devices_list method from this module:
> https://github.com/
Jeff Schwab wrote:
> [EMAIL PROTECTED] wrote:
> > Jeff Schwab wrote:
> >
> >>What's the best way to generate a sequence of characters in Python? I'm
> >>looking for something like this Perl code: 'a' .. 'z' .
> >
> >
> import string
> >
> >
> print string.ascii_lowercase
> >
> > abcdefghi
I am trying this out, parts of it are direct from the Python 2.4
manual.
//--- icallbk.c
#include "Python.h"
PyObject *fcallback = NULL;
static PyObject*
call_func(PyObject* self, PyObject* args)
{
PyObject *result;
PyObject *arglist;
int arg = 123;
arglist = Py_BuildValue("(i)",
[EMAIL PROTECTED] wrote:
> Hi,
>
> I am wondering how this is evaluated.
>
> a=(x for x in [1,2,3,4])
> p=[4,5]
>
> c=[x for x in p if x in list(a)]
>
> c is []
>
> but if I expand a first, like a = list(a)
>
> c is [4]
>
> So it seems that the "if" part don't get expanded ?
Well, for every elemen
http://www.python.org/doc/2.4.2/lib/built-in-funcs.html
or, if you want an answer in code now and don't want to read the docs
def my_import(name):
module = __import__(name)
globals()[name] = module #not a good idea
Or, seeing as how you won't be directly accessing them by name, anyways
Sam Pointon wrote:
> On the second point, a combination of sys.path, os.listdir and
> __import__ should do what you're after, although sifting through the
> whole of sys.path and subfolders from Python, rather than the
> interpreter itself, could be slow. (And it'll be redundant as well -
> __imp
[EMAIL PROTECTED] wrote:
> What is the cheapest/affordable pocket device that I can code python
> on? I think the closest I have seen is pocketpc from this page:
>
> http://www.murkworks.com/Research/Python/PocketPCPython/Overview
I would not recommend trying to code on a handheld device. Small s
I am writing a web application that is comparable to a content
management system used in blogging. I really want to use Python after
having done some evaluation coding using Python 2.3.5 with mod_python
3.1.4 running on Apache 2.0 with the Publisher handler.
However, I am still very hesitant to
Gustav Hållberg wrote:
> I tried finding a discussion around adding the possibility to have
> optional underscores inside numbers in Python. This is a popular option
> available in several "competing" scripting langauges, that I would love
> to see in Python.
>
> Examples:
> 1_234_567
> 0xdead_
In article <[EMAIL PROTECTED]>,
"Ben Sizer" <[EMAIL PROTECTED]> wrote:
> Anthony L. wrote:
> > 1. I want to use CGI through Publisher handler, instead of CGI handler
> > or PSP. Despite the speed increase mod_python gives me, there is a
> > proble
In article <[EMAIL PROTECTED]>,
Francois Lepoutre <[EMAIL PROTECTED]> wrote:
> > 3. I am not very attracted to PSP because I want to separate the logic
> > from the presentation as completely as possible [...]
>
> In view of your project why not consider cherrypy as well? It may
> be an alte
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (John J. Lee) wrote:
> "Ben Sizer" <[EMAIL PROTECTED]> writes:
> [...]
> > It as not easy to work with the CGI-style code in a WYSIWYG web editor
> > as it is to edit a template, which is probably the main reason for
> > their use. Also, coding ev
Peter A. Schott wrote:
> Per subject - I realize I can copy/paste a line at a time into an interactive
> session when I'm trying to debug, but was wondering if there is any tool out
> there that allows me to copy sections of working Python scripts to paste into
> my
> interactive console and let
Peter A. Schott wrote:
> OK - I justed tested and may be doing something wrong, but it didn't work
> when I
> just tried it.
>
> I have something like this:
>
> X = "Value1"
> Y = "Value2"
> Z = "Value3"
>
> etc at the top of my script. When I copy/paste those three lines all at once
> into IDLE'
Terry Hancock wrote:
> I recently saw a claim that Mozilla XUL behaviors (normally
> scripted in Javascript) can (or perhaps will) be scriptable
> in Python.
>
> Also, "other languages such as Java or Python are supported
> through XPCOM", said about Mozilla (from Luxor website).
>
> Yes, I know se
ex_ottoyuhr wrote:
> To start with, I'm new at Python, so if this is something relatively
> ordinary or a symptom of thinking in C++, I apologize...
>
> Anyhow, I'm currently trying to write a means of generating
> genetic-programming functions in Python; the details would be a little
> much for a
I don't have any problems with spaces in the folders.
just for debugging, you could probably try os.system(CMD.replace("\\", "/")
On 3 Dec 2005 19:16:10 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I am trying to run an exe within a python script, but I'm having
> trouble with spaces in
ProvoWallis wrote:
> Thanks so much. I never would have been able to figure this out on my
> own.
>
> def dictionary_join(one, two):
>
> dict2x = dict( ((dict2[k], k) for k in dict2.iterkeys()))
> dict3 = dict(((k, dict2x[v]) for k,v in dict1.iteritems()))
> print dict3
>
> dict1 =
Steve Holden wrote:
> [EMAIL PROTECTED] wrote:
> > "Gary Herron" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>--snip--
> >>So just use a def. It is constantly pointed out on
> >>this list that the lambda provides no extra expressive power, it is
> >>merely a shortcut
> >
*** WARNING **
Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado
un fichero anexo(s) infectado(s). Por favor revise el reporte de abajo.
AttachmentVirus name Action taken
---
I wasn't aware that python supported "if then else".
--
http://mail.python.org/mailman/listinfo/python-list
Why overload when you can use class methods?
--
http://mail.python.org/mailman/listinfo/python-list
But by using the builtin reduce, you need to specify a function, which
probably slows it down more than any speed-up from the loop in C.
--
http://mail.python.org/mailman/listinfo/python-list
To recognize variables that you have assigned, just look for
assignment. If your code is readible, and you know it well, you
shouldn't need the $ sign in front of everything.
--
http://mail.python.org/mailman/listinfo/python-list
< "return a if a.value == true"
< "database.query(q) unless database.connect == error
(etc)
if a.value == True:
return a
if not database.connect == error:
database.query(q)
Trading two words for one word doesn't necessarily make the code
better.
< unless false then print 1 # this prints
password = raw_input("Type in the password, please: ")
while password != "hello":
print "Incorrect password!"
Wouldn't this print "Incorrect password" untill the end of time if you
didn't supply the correct password?
--
http://mail.python.org/mailman/listinfo/python-list
re.findall(r'"?(.+?)"?(?:,|$)', yourtexthere)
--
http://mail.python.org/mailman/listinfo/python-list
Oh, oops, sorry, that code doesn't respect the quotes.
Use this code:
re.findall(r'(".+?"|\S+)(?:,|$)', yourtexthere)
--
http://mail.python.org/mailman/listinfo/python-list
import random
flips = 100
results = [random.randint(0,1) for i in range(flips)]
heads = results.count(0)
tails = results.count(1)
print "Heads:%s" % heads
print "Tails:%s" % tails
I think this is more compact.
--
http://mail.python.org/mailman/listinfo/python-list
Thats like posting about Google here because the newsgroup is hosted on
Google.
--
http://mail.python.org/mailman/listinfo/python-list
Python for everything except things that need to be ridiculously
optimized for speed. Thats what C embedded in Python and Psyco enhanced
Python code is for.
Oh wait, thats still all Python...
--
http://mail.python.org/mailman/listinfo/python-list
Why make it an instance attribute? Couldn't you just look at the class
attribute? If its something that depends on each instance's value
assigned to the attribute, why not make it an instance attribute to
start with?
--
http://mail.python.org/mailman/listinfo/python-list
The code module, perhaps?
http://www.python.org/doc/2.4.1/lib/module-code.html
--
http://mail.python.org/mailman/listinfo/python-list
Try this.
re.findall(r'(.+? \(.+?\))(?:,|$)',yourtexthere)
--
http://mail.python.org/mailman/listinfo/python-list
Oops, the above code doesn't quite work. Use this one instead.
re.findall(r'(.+? (?:\(.+?\))?)(?:,|$)',yourtexthere)
--
http://mail.python.org/mailman/listinfo/python-list
One line solution.
dict(re.findall(r"'(.+?)' \| '(.+?)'(?:\s\||$)",yourtexthere))
--
http://mail.python.org/mailman/listinfo/python-list
re.replace.
I don't think there's any way to avoid it. Except maybe having an alias
email address or a fake one.
--
http://mail.python.org/mailman/listinfo/python-list
None of them are really indispensible. Map and filter cab be replaced
with list comprehensions. reduce is redundant except when multiplying a
series; there's a sum function for a reason. Lambda looks cleaner in
some cases, but you don't gain any functionality.
What really struck me, though, is the
Hrm, thought it had one. Guess it would help if I actually used regular
expression for replacement.
--
http://mail.python.org/mailman/listinfo/python-list
Well, I've never heard of a method like that for assigning variables.
I'd rather put it in the __init__ method.
--
http://mail.python.org/mailman/listinfo/python-list
With the exception of reduce(lambda x,y:x*y, sequence), reduce can be
replaced with sum, and Guido wants to add a product function.
--
http://mail.python.org/mailman/listinfo/python-list
Claiming that sum etc. do the same job is the whimper of
someone who doesn't want to openly disagree with Guido.
Could you give an example where sum cannot do the job(besides the
previously mentioned product situation?
Also, map is easily replaced.
map(f1, sequence) == [f1(element) for element i
sum(sequence[0] + [1/element for element in sequence[1:]])
I think that should work.
--
http://mail.python.org/mailman/listinfo/python-list
Okay, maybe that was too restrictive, reduce can *usually* be replaced
with sum. Sorry about that.
--
http://mail.python.org/mailman/listinfo/python-list
def flatten(iterable):
if not hasattr(iterable, '__iter__'):
return [iterable]
return sum([flatten(element) for element in iterable],[])
Recursion makes things so much shorter.
--
http://mail.python.org/mailman/listinfo/python-list
> Here's a couple of examples from my own code:
>
> # from a Banzhaf Power Index calculator
> # adds things that aren't numbers
> return reduce(operator.add,
> (VoteDistributionTable({0: 1, v: 1}) for v in electoral_votes))
return sum([VoteDistributionTable({0:1, v:1} for v in
electoral_votes]
List comprehensions are faster than generator comprehensions for
iterating over smaller sequences.
--
http://mail.python.org/mailman/listinfo/python-list
>>> import timeit
>>> t1 = timeit.Timer('list(i for i in xrange(10))')
>>> t1.timeit()
27.267753024476576
>>> t2 = timeit.Timer('[i for i in xrange(10)]')
>>> t2.timeit()
15.050426800054197
>>> t3 = timeit.Timer('list(i for i in xrange(100))')
>>> t3.timeit()
117.61078097914682
>>> t4 = timeit.Time
Take some time to learn one of the web frameworks. If your host doesn't
already have it, ask your host if they would consider adding it.
--
http://mail.python.org/mailman/listinfo/python-list
I see a total of 12 posts and 8 users.
--
http://mail.python.org/mailman/listinfo/python-list
Use raw_input instead. It returns a string of whatever was typed. Input
expects a valid python expression.
--
http://mail.python.org/mailman/listinfo/python-list
import re
name = "Robert"
f = file('phonebook.txt','r')
lines = [line.rstrip("\n") for line in f.readlines()]
pat = re.compile(name, re.I)
related_lines = [line for line in lines if pat.search(line)]
And then you write the lines in related_lines to a file. I don't really
write text to files much s
How is this different from a nested function?
--
http://mail.python.org/mailman/listinfo/python-list
I think you need to get a database. Anyways, if anything, it should
create no more than 5,000 files, since 5,000 facts shouldn't talk about
30,000 animals. There have been a few discussions about looking at
files in directories though, if you want to look at those.
--
http://mail.python.org/mailm
Oh, I seem to have missed the part saying 'or other word'. Are you
doing this for every single word in the file?
--
http://mail.python.org/mailman/listinfo/python-list
Well, the string that gets passed is more or less a function
definition, which is then called with exec. I don't see why you'd need
to write a string out with the function definition and then call it.
You could just write the function.
As for the nested functions, I had been presuming that it was
import math
class Vector:
def __init__(self, coordinates):
self.coordinates = coordinates
self.magnitude = sum([c**2 for c in coordinates])**0.5
self.direction = getangle(Vector([1]+[0 for i in
range(len(coordinates)-1)]))
def dotproduct(self, vector):
sum([a
> You missed Steven's point which is to quote the message to which you are
> replying. Not everyone is reading this list in a conveniently threaded
> form, so you need to provide some context for them to be able to follow
> along.
Ah, sorry, I didn't quite get what he was referring to.
--
http:/
Why doesn't group have an argument? group() or group(0) returns what
the pattern matched, not what it returns.
--
http://mail.python.org/mailman/listinfo/python-list
teoryn wrote:
> I've been spending today learning python and as an exercise I've ported
> a program I wrote in java that unscrambles a word. Before describing
> the problem, here's the code:
>
> *--beginning of file--*
> #!/usr/bin/python
> # Filename: unscram.py
>
> def sort_string(word):
>
Robert Kern wrote:
> That's definitely not the kind of dictionary that he wants.
>
> --
> Robert Kern
> [EMAIL PROTECTED]
>
> "In the fields of hell where the grass grows high
> Are the graves of dreams allowed to die."
>-- Richard Harter
Oh, I missed the part where he put values in a list
Robert Maas, see http://tinyurl.com/uh3t wrote:
> > From: Robert Kern <[EMAIL PROTECTED]>
> > As you can see in the datetime documentation, the module was introduced
> > in Python 2.3. I recommend updating your Python installation.
>
> What do you mean "your"?? I don't have any Python installatio
flyaflya wrote:
> I want to join some surfaces to a new big surface with alpha cannel, I want
> the new surface has same pixels(inclue r,g,b and alpha value) as the pixels
> on the source surfaces.
> my code as follow:
>
> surf = pygame.Surface((200,200))
> surf.blit(surf1, (0,0))
> surf.blit(su
Sounds somewhat like homework. So I won't just give you a code
solution. Use the regular expression(re) module to match the urls.
--
http://mail.python.org/mailman/listinfo/python-list
Ed Leafe wrote:
> On Sunday 31 July 2005 22:39, Paul Rubin wrote:
>
> > > import dabo
> > > app = dabo.dApp()
> > > dApp.start()
> > >
> > > Sorry, I couldn't do it in 5. ;-) Oh, and that includes a full menu,
> > > too.
> >
> > I get an ImportError exception when I try that. Any suggestions? N
Eric wrote:
> I am reading a book on Python and ran across and exercise that I just
> can't seem to figure out. Its pretty simple, but I just can't get
> past a certain point.
>
> The task is to create a program that flips a coin 100 times and keeps
> track of the total of heads and tails which is
a report out that the "scripting languages" in general are
> losing mindshare big time in Europe, Africa and the east in general.
> In fact, everywhere except in North America. I'm generally somewhat
> skeptical of these reports unless I can see the methodology, but it
googleboy wrote:
> for key in form.keys():Yes, I know which fields are hidden because I
> made them that way, but I am trying to figure out a way I can iterate
> over the fields and do one thing with hidden fields (assign them to
> variables that tell the form how to process) and a different th
Harlin Seritt wrote:
> I have been looking at the Python re module and have been trying to
> make sense of a simple function that I'd like to do. However, no amount
> of reading or googling has helped me with this. Forgive my
> stone-headedness. I have done this with .NET and Java in the past but
>
Ksenia Marasanova wrote:
> Hi,
>
> I have a list that contains nodes from a tree. Each node is a class
> instance, but I'll use dictionary here to simplify the example.
> So the list looks like this:
> [
> {'id': 1,
> 'name': 'Parent node',
> 'ord_number': 1,
> 'parent_id': 0,
> 'url': '/parentnod
John Machin wrote:
> Aahz wrote:
> > In article <[EMAIL PROTECTED]>,
> > John Machin <[EMAIL PROTECTED]> wrote:
> >
> >>Search for r'^something' can never be better/faster than match for
> >>r'something', and with a dopey implementation of search [which Python's
> >>re is NOT] it could be much wor
John Machin wrote:
> Devan L wrote:
> > John Machin wrote:
> >
> >>Aahz wrote:
> >>
> >>>In article <[EMAIL PROTECTED]>,
> >>>John Machin <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>>
Fausto Arinos Barbuto wrote:
> Ray wrote:
>
> > 1. Where are the access specifiers? (public, protected, private)
>
> AFAIK, there is not such a thing in Python.
>
> ---Fausto
Well, technically you can use _attribute to mangle it, but technically
speaking, there are no public, protected, or pr
def descend(iterable):
if hasattr(iterable, '__iter__'):
for element in iterable:
descend(element)
else:
do_something(iterable)
This will just do_something(object) to anything that is not an
iterable. Only use it if all of your nested structures are of the same
Talin wrote:
> I want to make a dictionary that acts like a class, in other words,
> supports inheritance: If you attempt to find a key that isn't present,
> it searches a "base" dictionary, which in turn searches its base, and so on.
>
> Now, I realize its fairly trivial to code something like thi
1 - 100 of 618 matches
Mail list logo