27;: 'SP<136>=', 'value': ['SD:<0> ']}
since {'key': 'SP<136>=', 'value': ['SD:<0> ']} is inside curly
brackets it is a dictionary.
I still dont get what your trying to have as your final result, but
hop
Did I just help someone with their homework? Hope not :S
On 27/09/2007, Nathan Harmston <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I m not sure what your trying to do, but this is where your problem is:
>
> string1 is not a string it is actually a dict because of your eval.
>
Hi I would like to learn python I have background in php, pawn, bash. I was
wondering if anyone would like to show me the ropes or even just throw me
some code that needs work and seeing what I come up with. Twisted python
seems to have very bright people behind it using newer programming ideas
a loss."
total_needed = int(raw_input("What is the total eggs needed? "))
hen = int(raw_input("How many eggs did each hen lay? Enter them in 1
by 1 or enter * when done. "))
exp_1
exp_2
[/code]
If not, then how do I do so?
Thanks,
Nathan P.
--
http://mail.python.org/mailman/listinfo/python-list
How do I factor a number? I mean how do I translate x! into proper
Python code, so that it will always do the correct math?
Thanks in advance,
Nathan P.
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 10, 12:10 pm, Mensanator <[EMAIL PROTECTED]> wrote:
> On Mar 10, 12:48 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>
> > On 10 mar, 02:08, Nathan Pinno <[EMAIL PROTECTED]> wrote:
>
> > > How do I factor a number?
>
> If factoring is ac
x = x + 1
print primes
elif run == 2:
break
else:
print "Sorry, not a choice. Please enter your choice again."
print "Goodbye."
How do I fix such an invalid syntax?
TIA,
Nathan Pinno
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 11, 1:12 pm, Mensanator <[EMAIL PROTECTED]> wrote:
> On Mar 11, 3:36 am, Duncan Booth <[EMAIL PROTECTED]> wrote:
>
> > Mensanator <[EMAIL PROTECTED]> wrote:
> > > On Mar 10, 10:44‹¨«pm, Nathan Pinno <[EMAIL PROTECTED]> wrote:
> > >> W
as I can see this
should work? But as I am just starting with ctypes I am sure I doing
something sorry very stupid.
Any pointers would be greatly appreciated,
Many thanks in advance,
Nathan
Im hoping python-list is ok for questions regarding ctypes :S
--
http://mail.python.org/mailman/listinfo/python-list
On 25/03/2008, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>
> En Mon, 24 Mar 2008 19:56:08 -0300, Nathan Harmston
> <[EMAIL PROTECTED]> escribió:
>
>
> > import ctypes
> > t = ctypes.CDLL('./Simulation.so')
> > this works fine, I have a
Hi,
Just as a follow up to this...I ve discovered that its an issue with
building shared libraries on mac os and it works fine on a Linux box :S.
Thanks
Nathan
On 25/03/2008, Nathan Harmston <[EMAIL PROTECTED]> wrote:
>
>
>
> On 25/03/2008, Gabriel Genellina <[EM
> #! /bin/sh
> python -c "import sys;exec(sys.stdin)"
I know this isn't your question, but I think you could write that more
cleanly with:
#!/usr/bin/python
import sys
exec(sys.stdin)
--
http://mail.python.org/mailman/listinfo/python-list
> I don't remember its name very clear, it may be 'jingle' or not this
> program runs on windows and can compile a python program into exe file
> without gcc
> it has no webspace but is announced on the author's blog when I find it
> some times ago.
> I can't find the link now. I there anybody else
This is a contrived pseudocode example which has been broken out of a
larger problem, so it may seem like a strange thing to want to do,
but...
I have a group of objects which inherit (single) from a common base
class like so:
---
class Root(object):
@classmethod
def CumulativeSco
On Apr 10, 2008, at 1:25 PM, [EMAIL PROTECTED] wrote:
> won't question why you want to do this...
> Here is a solution base on a metaclass, but it feels wrong.
> class MetaScore(type):
>def __new__(meta, name, bases, attrs):
>attrs.setdefault('score', score)
>return type.__ne
On Apr 11, 2008, at 11:35 AM, [EMAIL PROTECTED] wrote:
> I'd like to assign the value of an attribute in __init__ as the
> default
> value of an argument in a method. See below:
Are you sure? You will not get fresh values with each call in Python
as you would in other languages.
Why not jus
On Apr 12, 2008, at 6:55 PM, [EMAIL PROTECTED] wrote:
> Will it be possible for me to put together an async site
> with only python?
Nope. Not until some browser embeds a Python interpreter in it anyway.
Your primary choices are JavaScript and Flash.
--
http://mail.python.org/mailman/listi
Hi,
I am looking for Python consultants to work with us for couple of months.
The location is Bangalore, India.
Anybody interested, please contact me.
With warm regards,
Ramesh Nathan,
Head - Business Relations,
Winfoware Technologies Ltd,
Mobile - 0 93425 54560
HI Anand,
I am looking for python consultants for a couple of months.
Please let me know if you could help us directly or suggest some one
suitable.
With warm regards,
Ramesh Nathan,
Head - Business Relations,
Winfoware Technologies Ltd,
Mobile - 0 93425 54560.
Land
When I run:
#!/usr/bin/python
lines = list()
while 1:
try:
inLine = raw_input()
lines = lines.append(inLine)
except EOFError:
break
I get:
Traceback (most recent call last):
File "./foobar.py", line 7, in
lines = lines.append(inLine)
AttributeError: 'NoneTyp
> On Sep 28, 7:13 pm, alex23 <[EMAIL PROTECTED]> wrote:
>> The problem is with this:
>>
>> > lines = lines.append(inLine)
>>
>> The append method of a list modifies the list in-place, it doesn't
>> return a copy of the list with the new element appended. In fact, it
>> returns None, which i
I'm writing a program to sort files with arbitrary python code. The
method I'm using for that is to pass sort an anonymous function taken
from the arguments. I'm wondering how to change a raw string into an
anonyous function.
--
http://mail.python.org/mailman/listinfo/python-list
> On Sep 29, 11:25 pm, Nathan Seese <[EMAIL PROTECTED]> wrote:
>> I'm writing a program to sort files with arbitrary python code. The
>> method I'm using for that is to pass sort an anonymous function taken
>> from the arguments. I'm wondering how
nning this scripts in a Linux
environment). However, I was just tasked to get these scripts running in a
windows environment and to my dismay very quickly realized that pexpect is
not cross platform compatible.
Am I stuck, or are there solutions out there?
Cheers!
Nathan
--
The men the Ameri
methods of these kind of string matching in
Python? I m trying to see if my swigged alphabet trie is faster than
whats possible in Python!
Many thanks,
Nathan
--
http://mail.python.org/mailman/listinfo/python-list
if this possible in Python or possible using anything.
Google doesnt seem to give any obvious answers.
Many thanks in advance,
Nathan
--
http://mail.python.org/mailman/listinfo/python-list
be expanded to accommodate statements of
the form:
bar(x) for x in y
?
This inconsistency really bothered me when I started playing with python,
and it seems kind of at-odds with the "one right way to do things"
mentality.
-Nathan
--
http://mail.python.org/mailman/listinfo/python-list
Thanks everyone, the invRegexInf is perfect.
Thanks again,
Nathan
On 1 April 2010 10:17, Gabriel Genellina wrote:
> En Wed, 31 Mar 2010 12:23:48 -0300, Paul McGuire
> escribió:
>>
>> On Mar 31, 5:49 am, Nathan Harmston
>> wrote:
>>>
>>> I have a
itertools is also written in c, so if you're working with a big nested list
is long it will be a lot faster.
On Sat, May 8, 2010 at 5:40 PM, Tycho Andersen wrote:
> On Sat, May 8, 2010 at 4:09 PM, Günther Dietrich
> wrote:
> [snip]
> > Too simple?
>
> No, not at all. I really only intended to p
This is precisely the situation mmap was made for :) It has almost the same
methods as a file so it should be an easy replacement.
On Sat, May 15, 2010 at 10:05 AM, Nobody wrote:
> On Fri, 14 May 2010 18:38:55 -0400, J wrote:
>
> >>> someone smarter than me can correct me, but file.write() will
d way,
given an instance of a class, to determine if it is wrapped or native?
Currently I check to see if it has __slots__ then try to setattr a dummy
variable but I imagine there is probably a cleaner way.
Nathan
--
http://mail.python.org/mailman/listinfo/python-list
I prefer to just break such things into multiple lines. You're doing that
already anyhow, it's not much of a speed hit, and it makes exactly what
you're testing explicit. If I break a statement onto multiple lines I only
use parenthesis, and that is as a last resort. In my opinion there's almost
, subclass) - Return true if subclass
should be considered a (direct or indirect) subclass of class. If
defined, called to implement issubclass(subclass, class).
Nathan
On Wed, Jun 2, 2010 at 4:24 AM, B.V. wrote:
> Hi,
>
> In order to solve some issues due to operations between Decimal and
&g
files are pretty big)?
I somehow need to ensure, that the client requesting a file transfer is
the same client getting the file. So some sort of authentication is
needed.
What library would you use to do the file transfer?
Regards,
Nathan
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for all the replies.
I might use http, or I utilize a separate ftp server.
On Sat, 5 Jun 2010 13:34:45 -0700
geremy condra wrote:
> On Sat, Jun 5, 2010 at 10:14 AM, Dan Stromberg
> wrote:
> >> A more realistic answer is probably to use something based on
> >> HTTP. This solves a number o
I've been running into a problem lately where I have an architecture like so:
Main class -> facade/configuration class -> low level logic class.
The main class is what the user interacts with.
The facade/config class is responsible for loading and managing the
lower level classes and providing a
Hi,
tempfile.mkstemp returns a file name and a file descriptor (as returned
by os.open). Can I somehow convert this descriptor to a file object?
Thanks!
Nathan
--
http://mail.python.org/mailman/listinfo/python-list
It really depends on what you want to do. Ruby and Python are both highly
expressive languages. Python syntax seems "nicer" to me but that is
subjective.
As far as community support, Python has 4342 packages listed in sourceforge,
Ruby has 705. Python is listed in ~0.4% of jobs at indeed.com's
As others have mentioned when you would like to encapsulate data and
functions together, they're useful.
Also, if you find yourself passing lists/tuples/dictionaries around
frequently, you might benefit from converting them into classes. This tends
to make the code clearer and more readable, you
You are thinking like a C programmer
Why do you want the language to tie your hands? I want a language to give
me the tools I need and get out of the way. The more assumptions that are
baked into a language the more opportunities it has to be wrong.
Furthermore, object oriented design is a
I solve optimization problems like this all the time using branch and bound.
Just arrange the possible scenarios into a state space tree, (ideally
ordered by lowest average cost supplier) then prune any branch where the
best case scenario given supplier cost plus shipping cost summed over all
remai
Hi,
Is it somehow possible to import modules from *.py files in a higher
level directory?
Intuitively I would do
import ../module
but that does not work.
How does it work?
Thanks!
Nathan
--
http://mail.python.org/mailman/listinfo/python-list
Add the parent directory to your sys.path...
On Fri, Jun 25, 2010 at 5:20 PM, Nathan Huesken wrote:
> Hi,
>
> Is it somehow possible to import modules from *.py files in a higher
> level directory?
> Intuitively I would do
>
> import ../module
>
> but that does n
I like to think of decorators with arguments as decorator factory functions.
I try and unroll them as much as possible... I have some decorators that
work like so (and please note that the wraps and returns_as_output are
separate so that I can mutate the behavior as needed, if you just wanted a
si
Expert Python Programming by Tarek Ziade is a fairly good book, covers a lot
of core stuff, though it doesn't really cover gui app development at all.
On Sat, Jul 3, 2010 at 1:48 PM, mo reina wrote:
> an anyone recommend a resource (book,tutorial,etc.) that focuses on
> application development in
Hi,
I am packing large files with tarfile. Is there any way I can get
progress information while packing?
Thanks!
Nathan
--
http://mail.python.org/mailman/listinfo/python-list
given)
self is given as parameter this way, is it not? How can this be done?
Thanks!
Nathan
--
http://mail.python.org/mailman/listinfo/python-list
back had a
different number of parameters than I expected.
Thanks for the effort!
Nathan
--
http://mail.python.org/mailman/listinfo/python-list
I start to look at whether some subset of functions or classes are not
referenced by other subsets of functions or classes in a module when it gets
to about 1K LoC, and if I don't find any by the time it gets to about 1500
LoC, I start to look at ways I can refactor the code in the module to be
les
Do list(reversed(list(reversed([1, 2, 3, 4])) + [[]]))
Though TBH sometimes get annoyed at this behavior myself. There are a lot
of people who are very vocal in support of returning none, and it makes
sense in some ways. Since reversed returns an iterator though, it makes
this code horrible and
Yeah, I long ago filed the in place place in the same folder as
strings-as-sequences, all() returning True for an empty iterable and any
returning True rather than the thing which triggered it. Almost always
annoying and worked around, but that's the price you pay for the other nice
stuff :) It j
Stephen:
I'm not adverse to being able to do that, but the number of times that I've
wanted to do that is greatly outweighed by the number of times I've had to
pass a function "(somestring,)" or call "if isinstance(foo, basestring):
..." to avoid producing a bug. The more abstract and adaptive th
ue, Jul 13, 2010 at 8:48 PM, Aahz wrote:
> [Original not available on my swerver, responding here]
>
> >On 7/11/10 10:03 PM, Nathan Rice wrote:
> >>
> >> Yeah, I long ago filed the in place place in the same folder as
> >> strings-as-sequences, all() returni
Struqtural makes it easy to get data into a database, and easy to work
with it once it's there. Some of the big features include:
* Automatically generate all tables and relations needed to represent
XML in a database, including one to one, one to many, many to one and
many to many relationships
> Oh yes, I'd rather write lines of that rather than pages of SQL in a Python
> string.
(not to mention, avoid some easy to fall into security flaws, not have
to worry about porting dialect specific SQL code, etc, etc).
Fixed that for you. I can't take the credit for that part though,
that magi
first.
> Which are the classic books in computer science which one should
> peruse?
A list of some good books is at steve.yegge.googlepages.com/ten-great-
books. Also read programming blogs.
--
Nathan Stoddard, http://nathanstoddard.com
--
http://mail.python.org/mailman/listinfo/python-list
I was wondering if there was a pure python version of string.format
anywhere that could be used with python 2.4 and python 2.5. Searching
has only turned up an early implementation done for pep 3101, but it
seems that it didn't get that far.
Thanks,
Nate
--
http://mail.python.org/mailman/list
Jon Harrop wrote:
> Xah Lee wrote:
>> On Aug 12, 12:15 pm, Raymond Hettinger wrote:
>>> * The reason for implementing the key= parameter had nothing to do
>>> with limitations of Python's compiler. Instead, it was inspired by
>>> the
>>> decorate-sort-undecorate pattern.
>>
>> The decorate-sort
A.Politz wrote:
> On Aug 17, 6:43 am, Xah Lee wrote:
>> btw, is there still [no] info format for python doc?
>>
>> i feel kinda sad [...]
>> Part of this is due to [other peoples fault]
>
> Someone started a rst2info project (google it), maybe you want to help
> this guy out.
>
> Though, he mig
One other thing besides the issues noted with filename - newline is set to
a space. It should be set to an empty string.
See: https://docs.python.org/3/library/csv.html#id3
Regards,
Nate
On Wed, Feb 22, 2017 at 3:52 PM, wrote:
> On Wednesday, February 22, 2017 at 5:55:47 PM UTC, Braxton Alfred
ng after a non-whitespace character on a single line).
Regards,
Nathan
On Sat, Mar 18, 2017 at 4:24 PM, Mikhail V wrote:
> On 18 March 2017 at 16:54, Lutz Horn wrote:
> > Am 18.03.17 um 16:18 schrieb Mikhail V:
> >> On 18 March 2017 at 05:02, Ben Finney
> >> wrote:
>
I don't generally align stuff, either, but if you're going to, use spaces.
On Sat, Mar 18, 2017 at 4:55 PM, Chris Angelico wrote:
> On Sun, Mar 19, 2017 at 8:50 AM, Nathan Ernst
> wrote:
> > My rule of thumb: tabs for indentation, spaces for alignment (i.e. trying
> &g
On Sat, Mar 18, 2017 at 4:44 PM, ROGER GRAYDON CHRISTMAN
wrote:
> Just a couple minor notes from my experience:
>
> 1)
> Some of the course management software I use doesn't like me typing tab
> characters.
> When I want to post sample code into a course page using this software,
> tabs
> are eit
I want a tab to be inserted, by default. If I
want something else, I'll change the configuration.
On Sat, Mar 18, 2017 at 6:38 PM, Marko Rauhamaa wrote:
> Nathan Ernst :
>
> > Tabs rectify this issue as you can configure them to appear how you
> > like to see your code wi
I would also add a link to the dependency's project page, in case building
from source is necessary.
You don't always have root, and you're not always building with the system
supplied compiler.
There are a lot of situations that may require building from source. Far
too many to even bother to en
I was a bit surprised when I looked at the language reference for 3.6.x. I
expected there'd be a direct link to comprehensions, but there's not.
You have to know what you're looking for:
6.2.5: List Displays
6.2.6: Set Displays
6.2.7: Dictionary Displays
And, then, click on the appropriate eleme
Hi Pauline,
It depends largely on whether you want to (and have sufficient permissions)
to install for all users or just yourself.
If, on *nix, you're installing site-wide (for all users), typically you'd
do: "sudo pip install " (for python 2) or "sudo pip3 install
" (for python 3). If you're in
If you've installed into Program Files, then you're on Windows, and you've
installed for all users. Start a command prompt by right-clicking on the
start icon, then selecting "Command Prompt (Admin)". This should work on
Windows 8.x and Windows 10. Windows 7, you may need to navigate through
Progra
Hi Pauline,
I was able to infer you're on Windows, but not which version. Try
right-clicking on the start menu to start a command prompt as an
administrator (I'm not sure that was available in Windows 7, and I don't
have access to a Win7 box currently to verify). Failing that, you should be
able t
ke a web request, parse JSON or
XML, handle datetimes).
Remember: Python comes with batteries included.
-Nate
On Mon, Apr 3, 2017 at 5:09 PM, Deborah Swanson
wrote:
> Nathan Ernst wrote, on April 03, 2017 1:59 PM
> >
> > I was a bit surprised when I looked at the language refer
I used to write Python modules in C++. Well, more accurately, wrapped
already-written C++ APIs to expose to Python using Boost Python. This
wasn't due to performance issues, but to avoid reimplementing APIs.
That said, I believe Python gets a bad wrap in regards to performance for a
variety of re
goto is a misunderstood and much misaligned creature. It is a very useful
feature, but like nearly any programming construct can be abused.
Constructs like 'break', 'continue' or 'next' in languages like Python or
C/C++ are goto's with implied labels.
As Mikhail said, goto's can be great to break
I think that's fair (and I had intended to mention it). Although, I'm
curious how threading with IO compares to using async/awai (I've not
experience with async/await in Python, just in C#).
Regards,
Nate
On Tue, Apr 11, 2017 at 8:04 PM, MRAB wrote:
> On 2017-04-12 01:28,
Thank you for that Alan Kay quote. Brightened up my day. Since you also
mentioned COBOL, and this is a thread about "goto", reminded me of the
single most abhorrent thing I ever saw in COBOL (I had to convert a single
COBOL batch process to ASP.Net as an intern back in 2003-4). "MOVE NEXT
SENTENCE"
Off topic, but I find it a little annoying that the default Windows
installer links to the 32-bit installer (and there's no adjacent 64-bit
installer link) - you have to dive into various links to get the 64-bit
installer. Seeing as 64-bit Windows is now the norm, it should be the
default. (It is p
I've likewise mostly been ignoring this thread as it has gotten out of
control.
At a few jobs ago, I was nearly daily involved with interviewing
candidates. Initially, I was point on "culture fit". i.e. how would the
potential employee react to having a phone thrown at them (it happened - I
worked
As previously asked: what board are you using? There might be a simple
response to your issue, but you've yet to state the board you're using. You
will not get any useful responses until you answer this very, very simple
question.
If you can't "pip install", you'll probably have to build from sour
I've used bbfreeze on linux, but that's been ~8 years ago. Don't know about
the current state of the project.
Regards,
Nate
On Tue, May 9, 2017 at 9:42 PM, MrJean1 wrote:
>
> > Is there any way to pack my .py with all required libraries and create a
> self running package? Something like buildi
bones, single-user one).
Regards,
Nathan
On Mon, May 15, 2017 at 4:01 PM, Deborah Swanson
wrote:
> Chris Angelico wrote, on Monday, May 15, 2017 11:22 AM
> >
> > On Tue, May 16, 2017 at 4:12 AM, Deborah Swanson
> > wrote:
> > > It continues to amaze me that Anaconda
There is another way to do it, but it's not pretty, and I don't recommend
it:
>>> class Foo:
... pass
...
>>> from functools import partial
>>> f = Foo()
>>> def hello(self, arg):
... print("hello", arg)
...
>>> f.hello = partial(hello, f)
>>> f.hello("world")
hello world
This basically re
MS used to, I'm not sure if they still do, provide a separate C++ SDK that
included the compiler, but not the full IDE. It was still quite a large
download at ~128MB. But, it included only the command-line compiler, linker
& std lib.
Starting with VS2017, the ABI is supposedly stable going foward
Not sure if this is the cause of your error, but the value for the variable
"user" is misspelled according to the preceding comment. "admim" vs "admin"
(not the M instead of an N at the end).
Regards,
Nathan
On Wed, Jun 28, 2017 at 3:08 PM, Ken R. Lewis
wrote
In Python, "==" is not a reference equality operator (and I hate Java for
their misuse of the operator), so I absolutely disagree with using the Java
description to describe Python's "==" operator, primarily because, well,
it's wrong. Simple example:
With Python 3.5.2 (should hold for any version
n.org/3/library/functions.html#isinstance for details.
Regards,
Nathan
On Fri, Jul 7, 2017 at 2:04 AM, Peter Otten <__pete...@web.de> wrote:
> Sayth Renshaw wrote:
>
> > I was trying to solve a problem and cannot determine how to filter 0's
> but
> > not false.
gt;>> n = 4000; m = 4000; n is m
True
>>> n = 4000
>>> m = 4000
>>> n is m
False
>>>
On Fri, Jul 7, 2017 at 2:29 AM, Dan Wissme wrote:
> Le 06/07/2017 à 20:56, Nathan Ernst a écrit :
>
>> In Python, "==" is not a reference equal
Check your user folder. For me, on my PC, python is installed
at C:\Users\nernst\AppData\Local\Programs\Python
Regards,
Nate
On Fri, Jul 21, 2017 at 9:24 AM, Brian Case wrote:
> I am running windows 10 version 1703 as administrator on a Dell Inspiron
> 15 laptop.
>
> I downloaded and installed
"))
2
>>> floor(2)
2
Remember that Python is strongly typed; you do not get automatic type
conversions from strings to numeric types such as in Perl.
Regards,
Nathan
On Thu, Aug 24, 2017 at 2:24 PM, Stefan Ram wrote:
> This is a transcript:
>
> >>> from math im
201 - 287 of 287 matches
Mail list logo