A good solution may be to specify a language to determine the order.
The default would be (something like) "en-US" and thus early October in
the example.
--
http://mail.python.org/mailman/listinfo/python-list
Is there a library which can parse strings and output a datetime
object? It should be as magical as possible and allow things like:
12:30
tomorrow
10.10.2005
02-28-00
28/03/95
1995-03-28
1996.Feb.29 (Thu) 16:45:23.7
Is there anything like that out there? My Google can't find anything
useful ...
-
Things, which can be done better are:
- seperate content and layout (no table design, no font tags, ...)
- blue links on blue background are nearly as ugly as visited-purple
links on blue background
- he frontpage is overloaded. Ok this is worth a discussion: poweruser
vs. marketing
--
http://ma
let me try.
1) ''.join(lots_of_pieces)
2) This doesn't even work, if something is removed, the list is too
short. So:
[x for x in somelist if not isbad(x)]
well, list comprehension is Python 2.4 and 2.3 is the standard in many
OSes, so it is possibly not the most portable solution
I had to look u
>>> id("blub")
-1210548288
This is not identity in a mathematical view.
def identity(x): return x
It has is uses. I had some kind of parser and had a dict like this:
{case: function, ...} It had to be a dict, because i wanted to
dynamically add and remove cases. In some cases nothing had to be d
Uh, no good style to comment myself, sorry. I just found why i could't
see your blog entry. Since i read your message through groups.google.de
i just clicked on the link. Your Google Highlight plugin seems to be
confused about that:
Warning: Unknown modifier '/' in
/var/www/html/wp/wp-content/plug
more polished.
btw my blog runs on Python! :D
http://beza1e1.tuxen.de
--
http://mail.python.org/mailman/listinfo/python-list
Depends on your experience. If you know C,C++,Java and the whole
C-syntax-bunch. I'd recommend Python just to learn to adapt a different
syntax. If you want to learn for the learnings sake, i'd also recommend
Haskell to try functional programming, if you do not already know it.
Ruby has some inter
Thank you! this "compile/exec in context" is the thing i wanted.
It is not that performant i think. But it should ease the prototyping.
--
http://mail.python.org/mailman/listinfo/python-list
Is it possible compiler.parse a statement, then change and then
execute/resolve it?
Background:
I'm probably to lazy to write my own parser.
I have such a statement as string: "distance = x**2 + y**2"
x and y are undefined, so it is no executable Python code, but it is
parseable. Now i'd like tra
What are you developing for?
You could write another small python scripts, which calls your script.
os.system("python yours.py --param Ünicöde")
--
http://mail.python.org/mailman/listinfo/python-list
Hm, you didn't include a link and my google did not find the final
results.
The results are fluctuating very much. This suggests a small number of
votes. Linux Journal may be a big magazine, but i don't think language
opinions change that fast.
The vote is all done by email this year, which is an
Thanks for you answer! This copy trick is the most elegant solution i
think.
--
http://mail.python.org/mailman/listinfo/python-list
Coming back from a bug hunt, i am not sure what to think of this python
behaviour. Here is a demo program:
class A:
def __init__(self, lst=[]):
self.lst = lst
a = A()
b = A()
b.lst.append("hallo")
print a.lst # output: ["hallo"]
The point seems to be, that lst=[] creates a class attribu
Do you think of pydoc? Just make comments in your code this way:
def add10(x):
"""this function adds ten to the given variable"""
Then save this into add.py and now (in the same directory):
pydoc add
Voila, your documentation.
--
http://mail.python.org/mailman/listinfo/python-list
I wrote this one:
--
def load_plugin(self, plugin, paths):
import imp
# check if we haven't loaded it already
try:
return sys.modules[plugin]
except KeyError:
pass
# ok, the load it
fp, filen
I think for a quick hack, this is as good as a parser. A simple parser
would miss some cases as well. RE are nearly not extendable though, so
your critic is valid.
The point is, what George wants to do. A mixture would be possible as
well:
Getting all by a RE and then extracting the url with some
I do not really know, what you want to do. Getting he urls from the a
tags of a html file? I think the easiest method would be a regular
expression.
>>>import urllib, sre
>>>html = urllib.urlopen("http://www.google.com";).read()
>>>sre.findall('href="([^>]+)"', html)
['/imghp?hl=de&tab=wi&ie=UTF-8
Thanks for the hints. I just found NLTK and MontyLingua.
And yes, it is just adventure game language. This means every tense
except present tense is discarded as "not changing world". Furthermore
the parser will make a lot of assumptions, which are perhaps 90% right,
not perfect:
if word[-2:] ==
I don't know about a typical python way, but i'd like to know as well
;)
Personally i have a project for my project foo, which has
foo/__init__.py# with all the other modules
doc/# documentation is always a good idea
script/ # everything executable, which later goes into 'bin'
director
Well, a declarative sentence is essentially subject-predicate-object,
while a question is predicate-subject-object. This is important in
further processing. So perhaps i should code this order into the
classes? I need to think a little bit more about this.
Thanks for your feed for thought! :)
--
I'm writing a parser for english language. This is a simple function to
identify, what kind of sentence we have. Do you think, this class
wrapping is right to represent the result of the function? Further
parsing then checks isinstance(text, Declarative).
---
class Sentence(str): p
I really should take a look at this CLOS, i think ... thanks for the
background information.
Do you think FP Python is appropriate or just syntactic sugar of a very
sophisticated kind? Now i switching back to OO a bit, but the
difference between data.value and date['value'] is not really in
Python
This nails it down, yes. :)
I probably was too deep into OOP thinking-mode to work pythonic. So i
am now rediscovering the python way.
Have you read Paul Grahams On Lisp (or was it one of his essays)? He is
strongly in favor of functional programming. Mainly because Lisp favors
it. He does say th
You are right, this is not the essence of functional programming.
Functional and procedural python code would look quite the same (at
least in pydoc). It is the implementation of my functions, wether they
are functional or procedural. If i use global variables, it is not
functional any more.
Whil
I was hacking on something similar. It could be called a collaborative
story-telling adventure game or something. My idea was to parse natural
language text not "commands". The game manages locations and objects.
This is for story-telling roleplay. No stats, levels or monsters (at
least no self act
I recently found 'gnome-open', which does this. It chooses the Gnome
default for the filetype. Like you clicked on it in nautilus. OS X also
has this 'open' command and i like it. :)
--
http://mail.python.org/mailman/listinfo/python-list
I see myself shifting more and more over to the functional kind of
coding. Could be related to the Haskell, we had to learn in CS. Now i
was wondering, how other people use Python?
With functional i mean my files mostly consist of functions and only
rarely i use "class". The library modules seem t
28 matches
Mail list logo