On 2008-04-23, Mark Wooding <[EMAIL PROTECTED]> wrote:
> Python is actually one of the few to define one but not the other. (The
> other one I can think of is Acorn's BBC BASIC, for whatever that's
> worth; it too lacks `++'.)
You should've added it in Termite Basic then :-p
--
http://mail.python
On 2008-04-25, David <[EMAIL PROTECTED]> wrote:
> Another note: 'expires' is apprantly a legacy attribute for early
> Netscape browsers. The RFC and python source comments suggest that you
> use 'Max-Age' instead.
Theoretically, yes. In practice, no. *Nobody* uses the new-style
cookies, everyone u
On 2008-04-25, Martin v. Löwis <[EMAIL PROTECTED]> wrote:
> None is smaller than anything.
According to Tim Peters, this is not true.
See http://bugs.python.org/issue1673405
--
http://mail.python.org/mailman/listinfo/python-list
On 2008-04-27, Martin v. Löwis <[EMAIL PROTECTED]> wrote:
>> sorry for bringing up such an old thread, but this seems important to me
>> -- up to now, there are thousands [1] of python programs that use
>> hardcoded time calculations.
>
> Would you like to work on a patch?
Last time I brought up
On 2008-04-27, Martin v. Löwis <[EMAIL PROTECTED]> wrote:
>> Last time I brought up this sort of thing, it seemed fairly unanimous
>> that the shortcomings of the datetime module were 'deliberate' and
>> would not be fixed, patch or no patch.
>
> Ok, so then if the answer to my question is "yes", t
On 2008-04-27, webograph <[EMAIL PROTECTED]> wrote:
> On 2008-04-27 14:18, Jon Ribbens wrote:
>> Yes, that's where it was decided that the datetime module was fine
>> that way it is and must not be changed.
> could you give me some pointers to that discussion?
On 2008-05-01, Ivan Illarionov <[EMAIL PROTECTED]> wrote:
> IMO .ini-like config files are from the stone age. The modern approach is
> to use YAML (http://www.yaml.org).
You mean YAML isn't a joke!? It's so ludicrously overcomplicated,
and so comprehensively and completely fails to achieve its
ors with their measure of "reach" for our site indicates that there
are 58 billion internet users.
So their data are not even order-of-magnitude accurate. The only web analyst
I ever met was an astrophysicist so this does not really surprise me. ;-)
--
Dr Jon D Harrop, Flying Fro
On 2008-05-01, Ivan Illarionov <[EMAIL PROTECTED]> wrote:
> I used XML files before for this purpose and found YAML much easier and
> better suitable for the task.
>
> Please explain why don't like YANL so much?
Because even the examples in the spec itself are unreadable gibberish.
The PyYAML lib
eme and is called the "tail" of a list. For example, in F#:
> time List.tl [1 .. 100];;
Took 0ms
val it : int list = ...
Perhaps the best example I can think of to substantiate your original point
is simple comparison because Mathematica allows:
a < b < c
I wish other languages did.
--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy wrote:
> "Jon Harrop" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> | Perhaps the best example I can think of to substantiate your original
> point
> | is simple comparison because Mathematica allows:
> |
> | a < b < c
>
t should. But catching an exception
> can't be the standard way to stop iterating right?
Given your example, why not just open the file and call .next() on it
to discard the first row, then iterate using for as usual?
hth
Jon
--
http://mail.python.org/mailman/listinfo/python-list
no other way
without supporting information (since each row length is naturally
variable, you can't even use the file size as an indicator).
Something like:
row_count = sum(1 for row in csv.reader( open('filename.csv') ) )
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 27, 12:29 pm, "Simon Brunning" <[EMAIL PROTECTED]>
wrote:
> 2008/8/27 SimonPalmer <[EMAIL PROTECTED]>:
>
> > anyone know how I would find out how many rows are in a csv file?
>
> > I can't find a method which does this on csv.reader.
>
> len(list(csv.reader(open('my.csv'
>
> --
> Cheers,
On Aug 27, 12:48 pm, "Simon Brunning" <[EMAIL PROTECTED]>
wrote:
> 2008/8/27 Jon Clements <[EMAIL PROTECTED]>:
>
> >> len(list(csv.reader(open('my.csv'
> > Not the best of ideas if the row size or number of rows is large!
> > Manufactu
On Aug 27, 12:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
> On Aug 27, 12:50 pm, SimonPalmer <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 27, 12:41 pm, Jon Clements <[EMAIL PROTECTED]> wrote:
>
> > > On Aug 27, 12:29 pm, "Simon Brunning&
probably why I'm
broke!)
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 2, 2:17 pm, Guillermo <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Does anyone know whether this function uses edit distance? If not,
> which algorithm is it using?
>
> Regards,
>
> Guillermo
help(difflib.get_close_matches) will give you your first clue...
--
http://mail.python.org/mailman/list
o create objects, for
instance str(A) returns A's string representation, while A() creates a
new A object...
Work your way through a python tutorial and make sure you understand
the examples and principals... It might take you a while though, so I
hope the assignment's not due soon!
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
3] = [ mydict[k] for k in 'one two two'.split()]
>
> print "%s\n%s\n%s" %(v1,v2,v3)
>
> thanks for any ideas
Another option [note I'm not stating it's preferred, but it would
appear to be closer to some syntax that you'd prefer to use]
>>> from operator import itemgetter
>>> x = { 'one' : 1, 'two' : 2, 'three' : 3 }
>>> itemgetter('one', 'one', 'two')(x)
(1, 1, 2)
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
r at least point me in the right direction), I'd be
> extremely grateful.
What if we view the data as having an 11 byte header:
signature, version, attr_count = struct.unpack('3cII',
yourfile.read(11))
Then for the list of attr's:
for idx in xrange(attr_count):
attr_id, attr_val_len = struct.unpack('II', yourfile.read(8))
attr_val = yourfile.read(attr_val_len)
hth, or gives you a pointer anyway
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On 10 Sep, 18:33, Jon Clements <[EMAIL PROTECTED]> wrote:
> On 10 Sep, 18:14, Aaron Scott <[EMAIL PROTECTED]> wrote:
>
>
>
> > I've been trying to tackle this all morning, and so far I've been
> > completely unsuccessful. I have a binary file that I h
t.calcsize('3sII') expects a 12
byte string, whereby you only really have 11 -- alignment and all
that...
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 10, 7:16 pm, Aaron Scott <[EMAIL PROTECTED]> wrote:
> Taking everything into consideration, my code is now:
>
> import struct
> file = open("test.gde", "rb")
> signature = file.read(3)
> version, attr_count = struct.unpack('II', file.read(8))
> print signature, version, attr_count
> for idx
unindexable
No point it needing to be indexable either.
It's also worth noting that removing an object from a container
(.remove) is different than proposing the object goes to GC (del...)
Have to disagree that del[] on a set makes any sense.
Tired, and it's late, so probably typing rubbish, but felt okay when I
started reading the group :)
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>, Martin v. Löwis wrote:
> In any case, it doesn't matter what encoding the document is in:
> read(2) always returns two bytes.
It returns *up to* two bytes. Sorry to be picky but I think it's
relevant to the topic because it illustrates how it's difficult
to change t
In article <[EMAIL PROTECTED]>, Sullivan WxPyQtKinter wrote:
> Hi,there. Sometimes a python CGI script tries to output great
> quantities of HTML responce or in other cases, it just falls into a
> dead loop. How could my client close that CGI script running on the
> server? I tried to use the STOP
In article <[EMAIL PROTECTED]>, Roy Smith wrote:
> This may even be useful. What if you were trying to emulate SQL's
> NULL? NULL compares false to anything, even itself.
Strictly speaking, comparing NULL to anything gives NULL, not False.
--
http://mail.python.org/mailman/listinfo/python-list
In article <[EMAIL PROTECTED]>, Alex Martelli wrote:
>> I guess in python we use two idioms to cover most of the uses of
>> mulltiple constructors:
>
> ... and classmethods. OK, _three_ idioms. Oh, and factory functions.
> Among the idioms we use are the following...
Nobody expects the Spanglis
;
> Thank You,
> ++imanshu
pychecker returns "test.py:3: No global (o) found" for the above, and
can be found at http://pychecker.sourceforge.net/
There's also pylint and another one whose name I can't remember...
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 27, 9:43 am, n00m wrote:
> > You're missing some sub-strings.
>
> Yes! :)
Of course, if you take '~' literally (len(s) <= -10001) I reckon
you've got way too many :)
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
causes it to do too much work
Can you confirm you get the same results, and maybe post some code?
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
{u'lang': u'pt', u'name': u'Cidade do M\xe9xico'},
> {u'lang': u'scn', u'name': u'Cit\xe0 d\xfb Messicu'},
> {u'lang': u'scn', u'name': u'Cit\xe0 d\xfb M\xe8ssicu'},
> ...
A simple list comprehension should do the trick:
[el['name'] for el in json_data['alternateName'] if el['lang'] ==
'??']
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
("name '%s' is not valid" % name)
setattr(self, name, it)
def __getattr__(self, item):
if item not in self.__names:
raise ValueError("name '%s' not present" % item)
return self.__dict__.get(item, None)
>>> res =
eserves a POTM award !-)
Absolutely -- thumbs up to Grant.
All we need to do is merge in the other bullet points, and put it as a
"How-To-Not-Post-FAQ" :)
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
blem is (quoting Douglas Adams): "I love deadlines. I like the
whooshing sound they make as they fly by."
scipy is extremely useful to have installed, and if you get *really*
into it, then the sage library|system at http://sagemath.org is
*extremely* useful...
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
,4,5], [6,7,8] ])
print x[0:2,:2]
>>> array([[0, 1],
[3, 4]])
Check out http://www.scipy.org/Tentative_NumPy_Tutorial
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
sumfac(45362) -> 872 - ok
> > sumfac(363600) -> 727212 - wrong, should be1454
>
> > Greetings,
> > SiWi.
>
> Oops, found it myself. You can ignote the message above.
You might also find it useful to write generators (esp. for primes and
factorials).
Cheers,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
ter does four moves
> automatically and wins- you can't input anything. If you hit 'y' at
> the beginning prompt, you can play but cannot win. I got three x's in
> a row and it didn't let me win. It just keeps letting
> you input numbers until the computer wins even if you have three in a
> row.
>
> If anyone can help please do asap.
> Thank you!
Someone's homework assignment is overdue/due very soon? And, I don't
believe for a second this is your code. In fact, just searching for
(the obvious Java based) function names leads me to believe you've
'butchered' it from Java code (do you not think your teacher/lecturer
can do the same?).
Someone might well help out, but I'd be surprised if you got a "here's
how to fix it response", as from my POV you haven't done any work.
Of course, I'm occasionally wrong,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 9, 11:53 pm, mattia wrote:
> Hi all, can you provide me a simple code snippet to interrupt the
> execution of my program catching the KeyboardInterrupt signal?
>
> Thanks,
> Mattia
Errr, normally you can just catch the KeyboardInterrupt exception --
is that what you mean?
asdf'}
>>> y.data
{3: 'asfasdf', 4: 'asfasdf'}
As opposed to:
>>> class Blah:
def __init__(self, whatever):
self.data = {}
self.data[whatever] = 'asfasdf'
>>> x = Blah(3)
>>> y = Blah(4)
>>> x.data
{3: 'asfasdf'}
>>> y.data
{4: 'asfasdf'}
>>> Blah.data
Traceback (most recent call last):
File "", line 1, in
Blah.data
AttributeError: class Blah has no attribute 'data'
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
ct[4] = 'adsfasfd' and object[4] syntax...
Or as a getter/setter as per
http://docs.python.org/library/functions.html#property
Or depending on the use case for your class, just inherit from the
built-in dict and get its functionality.
>>> class Test(dict):
def debug(self, wha
tor to group them... take a look at itertools.groupby.
Another is to use a defaultdict(list) found in collections. And just
loop over the rows, again with B, C & D as a key, and A being appended
to the list.
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
>
> ... return 0
> ...>>> d = defaultdict(zero)
> >>> s = ['one', 'two', 'three', 'four', 'two', 'two', 'one']
> >>> for x in s:
>
> ... d[x] += 1
> ...>>>
't!
>
> Get a teddybear, that helps, too. ;-) (I.e. try to explain your
> problem to a teddybear.)
> --
> Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/
You have a bear that likes a Python? The one I have just keeps going
on about Piglet and eati
s. What I am looking for
> > is some hints that help me get out of where I am now.
>
> > Any help is highly appreciated.
>
> > Vicente Soler
>
>
As well as what Steven & Lie have mentioned, maybe you could get
inspiration from http://pyspread.sourceforge.net/
Although I've not looked at it, my gut feeling is the author would've
had to address these issues (take that as a disclaimer of some
sort :) )
>From not having to had a need for this sort of thing, I'd probably go
for a sparse representation as a graph.
But again, depends why you're segmenting the "spreadsheet" from "need
to tell dependencies".
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
), delimiter='\t')
header = dict( (val.strip(),idx) for idx, val in enumerate(next
(csvin)) )
We can use header as a column name->column index lookup eg header
['Open'] == 1
from operator import itemgetter
wanted = ['Open', 'Close'] # Although you'll want to use raw_input and
split on ','
getcols = itemgetter(*[header[col] for col in wanted])
getcols is a helper function that'll return a tuple of the columns in
the requested order...
for row in csvin:
print getcols(row)
Loop over the rest of the file and output the required columns.
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 8, 8:31 pm, J wrote:
> On Fri, Jan 8, 2010 at 13:55, Jon Clements wrote:
> > On Jan 8, 5:59 pm, marlowe wrote:
> >> I am trying to create a table in python from a csv file where I input
> >> which columns I would like to see, and the table only shows those
&g
on_demand was ages ago!).
Make sure all the tools are the latest versions from http://www.python-excel.org
There's also a dedicated Google Group for the xl* products listed on
that page.
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 9, 10:44 am, pp wrote:
> On Jan 9, 3:42 am, Jon Clements wrote:
>
>
>
> > On Jan 9, 10:24 am, pp wrote:
>
> > > Whenever i run the code below I get the following error:
>
> > > AttributeError: 'Book' object has no attribute 'on_de
Might not be useful, but trying open_new_tab() on...
>
> Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
> [GCC 4.3.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>>
> import webbrowser as wb
&
uld tend to go with a web framework (maybe OTT) or a templating
engine, so if you wish, someone can do the CSS/HTML and you just
provide something that says (gimme the last 200 hundred rows). Very
similar to what D'Arcy J.M. Cain has said but should hopefully
formalise the possible problem and be applicable across the project.
Further more you might want to look into AJAX, but ummm, that's a
completely new debate :)
Cheers,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
starting item?
How about a deque of lists... untested
from collections import deque; from itertools import groupby
deq = deque(list(items) for key, items in groupby(sorted(usernames),
lambda L: L[0].upper()))
Then everytime you use deq, rotate it?
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
I would be grateful for any advice about a problem which is preventing me from
using Python for my current project.
I am hoping to use Python 2.6.2 on the server side with Microsoft ASP [not
ASP.NET; version details below]. The behavior I see is:
1. Load very simple page [text below] i
ge (I'm guessing not), or do you come from another
'background'.
Basically, Active is a possible 'superset' of the main distro. of
Python. So, for Windows, for instance, it will offer com objects
etc...
I normally stick with the Python core, then use additional librari
argsSource = self
name = argsSource.initScript
if name is None:
if argsSource.copyDependentFiles:
name = "Console" ()
else:
name = "ConsoleKeepPath"
if sys.version_info[0] >= 3:
name += "3"
argsSource.initScript = self._GetFileName("initscripts", name)
if argsSource.initScript is None:
raise ConfigError("no initscript named %s", name)
Should be sufficient clues(),
Cheers,
Jon
--
http://mail.python.org/mailman/listinfo/python-list
p on this group.
Example follows:
>>> x = range(5)
>>> x = y
>>> print x, y
[1, 2, 3, 4] [1, 2, 3, 4]
>>> x = []
>>> print x, y
[] [1, 2, 3, 4]
>>> x = y
>>> print x, y
[1, 2, 3, 4] [1, 2, 3, 4]
>>> del x[:]
>>> print x, y
[] []
Cheers,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
effective stdin buffer
is for Python? I mean, it really can't be the multiplying that's a
bottleneck. Not sure if it's possible, but can a new stdin be created
(possibly using os.fdopen) with a hefty buffer size?
I'm probably way off, but something to share.
Cheers,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
IN' DOING THE RIGHT THING. Do it inefficiently, or do
> it efficiently, but it's NOT AN ERROR. (IMHO ;-)
>
>
> -tkc
Does it know the right thing to do though?
For instance, sum(['1', '2', '3']); it's not completely unreasonable
for someone to expect
a result of 6.
No one seems to mind that ''.join([1,2,3]) baulks, and doesn't return
'123'.
Explicit is better than implicit.
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
m(['010111010', '372']) # Binary and decimal
Sum should return a *numeric* result, it has no way to do anything
sensible
with strings -- that's up to the coder and I think it'd be an error in
Python
to not raise an error.
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
a look at pyparsing.
Has (from my experience) a small learning curve and is a
useful library addition!
It could well be overkill, but not knowing your exact requirements,
it'd be worth looking at anyway.
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
(Although other DB's support similar techniques)
() Shared Nothing Architecture (aka. 'Sharding') with appropriate
'buckets' which is massively scalable, but I'm guessing overkill :)
http://en.wikipedia.org/wiki/Shared_nothing_architecture - IIRC
SQLAlchemy has a basic implementation of this in its examples.
Cheers,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
hon cookbook).
Since however, the idea of processing INI files is that you *know*
what you're looking for and how to interpret it, I'm not sure why
you're not using something similar to this (v2.6.2):
relay_name = config.get('Relay Info', 'relay_name')
relay_current_range = config.get('Relay Info', 'relay_current_range')
relay_current_range_list = eval(relay_current_range)
...etc...
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
ment format like .odt or similar? Or even better, plain text
> with markup?
>
> --
> Steven
Umm, seem to have woken up in a good mood this morning (for a change);
just in case the OP can't...
http://datasyzygy.com/alf/01 - getting started.pdf
http://datasyzygy.com/alf/02 - asd.pdf
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On 28 Oct, 07:44, Jon Clements wrote:
> On 28 Oct, 07:31, Steven D'Aprano
>
>
>
> wrote:
> > On Wed, 28 Oct 2009 07:52:17 +0100, Alf P. Steinbach wrote:
> > > Unfortunately Google docs doesn't display the nice table of contents in
> > > each docum
h Python is that the
"batteries included" also include some functions marked in the
documentation as "Available on Windows only" etc... And specifically
suggesting an ActiveState install which includes COM interop etc...
(although I hope this would appear much later, if at all).
Inline reply:
On 28 Oct, 11:49, "Alf P. Steinbach" wrote:
> * Jon Clements:
>
> > On 28 Oct, 08:58, "Alf P. Steinbach" wrote:
> > [snip]
> >> Without reference to an OS you can't address any of the issues that a
> >> beginner
&g
ecated.
Try using os.listdir() - can't remember off the top of my head if
that's been moved to os.path.listdir() in the 3.* series, but a read
of the doc's will set you straight.
Ditto for read() and write().
If you describe what you're trying to achieve, maybe we can help more.
Also, if you're using 3.0, may I suggest moving to 3.1?
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On 28 Oct, 21:55, Dean McClure wrote:
> On Oct 28, 4:50 pm, Jon Clements wrote:
>
>
>
> > On 28 Oct, 06:21, Dean McClure wrote:
>
> > > Hi,
>
> > > Just wondering how I can get theitems() command fromConfigParserto
> > > not resort all the item
(I know that there's a PEP on absolute_import, but since
> absolute_import appears to be absolutely ineffectual here, I figure
> I must look elsewhere for enlightenment.)
>
> TIA!
>
> kynn
You can shift the location of the current directory further down the
search path.
Assuming sys.path[0] is ''...
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path = sys.path[1:] + ['']
>>> import spam
>>> spam.__file__
'spam.pyc'
hth
Jon.
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
I'd like to do:
resultlist = operandlist1 + operandlist2
where for example
operandlist1=[1,2,3,4,5]
operandlist2=[5,4,3,2,1]
and resultlist will become [6,6,6,6,6]. Using map(), I
can do:
map(lambda op1,op2: op1 + op2, operandlist1, operandlist2)
Is there any reasonable way to do this via a
On Nov 2, 10:41 am, Mirons wrote:
> Hi everybody! I'm having a very annoying problem with Python: I need
> to check if a (mutable) object is part of a list but the usual
> expression return True also if the object isn't there. I've
> implemented both __hash__ and __eq__, but still no result. what
xudes a "moi?" expression).
Also, it may help others to post their thoughts if you tried to
describe why you think you want to go down this line, and what you're
trying to achieve.
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
ort pyparsing
>>> parser = pyparsing.ZeroOrMore('-c')
>>> parser.parseString('-c-c-c-c-c-c')
(['-c', '-c', '-c', '-c', '-c', '-c'], {})
hth,
Jon.
[1] http://pyparsing.wikispaces.com/
--
http://mail.python.org/mailman/listinfo/python-list
ammers to the Python language, then introduce them to Python's
way of "variables", they'll thank you for it later... (or run
screaming, or start another thread here...)
I've never seen/heard != described as "different from"; what's wrong
with "not equal to"? And why no mention of 'not' (should be mentioned
with booleans surely?).
That's as far as I've got; might get around to reading more later...
Cool tree at the end :)
Cheers,
Jon
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 9, 5:22 pm, "Alf P. Steinbach" wrote:
> * Jon Clements:
>
>
>
> > On Nov 9, 4:10 pm, "Alf P. Steinbach" wrote:
> >> Chapter 2 "Basic Concepts" is about 0.666 completed and 30 pages so far.
>
> >> It's now Python 3
[posts snipped]
The only other thing is that line_length is used as a constant in one
of the programs. However, it's being mutated in the while loop
example. It may still be in the reader's mind that line_length == 10.
(Or maybe not)
Cheers,
Jon.
--
http://mail.python.org/mailma
he right direction here?
>
> (The library is PyEphem, an extraordinarily useful library for anyone
> interested in astronomy.)
>
> Many thanks,
>
> --
> NickC
A direct way is to use:
moon1 = getattr(ephem, 'Moon')()
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
.
> The server is powered by Django.
>
> - Ken
How about http://docs.djangoproject.com/en/dev/topics/auth/ and using
a urllib2 opener with cookie support ala some examples on
http://personalpages.tds.net/~kent37/kk/00010.html ?
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
5))
>>> [id(i) for i in lol]
[167614956, 167605004, 167738060, 167737996, 167613036]
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
links, or automate IE to open said pages etc...)
I strongly suggest reading the urllib2 and BeautifulSoup docs, and
documenting the above code snippet -- you should then understand it,
should be less stressed, and have something to refer to for similar
requirements in the future.
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
l range (a corner case), it's a
lot easier to do a +1, than to force people to write -1 for the vast
majority of cases.
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
)
def spy(self, key):
return 'Al'
>>> a = Al()
>>> a[3]
'Al'
>>> a.spy = lambda key: 'test'
>>> a[3]
'test'
>>> b = Al()
>>> b[3]
'Al'
Seems to be what you're after anyway...
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
80 ?geany /usr/share/gramps/ReportBase/
_CommandLineReport.py
12682 ? gnome-pty-helper
12683 pts/0/bin/bash
13038 ?gnome-terminal
13039 ?gnome-pty-helper
13040 pts/1bash
13755 pts/1ps -eo pid,tty,cmd
...etc...
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 18, 4:14 pm, Jon Clements wrote:
> On Nov 18, 11:25 am, Jean-Michel Pichavant
> wrote:
>
>
>
> > Hi python fellows,
>
> > I'm currently inspecting my Linux process list, trying to parse it in
> > order to get one particular process (and kill it).
with files you can use something like:
my4chars = struct.Struct('4c')
def struct_read(s, f):
return s.unpack_from(f.read(s.size))
Which isn't hideously painful.
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
what):
from itertools import imap, islice, izip, cycle, repeat
table = filter(None, imap(str.split, what.split('\n')))
table_dict = {}
for cols in islice(table, 1, None):
for row_name, col_name, col in izip(cycle(table[0]), repeat
(cols[0]), islice(cols, 1, None)):
table
x27;m guessing you mean Django - You may well get advice here, but the
"Django Users" google group and the associated documentation of
djangoproject and how to customise the admin interface is your best
start.
hth,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
08DJQ.D5-30Q5B-B-D5-BSHOE-MM.smz->/arch_m1/
> smi/des/RS/Pat/10DJ/121.D5-30/1215B-B-D5-BSHOE-MM.smz ; t9480rc ;
> 11/24/2009 08:16:42 ; 1259068602'
>
> TIA
j...@jon-desktop:~/pytest$ cat log.txt
K:\sm\SMI\des\RS\Pat\10DJ\121.D5-30\1215B-B-D5-BSHOE-MM.smz->/arch_m1/
smi/des/RS/Pat/10
On Nov 24, 9:50 pm, Jon Clements wrote:
> On Nov 24, 9:20 pm, utabintarbo wrote:
[snip]
> Although, "Pat\x08DJQ.D5-30Q5B-B-D5-BSHOE-MM.smz" and "Pat
> \x08DJQ.D5-30Q5B-B-D5-BSHOE-MM.smz" seem to be fairly different -- are
> you sure you're posting the corr
h to include your Python rather than the
system's default Python
4) When installing modules (via setup.py install or easy_install)
include a "home_dir=" (I think that's right OTTOMH) to somewhere in
your home directory, and make sure step 2) complies with this.
5) Double check with "which python" to make sure it's the correct
version.
hth
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
gt; >> What I get from the debugger/python shell:
> >> 'K:\\sm\\SMI\\des\\RS\\Pat\x08DJQ.D5-30Q5B-B-D5-BSHOE-MM.smz->/arch_m1/
> >> smi/des/RS/Pat/10DJ/121.D5-30/1215B-B-D5-BSHOE-MM.smz ; t9480rc ;
> >> 11/24/2009 08:16:42 ; 1259068602'
>
> > When you do what, exactly?
>
> ;)
>
> --
> Grant
Can't remember if this thread counts as "Edwards' Law 5[b|c]" :)
I'm sure I pinned it up on my wall somewhere, right next to
http://imgs.xkcd.com/comics/tech_support_cheat_sheet.png
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
...
> >>> exit()
>
> C:\test> py3
> Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)]
> on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> class
works as expected:
>
> sqlite> SELECT bin FROM bins WHERE qtl LIKE '%harvest%';
> 11C
> 11D
> 12F
>
> I guess there is a problem with the "%".
You might want:
c.execute("SELECT bin FROM bins where qtl like $keys", {'keys':
keywords} )
Cheers,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 24, 5:21 pm, Jon Clements wrote:
> On Feb 24, 5:07 pm, Sebastian Bassi wrote:
>
> > c.execute("SELECT bin FROM bins WHERE qtl LIKE '%:keys%'",{'keys':keywords})
>
> > This query returns empty. When it is executed, keywords = 'harve
.__name__, (base, getattr(aspect_xy, cls.__name__)),
{})
return wrapper
@aspect_xy(BaseObject)
class SomeObject:
pass
Cheers,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
mer school.
- Slim Abdennadher, GUC, Egypt
Analysis of CHR Solvers
- Henning Christiansen, U. Roskilde, Denmark
Abduction and language processing with CHR
- Thom Fruehwirth, University Ulm, Germany
CHR - a common platform for rule-based approaches
- Jon Sneyers, K.U.Leuve
r" loop.
>
> Thank you for your help
Something like:
d = defaultdict( lambda: [0,0] )
for key, val in filter(lambda L: not any(i is None for i in L), m):
d[key][0] += 1
d[key][1] += val
hth
Jon
--
http://mail.python.org/mailman/listinfo/python-list
ed,
incompetent and otherwise useless developers to the market).
However, they're receiving some 'elegant' solutions which no professor
(unless they're a star pupil - in which case they wouldn't be asking)
would take as having been done by their selves.
(Or at least I hope not)
But yes, I would certainly be interested in the 'unsuccessful
attempt'.
(To the OP, do post your attempts, it does give more validity).
Cheers,
Jon.
--
http://mail.python.org/mailman/listinfo/python-list
ass # do something
I've got as far as type(somename, (B,), {}) -- do I then __init__ or
__new__ the object or...
In short, the function should be the __call__ method of an object that
is already __init__'d with the function arguments -- so that when the
object is called, I get the r
701 - 800 of 1223 matches
Mail list logo