On Wed, Nov 25, 2015 at 12:42 PM, ryguy7272 wrote:
> Hello experts. I'm looking at this url:
> https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names
Wildly offtopic but interesting, easy way to grab/analyze Wikipedia
data using F# instead of Python
http://evelinag.com/blog/2015/11-18-f-tac
On Mon, Jan 19, 2015 at 6:46 PM, Mark Lawrence
wrote:
> I don't know if you've seen this http://kmike.ru/python-data-structures/
> but maybe of interest.
>
I haven't read but also possibly of interest:
Data Structures and Algorithms in Python by Michael T. Goodrich, Roberto
Tamassia, Michael H.
On Tue, Nov 11, 2014 at 11:40 AM, Peter Cacioppi
wrote:
> I get the impression that most Pythonistas aren't as habituated with
> assert statements as I am. Is that just a misimpression on my part? If not,
> is there a good reason to assert less with Python than other languages?
>
> As far as I ca
On Thu, Nov 20, 2014 at 11:29 AM, Irmen de Jong
wrote:
> PyCharm *is* free, if you fall in one of several categories.
> See http://www.jetbrains.com/pycharm/buy/license-matrix.jsp
>
> Even when you have to buy it, it is cheap (IMO) for what it offers.
>
"PyCharm Editions Comparison" [1] is a bet
On Tue, Nov 11, 2014 at 11:40 AM, Peter Cacioppi
wrote:
> I think one needs to take care with some basic assert coding - it's not a
> substitute for unit tests, it doesn't absolve you of normal exception
> responsibilities, and, most of all, it should be used for passive
> inspection and not acti
On Tue, Oct 28, 2014 at 4:02 AM, wrote:
> Hi everyone,
>
> I'm not really sure if this is the right place to ask about regular
> expressions, but since I'm usin python I thought I could give a try :-)
> Here is the problem, I'm trying to write a regex in order to substitute
> all the occurences i
On Tue, Aug 5, 2014 at 12:25 PM, Duncan Booth
wrote:
> So far they seem to have kept a pretty low profile; I suspect largely
> because until recently PTVS only worked with the pay versions of Visual
> Studio.
>
Not true. When it didn't work with the free express versions of VS, it
worked with th
On Tue, Jul 29, 2014 at 5:54 AM, Colin J. Williams
wrote:
> ii. The Service Pack 1 has the original studio as a prerequisite. That is
> no longer available from Microsoft.
I haven't tried it but the Visual Studio 2008 Professional 90 Day Trial iso
*is* available from Microsoft at [1]. This doe
Hmmm. Now that I think about it the full Microsoft Visual Studio 2008
Service Pack 1 download I mentioned in my last email probably needs to have
Visual Studio 2008 already installed (it's been a number of years since I
had to install VS2008)? You could try it and see if it works.
If not download
On Fri, Jul 25, 2014 at 7:40 PM, Chris Angelico wrote:
> The OP asked for two things, which I'll separate because they're
> actually quite different.
>
> 1) Drag and drop widgets to create a window
> 2) Double-click a widget to edit its code (presumably event handler)
>
> I have used a number of
On Sat, Jul 19, 2014 at 12:28 AM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:
> For Python users, the IDEs from
> Wingware and Activestate are notable:
>
> https://wingware.com/
> http://komodoide.com/
>
I would say that since PyCharm (https://www.jetbrains.com/pycharm/
On Friday, 23 November 2001 04:13:40 UTC+5:30, MANUEL FERNANDEZ PEREZ
wrote:
> > Hello,
> > I'm looking for an editor for Python.I' m interested it works on
> Windows.Can
> > anybody help me?
>
It's an IDE rather than "just" an editor but how about PyCharm 3 Community
Edition? [1]
[1] https://ww
On Thu, Aug 29, 2013 at 2:43 AM, Philip Inglesant wrote:
> Hi Martyn,
>
> Thanks for the good advice to download VS 2008 before M$ delete it from
> their download servers.
>
> Unfortunately they have already done this so many Python modules now can't
> be compiled correctly on Windows!
>
> Best r
On Wed, Jun 12, 2013 at 1:02 PM, Chris Angelico wrote:
> I put the question to the
> list, and got back a number of excellent and most useful answers
> regarding book recommendations, and we ended up going with (if memory
> serves me) Think Python [1]
>
Here's a link [1] to Chris' original quest
[Just a note, all the book links in my original post have complete table of
contents listing, so don't just take my word on their suitability.]
Here's some
I missed:
Programming in Python 3, 2nd Edition - Mark Summerfield (Addison-Wesley,
2009) [1a]. Exercises. Solutions available online. At a qu
On Thu, May 2, 2013 at 7:36 AM, Chris Angelico wrote:
> One of my younger brothers, still school age, is to be studying some
> aspect of computing for the next term or two. I strongly recommended
> he learn Python (it has a bit more future than studying the internals
> of OS/2), and my/his father
copies a list, he copies in fact the *pointer* to the list, such that we
obtain this apparently strange behavior.
Is it the correct explanation?
In these conditions, how to make this list [[0,0,0],[0,0,0]] with "*"
without this behavior?
Thanks,
TP
--
http://mail.python.org/mailman/listinfo/python-list
e Kopien per E-Mail. / Please do not Cc: me.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Not sure if this is relevant. I use mail.google.com to follow mailing
lists and a large proportion of python-list traffic ends up in my
gmail spam folder for some reason?
-- TP
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Apr 16, 2011 at 2:32 AM, jacek2v wrote:
> On Apr 16, 11:18 am, Daniel Kluev wrote:
>> > Please continue your recommendations.
>>
>> WingIDE has all that and much more, if you are willing to consider
>> non-free IDE.
>> Its multi-threading debugger definitely worth the cost of Pro version
project:
http://tpgit.github.com/MDIImageViewer/imageviewer.html. You can even
view the Sphinx documentation "code" by clicking the "Show Source"
link on the left.
-- TP
--
http://mail.python.org/mailman/listinfo/python-list
Seebs wrote:
> On 2010-10-07, TP wrote:
>> Diez B. Roggisch wrote:
>>> A safer alternative for these cases is using tuples, because they are
>>> immutable.
>
>> The problem with tuples is that it is not easy to modify them:
>
> This is probably the be
Steven D'Aprano wrote:
>> I think I prefer doing an explicit copy.copy, because it allows to
>> remind the reader that it is very important to take care of that.
>
> I think a comment is better for that. It's better to explicitly say
> something is important than to assume the reader will guess.
Diez B. Roggisch wrote:
> Back to your example: your solution is perfectly fine, although a bit
> costly and more error-prone if you happen to forget to create a copy.
> A safer alternative for these cases is using tuples, because they are
> immutable.
Thanks Diez for your explanation.
The proble
Chris Torek wrote:
>>import copy from copy
>
> [from copy import copy, rather]
Yes, sorry.
> Note that if f() is *supposed* to be able to modify its second
> parameter under some conditions, you would want to make the copy
> not at the top of f() but rather further in, and in this case,
> that
Hi,
I have a function f that calls itself recursively. It has a list as second
argument, with default argument equal to None (and not [], as indicated at:
http://www.ferg.org/projects/python_gotchas.html#contents_item_6 )
This is the outline of my function:
def f ( argument, some_list = None ):
Hi everybody,
Today I have learned a bit of the news of Python 3.0 compared to 2.4
version.
By the way, I have asked myself if it is possible to add a method to a
builtin type as 'unicode':
>>> a="foo"
>>> type(a)
>>> print(dir(a))
['__add__', ..., 'zfill']
For example, I would like to add a
James Mills wrote:
> What do you mean by "command" ?
For example, print statements, but it could extend to class definitions,
etc. I am going to examine the solution given by Chris.
Cheers,
Julien
--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"When
Hi everybody,
I am interested in having the possibility to print every Python commands in
a script (for didactic purpose).
So I am looking for some sort of equivalent of bash "set -x".
Does it exist?
Thanks
Julien
--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(5
On Wed, Mar 17, 2010 at 7:53 AM, Peng Yu wrote:
> On Tue, Mar 16, 2010 at 11:12 PM, Patrick Maupin wrote:
>> On Mar 4, 6:57 pm, Peng Yu wrote:
>>> I don't find a general pdf library in python that can do any
>>> operations on pdfs.
>>>
>>> I want to automatically highlight certain words (using r
>From the Cplusplus-sig, I gathered that instead of Boost.Python I
should use ctypes for the following problem. But let me make sure I'm
using it correctly.
I am calling the C Leptonica Image Processing C Library
(http://leptonica.com) from python.
Within its leptprotos.h file are functions like
Bearophile wrote:
> So probably a better solution is to just use the normal function
> semantics: you pass them an argument and you take an argument as
> return value. Such return value will be the new version of the value
> you talk about.
Thanks for your answer.
Yes, it is better like this. My
Hi everybody,
See the following example:
#
def tutu():
def toto():
print a
a = 4
print a
a=2
toto()
tutu()
##
I obtain the following error:
"UnboundLocalError: local variable 'a' referenced before assignment"
This is because Python looks i
MRAB wrote:
> You could create a dict with the string as the key and the object as the
> value.
Thanks. But it implies an additional data structure: a dictionnary.
I don't know what is the best:
* using an additional dict and maintaining it
* or using the "di" module proposed by CTO
If "di" is r
Hi everybody,
I have a data structure (a tree) that has one constraint: I can only store
strings in this data structure.
To know if an object foo already exists in memory, I store "str(id(foo))" in
the data structure.
OK.
But how do I get a usable reference from the id value?
For example, if "fo
Hi everybody,
Try the following python statements:
>>> "%.40f" % 0.222
'0.098864108374982606619596'
>>> float( 0.222)
0.1
It seems the first result is the same than the following C program:
#
Adrian Dziubek wrote:
> Could you explain your high level goal for this? It looks like a very
> wicked way of doing things. Have You tried to read the list methods'
> documentation? Maybe there you find something you need (like
> list.index)?
Hello,
I have a "disambiguation" function that modifi
Hi everybody,
Be a the following list, containing list elements which second field is a
string.
>>> a = [ [4, "toto"], [5, "cou"] ]
>>> a[0][1]="tou"
>>> a
[[4, 'tou'], [5, 'cou']]
OK.
Now, I want:
* to do the same modification on the list "a" within a function
* not to hardcode in this functio
Hi everybody,
This example gives strange results:
def foo( l = [] ):
l2 = l
print l2
for i in range(10):
if i%2 == 0:
l2.append( i )
yield i
>>> [i for i in ut.foo()]
[]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> [i for i in ut.foo()]
[0, 2, 4,
Benjamin Peterson wrote:
> While the solutions given by others in this thread will work, I think it
> is best policy to not name your own modules after stdlib ones. When I see
> "os" referenced in code, I assume it is the stdlib one, and don't want to
> be confused by the presence of your own modu
Ben Finney wrote:
> (Could you please set a valid email address for people to contact you
> if necessary?)
Thanks a lot for your help.
My email address is in my signature:
--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"When a distinguished but elderly
Hi everybody,
I would like to prevent the loading of modules in the current directory.
For example, if I have a personal module in the current directory
named "os", when I do "import os", I would like Python to import os
standard module, not my personal module of the current directory.
Is this pos
Hi everybody,
I have programmed a python package, and I would like to use distutils with
it. My package has the following structure after doing sdist and build:
$ python setup.py sdist
[...]
$ python setup.py build
[...]
$ tree
.
|-- MANIFEST
|-- MANIFEST.in
|-- README
|-- build
| `-- lib
|
Hi everybody,
I try to make a "link" (or shortcut, if you want) so that len(b_instance)
computes in fact len(a) (see the code below). I could write a method
__len__ to b, but I wonder if it is possible to make it with a
setattr/getattr trick, as I do below.
Thanks in advance,
Julien
###
Hi,
Hereafter is an example using super.
At the execution, we obtain:
coucou
init_coucou2
coucou1
coucou2
Traceback (most recent call last):
File "essai_heritage.py", line 34, in
print b.a
AttributeError: 'coucou' object has no attribute 'a'
Why Python does not enter in the __init__ metho
Peter Otten wrote:
> If you can change the rest of your program to work smoothly with a
> dictionary I would suggest the following:
[snip]
>>> from collections import defaultdict
[snip]
Thanks a lot.
I didn't know defaultdict. It is powerful.
I begin to understand that people prefer using dictio
alex23 wrote:
> Try not to use 'dict' or the name of any of the other built-in types
> as labels.
Ops... Moreover I know it...
> You're stepping through an entire list just to pass another list to
> l.remove to step through and remove items from...in fact, given that
> list.remove deletes th
Hi,
Is the following code pythonic:
>>> l=[{"title":"to", "value":2},{"title":"ti","value":"coucou"}]
>>> dict = [ dict for dict in l if dict['title']=='ti']
>>> l.remove(*dict)
>>> l
[{'title': 'to', 'value': 2}]
Precision: I have stored data in the list of dictionaries l, because in my
applica
Hi everybody,
Try the following program:
def f():
def f_nested():
exec "a=2"
print a
f()
It yields an error.
$ python nested_exec.py
File "nested_exec.py", line 3
exec "a=2"
SyntaxError: unqualified exec is not allowed in functi
Hi everybody,
I try to modify locals() as an exercise.
According to the context (function or __main__), it works differently (see
below). Why? Thanks
Julien
def try_to_modify_locals( locals_ ):
locals_[ "a" ] = 2
print "locals_[ 'a' ]=", locals_[
Hi everybody,
I would like to change only the nth occurence of a pattern in a string. The
problem with "replace" method of strings, and "re.sub" is that we can only
define the number of occurrences to change from the first one.
>>> v="coucou"
>>> v.replace("o","i",2)
'ciuciu'
>>> import re
>>> re
Hi everybody,
>>> c=[(5,3), (6,8)]
>From c, I want to obtain a list with 5,3,6, and 8, in any order.
I do this:
>>> [i for (i,j) in c] + [ j for (i,j) in c]
[5, 6, 3, 8]
Is there a quicker way to do this?
Thanks
Julien
--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.9&1+,\
[EMAIL PROTECTED] wrote:
>> >>> a=("1","2")
>> >>> b=[("3","4"),("5","6")]
>> >>> list(a)+b
>> ['1', '2', ('3', '4'), ('5', '6')]
>
a = ("1", "2")
b = [("3", "4"), ("5", "6")]
[a] + b
> [('1', '2'), ('3', '4'), ('5', '6')]
Thanks a lot.
Why this difference of behavior between list
Hi,
If I do:
>>> a=("1","2")
>>> b=[("3","4"),("5","6")]
>>> list(a)+b
['1', '2', ('3', '4'), ('5', '6')]
I would like rather to obtain:
[('1', '2'), ('3', '4'), ('5', '6')]
Am I compelled to do:
>>> c=[]
>>> c.append(a)
>>> c+b
[('1', '2'), ('3', '4'), ('5', '6')]
Thanks
Julien
--
python
Hi everybody,
I know how to document a function or a method, with a docstring (see below
for "foo" method documentation ("bar")).
But, how to document a property (below, self.d)?
###
class a():
def __init__( self ):
self.d = 2
def foo( self ):
"bar"
b=a()
pr
Hi everybody,
Here is a file "test_import_scope.py":
##
class a():
import re
def __init__( self ):
if re.search( "to", "toto" ):
self.se = "ok!"
def print_se( self ):
print self.se
a().print_se()
##
When python executes this file, we obtain an error:
Hi everybody,
Several means to escape a nested loop are given here:
http://stackoverflow.com/questions/189645/how-to-break-out-of-multiple-loops-in-python
According to this page, the best way is to modify the loop by affecting the
variables that are tested in the loops. Otherwise, use exception:
Hello,
I have a script that uses the "optparse" package to parse the command line.
For example:
$ script.py --help
# displays help about script.py
Is this possible to call such a script with execfile('') once in the Python
interactive shell?
>>> execfile( 'script.py' )
I get errors because the
Hi everybody,
The following code does not redirect the output of os.system("ls") in a
file:
import sys, os
saveout = sys.stdout
fd = open( 'toto', 'w' )
sys.stdout = fd
os.system( "ls" )
sys.stdout = saveout
fd.close()
Whereas the following works:
old_stdout = os.dup( sys.stdout.fileno() )
fd =
Hi everybody,
I have a question about the difference of behavior of "len" when applied on
tuples or on lists. I mean:
$ len( ( 'foo', 'bar' ) )
2
$ len( ( 'foo' ) )
3
$ len( [ 'foo', 'bar' ] )
2
$ len( [ 'foo' ] )
1
Why this behavior for the length computation of a tuple?
For my application, I p
Gabriel Genellina wrote:
> You may pre-process your text (stripping redundant whitespace) before
> using textwrap:
Thanks Gabriel for your answers!
I finally have subclassed textwrap.TextWrapper.
Julien
--
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.9&1+,\'Z
(55l4('])"
"W
Hi everybody,
Recently, I have tried to improve the look of the printed text in command
line. For this, I was compelled to remove redundant spaces in strings,
because in my scripts, often the strings are spreading on several lines.
For example, "aaa bbb" had to be transformed in "aaa bbb".
I ha
Hi everybody,
I try to find a quick way to redirect the standard output of a Python
command (for example: print "message") to a python variable "foobar".
Ok, in this simple example, I could do foobar = "message", but in
fact 'print "message"' could be replaced by any Python function writing on
sta
Hi everybody,
I would like to be able to specialize an existing class A, so as to obtain a
class B(A), with all methods of B being the methods of A preceded by a
special method of B called _before_any_method_of_A( self ), and followed by
a special method of B called _after_any_method_of_A( self ).
Hi everybody,
When using raw_input(), the input of the user ends when he types Return on
his keyboard.
How can I change this behavior, so that another action is needed to stop the
input? For example, CTRL-G. It would allow the user to input several lines.
Thanks
Julien
--
python -c "print ''.
Hi everybody,
All my problem is in the title.
If I try:
$ python -c 'print "foo",'
It does not change anything, surely because the line return is added
by "python -c".
Thanks in advance
Julien
--
TP (Tribulations Parallèles)
"Allez, Monsieur, allez, e
Peter Pearson wrote:
> I don't understand exactly what you mean by "Sorry"
I means: please forgive me for having said that it does not work with
variables, because it is completely false.
Thanks one more time
Julien
--
TP (Tribulations Parallèles)
"Allez, Monsieur
It works perfectly.
Indeed, one can read in the documentation concerning encodings:
"Produce a string that is suitable as string literal in Python source code"
--
TP (Tribulations Parallèles)
"Allez, Monsieur, allez, et la foi vous viendra." (D'Alembert).
--
http://mail.python.org/mailman/listinfo/python-list
TP wrote:
> So, the python print command *can* interpret these 4-character as a single
> character. It would be odd if there were no possibility to do the same
> thing when the characters are (i) stored in a python variable
Sorry, it works when using variables. Try for example:
col=&qu
om the environment variables. Does anybody know any way to re-interpret a
string in Python? I have tried to play with "eval" (as in bash), but it
does not yield anything.
--
TP (Tribulations Parallèles)
"Allez, Monsieur, allez, et la foi vous viendra." (D'Alembert).
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
> Off-hand, I'd probably try first with:
>
> csi = "\033["
>
> and then define your
>
> colorblackondarkblue = $csi"30;44m"
Thanks for your answer.
I have tried this slight modification, but it does not change anything on
3[0m
Why? What is the problem? Is there any solution?
I really want to get my shell color variables.
Thanks a lot
--
TP (Tribulations Parallèles)
"Allez, Monsieur, allez, et la foi vous viendra." (D'Alembert).
--
http://mail.python.org/mailman/listinfo/python-list
71 matches
Mail list logo